From 75ee1d74a9ef4733971b1fb27f1e6219095dcb49 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Wed, 19 Jun 2024 16:18:33 -0400 Subject: [PATCH 01/10] rewrite relocation-model to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/relocation-model/Makefile | 20 -------------- tests/run-make/relocation-model/rmake.rs | 26 +++++++++++++++++++ 3 files changed, 26 insertions(+), 21 deletions(-) delete mode 100644 tests/run-make/relocation-model/Makefile create mode 100644 tests/run-make/relocation-model/rmake.rs diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 2b273b92ec2d8..ad575e01609c9 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -164,7 +164,6 @@ run-make/raw-dylib-inline-cross-dylib/Makefile run-make/raw-dylib-link-ordinal/Makefile run-make/raw-dylib-stdcall-ordinal/Makefile run-make/redundant-libs/Makefile -run-make/relocation-model/Makefile run-make/relro-levels/Makefile run-make/remap-path-prefix-dwarf/Makefile run-make/remap-path-prefix/Makefile diff --git a/tests/run-make/relocation-model/Makefile b/tests/run-make/relocation-model/Makefile deleted file mode 100644 index 8cc5205ed51b4..0000000000000 --- a/tests/run-make/relocation-model/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: others - $(RUSTC) -C relocation-model=dynamic-no-pic foo.rs - $(call RUN,foo) - - $(RUSTC) -C relocation-model=default foo.rs - $(call RUN,foo) - - $(RUSTC) -C relocation-model=dynamic-no-pic --crate-type=dylib foo.rs --emit=link,obj - -ifdef IS_MSVC -# FIXME(#28026) -others: -else -others: - $(RUSTC) -C relocation-model=static foo.rs - $(call RUN,foo) -endif diff --git a/tests/run-make/relocation-model/rmake.rs b/tests/run-make/relocation-model/rmake.rs new file mode 100644 index 0000000000000..978e2f685a64f --- /dev/null +++ b/tests/run-make/relocation-model/rmake.rs @@ -0,0 +1,26 @@ +// Generation of position-independent code (PIC) can be altered +// through use of the -C relocation-model rustc flag. This test +// uses varied values with this flag and checks that compilation +// succeeds. +// See https://github.com/rust-lang/rust/pull/13340 + +//@ ignore-cross-compile + +use run_make_support::{run, rustc}; + +fn main() { + // FIXME(Oneirical): This first one will likely fail on MSVC due to #28026. + // Remove this after try-job + rustc().arg("-Crelocation-model=static").input("foo.rs").run(); + run("foo"); + rustc().arg("-Crelocation-model=dynamic-no-pic").input("foo.rs").run(); + run("foo"); + rustc().arg("-Crelocation-model=default").input("foo.rs").run(); + run("foo"); + rustc() + .arg("-Crelocation-model=dynamic-no-pic") + .crate_type("dylib") + .emit("link,obj") + .input("foo.rs") + .run(); +} From f22b5afa6a4125ba9a9d0a2a43e60c282808c245 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Wed, 19 Jun 2024 16:43:22 -0400 Subject: [PATCH 02/10] rewrite error-writing-dependencies to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - .../error-writing-dependencies/Makefile | 8 -------- .../error-writing-dependencies/rmake.rs | 17 +++++++++++++++++ 3 files changed, 17 insertions(+), 9 deletions(-) delete mode 100644 tests/run-make/error-writing-dependencies/Makefile create mode 100644 tests/run-make/error-writing-dependencies/rmake.rs diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index ad575e01609c9..d5b981a508336 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -34,7 +34,6 @@ run-make/emit-shared-files/Makefile run-make/emit-stack-sizes/Makefile run-make/emit-to-stdout/Makefile run-make/env-dep-info/Makefile -run-make/error-writing-dependencies/Makefile run-make/export-executable-symbols/Makefile run-make/extern-diff-internal-name/Makefile run-make/extern-flag-disambiguates/Makefile diff --git a/tests/run-make/error-writing-dependencies/Makefile b/tests/run-make/error-writing-dependencies/Makefile deleted file mode 100644 index a5d30a647f817..0000000000000 --- a/tests/run-make/error-writing-dependencies/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: - # Let's get a nice error message - $(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | \ - $(CGREP) "error writing dependencies" - # Make sure the filename shows up - $(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | $(CGREP) "baz" diff --git a/tests/run-make/error-writing-dependencies/rmake.rs b/tests/run-make/error-writing-dependencies/rmake.rs new file mode 100644 index 0000000000000..2227f0a1a7f8a --- /dev/null +++ b/tests/run-make/error-writing-dependencies/rmake.rs @@ -0,0 +1,17 @@ +// Invalid paths passed to rustc used to cause internal compilation errors +// alongside an obscure error message. This was turned into a standard error, +// and this test checks that the cleaner error message is printed instead. +// See https://github.com/rust-lang/rust/issues/13517 + +use run_make_support::rustc; + +// NOTE: This cannot be a UI test due to the --out-dir flag, which is +// already present by default in UI testing. + +fn main() { + let out = rustc().input("foo.rs").emit("dep-info").out_dir("foo/bar/baz").run_fail(); + // The error message should be informative. + out.assert_stderr_contains("error writing dependencies"); + // The filename should appear. + out.assert_stderr_contains("baz"); +} From 3c0a4bc915616855f2d3b6aa16ae77f621a24d5d Mon Sep 17 00:00:00 2001 From: Oneirical Date: Wed, 19 Jun 2024 16:52:36 -0400 Subject: [PATCH 03/10] rewrite crate-name-priority to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/crate-name-priority/Makefile | 12 ------------ tests/run-make/crate-name-priority/rmake.rs | 18 ++++++++++++++++++ tests/run-make/relocation-model/rmake.rs | 2 -- 4 files changed, 18 insertions(+), 15 deletions(-) delete mode 100644 tests/run-make/crate-name-priority/Makefile create mode 100644 tests/run-make/crate-name-priority/rmake.rs diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index d5b981a508336..df104ca9787c3 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -16,7 +16,6 @@ run-make/compiler-lookup-paths/Makefile run-make/compiler-rt-works-on-mingw/Makefile run-make/compressed-debuginfo/Makefile run-make/crate-hash-rustc-version/Makefile -run-make/crate-name-priority/Makefile run-make/cross-lang-lto-clang/Makefile run-make/cross-lang-lto-pgo-smoketest/Makefile run-make/cross-lang-lto-upstream-rlibs/Makefile diff --git a/tests/run-make/crate-name-priority/Makefile b/tests/run-make/crate-name-priority/Makefile deleted file mode 100644 index 4adaa75a71cf6..0000000000000 --- a/tests/run-make/crate-name-priority/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: - $(RUSTC) foo.rs - rm $(TMPDIR)/$(call BIN,foo) - $(RUSTC) foo.rs --crate-name bar - rm $(TMPDIR)/$(call BIN,bar) - $(RUSTC) foo1.rs - rm $(TMPDIR)/$(call BIN,foo) - $(RUSTC) foo1.rs -o $(TMPDIR)/$(call BIN,bar1) - rm $(TMPDIR)/$(call BIN,bar1) diff --git a/tests/run-make/crate-name-priority/rmake.rs b/tests/run-make/crate-name-priority/rmake.rs new file mode 100644 index 0000000000000..b7cb2c9971141 --- /dev/null +++ b/tests/run-make/crate-name-priority/rmake.rs @@ -0,0 +1,18 @@ +// The `crate_name` rustc flag should have higher priority +// over `#![crate_name = "foo"]` defined inside the source code. +// This test has a conflict between crate_names defined in the .rs files +// and the compiler flags, and checks that the flag is favoured each time. +// See https://github.com/rust-lang/rust/pull/15518 + +use run_make_support::{bin_name, fs_wrapper, rustc}; + +fn main() { + rustc().input("foo.rs").run(); + fs_wrapper::remove_file(bin_name("foo")); + rustc().input("foo.rs").crate_name("bar").run(); + fs_wrapper::remove_file(bin_name("bar")); + rustc().input("foo1.rs").run(); + fs_wrapper::remove_file(bin_name("foo")); + rustc().input("foo1.rs").output(bin_name("bar1")).run(); + fs_wrapper::remove_file(bin_name("bar1")); +} diff --git a/tests/run-make/relocation-model/rmake.rs b/tests/run-make/relocation-model/rmake.rs index 978e2f685a64f..9cf85d6d73023 100644 --- a/tests/run-make/relocation-model/rmake.rs +++ b/tests/run-make/relocation-model/rmake.rs @@ -9,8 +9,6 @@ use run_make_support::{run, rustc}; fn main() { - // FIXME(Oneirical): This first one will likely fail on MSVC due to #28026. - // Remove this after try-job rustc().arg("-Crelocation-model=static").input("foo.rs").run(); run("foo"); rustc().arg("-Crelocation-model=dynamic-no-pic").input("foo.rs").run(); From 225796a2df27b3a58bb163c7f59c51988b6dc9f3 Mon Sep 17 00:00:00 2001 From: Adwin White Date: Thu, 20 Jun 2024 11:08:12 +0800 Subject: [PATCH 04/10] Add method to get `FnAbi` of function pointer --- compiler/rustc_smir/src/rustc_smir/context.rs | 7 ++++++ compiler/stable_mir/src/compiler_interface.rs | 3 +++ compiler/stable_mir/src/ty.rs | 12 +++++++++- tests/ui-fulldeps/stable-mir/check_abi.rs | 23 +++++++++++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_smir/src/rustc_smir/context.rs b/compiler/rustc_smir/src/rustc_smir/context.rs index 9afd507ce113a..dde5e30c3d071 100644 --- a/compiler/rustc_smir/src/rustc_smir/context.rs +++ b/compiler/rustc_smir/src/rustc_smir/context.rs @@ -533,6 +533,13 @@ impl<'tcx> Context for TablesWrapper<'tcx> { Ok(tables.fn_abi_of_instance(instance, List::empty())?.stable(&mut *tables)) } + fn fn_ptr_abi(&self, fn_ptr: PolyFnSig) -> Result { + let mut tables = self.0.borrow_mut(); + let tcx = tables.tcx; + let sig = fn_ptr.internal(&mut *tables, tcx); + Ok(tables.fn_abi_of_fn_ptr(sig, List::empty())?.stable(&mut *tables)) + } + fn instance_def_id(&self, def: InstanceDef) -> stable_mir::DefId { let mut tables = self.0.borrow_mut(); let def_id = tables.instances[def].def_id(); diff --git a/compiler/stable_mir/src/compiler_interface.rs b/compiler/stable_mir/src/compiler_interface.rs index 3e138e3c2e04e..44dbf549c1a73 100644 --- a/compiler/stable_mir/src/compiler_interface.rs +++ b/compiler/stable_mir/src/compiler_interface.rs @@ -215,6 +215,9 @@ pub trait Context { /// Get an instance ABI. fn instance_abi(&self, def: InstanceDef) -> Result; + /// Get the ABI of a function pointer. + fn fn_ptr_abi(&self, fn_ptr: PolyFnSig) -> Result; + /// Get the layout of a type. fn ty_layout(&self, ty: Ty) -> Result; diff --git a/compiler/stable_mir/src/ty.rs b/compiler/stable_mir/src/ty.rs index 35927237281a0..8c120a96e75b1 100644 --- a/compiler/stable_mir/src/ty.rs +++ b/compiler/stable_mir/src/ty.rs @@ -2,7 +2,7 @@ use super::{ mir::{Body, Mutability, Safety}, with, DefId, Error, Symbol, }; -use crate::abi::Layout; +use crate::abi::{FnAbi, Layout}; use crate::crate_def::{CrateDef, CrateDefType}; use crate::mir::alloc::{read_target_int, read_target_uint, AllocId}; use crate::mir::mono::StaticDef; @@ -996,6 +996,16 @@ pub struct AliasTerm { pub type PolyFnSig = Binder; +impl PolyFnSig { + /// Compute a `FnAbi` suitable for indirect calls, i.e. to `fn` pointers. + /// + /// NB: this doesn't handle virtual calls - those should use `Instance::fn_abi` + /// instead, where the instance is an `InstanceKind::Virtual`. + pub fn fn_ptr_abi(self) -> Result { + with(|cx| cx.fn_ptr_abi(self)) + } +} + #[derive(Clone, Debug, Eq, PartialEq)] pub struct FnSig { pub inputs_and_output: Vec, diff --git a/tests/ui-fulldeps/stable-mir/check_abi.rs b/tests/ui-fulldeps/stable-mir/check_abi.rs index 359dd4146baf5..7518ea902ecf5 100644 --- a/tests/ui-fulldeps/stable-mir/check_abi.rs +++ b/tests/ui-fulldeps/stable-mir/check_abi.rs @@ -54,6 +54,21 @@ fn test_stable_mir() -> ControlFlow<()> { let variadic_fn = *get_item(&items, (ItemKind::Fn, "variadic_fn")).unwrap(); check_variadic(variadic_fn); + // Extract function pointers. + let fn_ptr_holder = *get_item(&items, (ItemKind::Fn, "fn_ptr_holder")).unwrap(); + let fn_ptr_holder_instance = Instance::try_from(fn_ptr_holder).unwrap(); + let body = fn_ptr_holder_instance.body().unwrap(); + let args = body.arg_locals(); + + // Test fn_abi of function pointer version. + let ptr_fn_abi = args[0].ty.kind().fn_sig().unwrap().fn_ptr_abi().unwrap(); + assert_eq!(ptr_fn_abi, fn_abi); + + // Test variadic_fn of function pointer version. + let ptr_variadic_fn_abi = args[1].ty.kind().fn_sig().unwrap().fn_ptr_abi().unwrap(); + assert!(ptr_variadic_fn_abi.c_variadic); + assert_eq!(ptr_variadic_fn_abi.args.len(), 1); + ControlFlow::Continue(()) } @@ -164,6 +179,14 @@ fn generate_input(path: &str) -> std::io::Result<()> { pub unsafe extern "C" fn variadic_fn(n: usize, mut args: ...) -> usize {{ 0 }} + + pub type ComplexFn = fn([u8; 0], char, NonZero) -> Result; + pub type VariadicFn = unsafe extern "C" fn(usize, ...) -> usize; + + pub fn fn_ptr_holder(complex_fn: ComplexFn, variadic_fn: VariadicFn) {{ + // We only care about the signature. + todo!() + }} "# )?; Ok(()) From b512bf6f77f9544b94d21755aeba164f82ae7094 Mon Sep 17 00:00:00 2001 From: Strophox Date: Fri, 21 Jun 2024 12:47:04 +0200 Subject: [PATCH 05/10] add as_ptr to trait AllocBytes, fix 2 impls; add pub fn get_bytes_unchecked_raw in allocation.rs; add pub fn get_alloc_bytes_unchecked_raw[_mut] in memory.rs --- .../rustc_const_eval/src/interpret/memory.rs | 17 ++++++++++++ .../src/mir/interpret/allocation.rs | 26 ++++++++++++++++--- src/tools/miri/src/alloc_bytes.rs | 4 +++ 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_const_eval/src/interpret/memory.rs b/compiler/rustc_const_eval/src/interpret/memory.rs index 9a26ac04b85a3..9d0c490822561 100644 --- a/compiler/rustc_const_eval/src/interpret/memory.rs +++ b/compiler/rustc_const_eval/src/interpret/memory.rs @@ -630,6 +630,13 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { } } + /// Gives raw, immutable access to the `Allocation` address, without bounds or alignment checks. + /// The caller is responsible for calling the access hooks! + pub fn get_alloc_bytes_unchecked_raw(&self, id: AllocId) -> InterpResult<'tcx, *const u8> { + let alloc = self.get_alloc_raw(id)?; + Ok(alloc.get_bytes_unchecked_raw()) + } + /// Bounds-checked *but not align-checked* allocation access. pub fn get_ptr_alloc<'a>( &'a self, @@ -713,6 +720,16 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { Ok((alloc, &mut self.machine)) } + /// Gives raw, mutable access to the `Allocation` address, without bounds or alignment checks. + /// The caller is responsible for calling the access hooks! + pub fn get_alloc_bytes_unchecked_raw_mut( + &mut self, + id: AllocId, + ) -> InterpResult<'tcx, *mut u8> { + let alloc = self.get_alloc_raw_mut(id)?.0; + Ok(alloc.get_bytes_unchecked_raw_mut()) + } + /// Bounds-checked *but not align-checked* allocation access. pub fn get_ptr_alloc_mut<'a>( &'a mut self, diff --git a/compiler/rustc_middle/src/mir/interpret/allocation.rs b/compiler/rustc_middle/src/mir/interpret/allocation.rs index 2fc466c0e7e91..cac3bf948a0c1 100644 --- a/compiler/rustc_middle/src/mir/interpret/allocation.rs +++ b/compiler/rustc_middle/src/mir/interpret/allocation.rs @@ -40,9 +40,16 @@ pub trait AllocBytes: Clone + fmt::Debug + Deref + DerefMut *mut u8; + + /// Gives direct access to the raw underlying storage. + /// + /// Crucially this pointer is compatible with: + /// - other pointers returned by this method, and + /// - references returned from `deref()`, as long as there was no write. + fn as_ptr(&self) -> *const u8; } /// Default `bytes` for `Allocation` is a `Box`. @@ -62,6 +69,11 @@ impl AllocBytes for Box<[u8]> { // Carefully avoiding any intermediate references. ptr::addr_of_mut!(**self).cast() } + + fn as_ptr(&self) -> *const u8 { + // Carefully avoiding any intermediate references. + ptr::addr_of!(**self).cast() + } } /// This type represents an Allocation in the Miri/CTFE core engine. @@ -490,19 +502,27 @@ impl Allocation self.provenance.clear(range, cx)?; assert!(range.end().bytes_usize() <= self.bytes.len()); // need to do our own bounds-check - // Cruciall, we go via `AllocBytes::as_mut_ptr`, not `AllocBytes::deref_mut`. + // Crucially, we go via `AllocBytes::as_mut_ptr`, not `AllocBytes::deref_mut`. let begin_ptr = self.bytes.as_mut_ptr().wrapping_add(range.start.bytes_usize()); let len = range.end().bytes_usize() - range.start.bytes_usize(); Ok(ptr::slice_from_raw_parts_mut(begin_ptr, len)) } /// This gives direct mutable access to the entire buffer, just exposing their internal state - /// without reseting anything. Directly exposes `AllocBytes::as_mut_ptr`. Only works if + /// without resetting anything. Directly exposes `AllocBytes::as_mut_ptr`. Only works if /// `OFFSET_IS_ADDR` is true. pub fn get_bytes_unchecked_raw_mut(&mut self) -> *mut u8 { assert!(Prov::OFFSET_IS_ADDR); self.bytes.as_mut_ptr() } + + /// This gives direct immutable access to the entire buffer, just exposing their internal state + /// without resetting anything. Directly exposes `AllocBytes::as_ptr`. Only works if + /// `OFFSET_IS_ADDR` is true. + pub fn get_bytes_unchecked_raw(&self) -> *const u8 { + assert!(Prov::OFFSET_IS_ADDR); + self.bytes.as_ptr() + } } /// Reading and writing. diff --git a/src/tools/miri/src/alloc_bytes.rs b/src/tools/miri/src/alloc_bytes.rs index 97841a05cdebf..8f691456a596d 100644 --- a/src/tools/miri/src/alloc_bytes.rs +++ b/src/tools/miri/src/alloc_bytes.rs @@ -108,4 +108,8 @@ impl AllocBytes for MiriAllocBytes { fn as_mut_ptr(&mut self) -> *mut u8 { self.ptr } + + fn as_ptr(&self) -> *const u8 { + self.ptr + } } From 771e44ebd32df8e342efa1f246f5d5070af04ec4 Mon Sep 17 00:00:00 2001 From: beetrees Date: Sat, 15 Jun 2024 22:30:25 +0100 Subject: [PATCH 06/10] Add `f16` inline ASM support for RISC-V --- compiler/rustc_codegen_llvm/src/asm.rs | 55 +++++++++++++++++++++++--- compiler/rustc_span/src/symbol.rs | 2 + compiler/rustc_target/src/asm/riscv.rs | 7 ++-- tests/assembly/asm/riscv-types.rs | 55 +++++++++++++++++++++++++- 4 files changed, 108 insertions(+), 11 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/asm.rs b/compiler/rustc_codegen_llvm/src/asm.rs index 60e63b956db6e..34a0f9973f6a5 100644 --- a/compiler/rustc_codegen_llvm/src/asm.rs +++ b/compiler/rustc_codegen_llvm/src/asm.rs @@ -13,7 +13,7 @@ use rustc_codegen_ssa::traits::*; use rustc_data_structures::fx::FxHashMap; use rustc_middle::ty::layout::TyAndLayout; use rustc_middle::{bug, span_bug, ty::Instance}; -use rustc_span::{Pos, Span}; +use rustc_span::{sym, Pos, Span, Symbol}; use rustc_target::abi::*; use rustc_target::asm::*; use tracing::debug; @@ -64,7 +64,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { let mut layout = None; let ty = if let Some(ref place) = place { layout = Some(&place.layout); - llvm_fixup_output_type(self.cx, reg.reg_class(), &place.layout) + llvm_fixup_output_type(self.cx, reg.reg_class(), &place.layout, instance) } else if matches!( reg.reg_class(), InlineAsmRegClass::X86( @@ -112,7 +112,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { // so we just use the type of the input. &in_value.layout }; - let ty = llvm_fixup_output_type(self.cx, reg.reg_class(), layout); + let ty = llvm_fixup_output_type(self.cx, reg.reg_class(), layout, instance); output_types.push(ty); op_idx.insert(idx, constraints.len()); let prefix = if late { "=" } else { "=&" }; @@ -127,8 +127,13 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { for (idx, op) in operands.iter().enumerate() { match *op { InlineAsmOperandRef::In { reg, value } => { - let llval = - llvm_fixup_input(self, value.immediate(), reg.reg_class(), &value.layout); + let llval = llvm_fixup_input( + self, + value.immediate(), + reg.reg_class(), + &value.layout, + instance, + ); inputs.push(llval); op_idx.insert(idx, constraints.len()); constraints.push(reg_to_llvm(reg, Some(&value.layout))); @@ -139,6 +144,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { in_value.immediate(), reg.reg_class(), &in_value.layout, + instance, ); inputs.push(value); @@ -341,7 +347,8 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { } else { self.extract_value(result, op_idx[&idx] as u64) }; - let value = llvm_fixup_output(self, value, reg.reg_class(), &place.layout); + let value = + llvm_fixup_output(self, value, reg.reg_class(), &place.layout, instance); OperandValue::Immediate(value).store(self, place); } } @@ -913,12 +920,22 @@ fn llvm_asm_scalar_type<'ll>(cx: &CodegenCx<'ll, '_>, scalar: Scalar) -> &'ll Ty } } +fn any_target_feature_enabled( + cx: &CodegenCx<'_, '_>, + instance: Instance<'_>, + features: &[Symbol], +) -> bool { + let enabled = cx.tcx.asm_target_features(instance.def_id()); + features.iter().any(|feat| enabled.contains(feat)) +} + /// Fix up an input value to work around LLVM bugs. fn llvm_fixup_input<'ll, 'tcx>( bx: &mut Builder<'_, 'll, 'tcx>, mut value: &'ll Value, reg: InlineAsmRegClass, layout: &TyAndLayout<'tcx>, + instance: Instance<'_>, ) -> &'ll Value { let dl = &bx.tcx.data_layout; match (reg, layout.abi) { @@ -1029,6 +1046,16 @@ fn llvm_fixup_input<'ll, 'tcx>( _ => value, } } + (InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::freg), Abi::Scalar(s)) + if s.primitive() == Primitive::Float(Float::F16) + && !any_target_feature_enabled(bx, instance, &[sym::zfhmin, sym::zfh]) => + { + // Smaller floats are always "NaN-boxed" inside larger floats on RISC-V. + let value = bx.bitcast(value, bx.type_i16()); + let value = bx.zext(value, bx.type_i32()); + let value = bx.or(value, bx.const_u32(0xFFFF_0000)); + bx.bitcast(value, bx.type_f32()) + } _ => value, } } @@ -1039,6 +1066,7 @@ fn llvm_fixup_output<'ll, 'tcx>( mut value: &'ll Value, reg: InlineAsmRegClass, layout: &TyAndLayout<'tcx>, + instance: Instance<'_>, ) -> &'ll Value { match (reg, layout.abi) { (InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg), Abi::Scalar(s)) => { @@ -1140,6 +1168,14 @@ fn llvm_fixup_output<'ll, 'tcx>( _ => value, } } + (InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::freg), Abi::Scalar(s)) + if s.primitive() == Primitive::Float(Float::F16) + && !any_target_feature_enabled(bx, instance, &[sym::zfhmin, sym::zfh]) => + { + let value = bx.bitcast(value, bx.type_i32()); + let value = bx.trunc(value, bx.type_i16()); + bx.bitcast(value, bx.type_f16()) + } _ => value, } } @@ -1149,6 +1185,7 @@ fn llvm_fixup_output_type<'ll, 'tcx>( cx: &CodegenCx<'ll, 'tcx>, reg: InlineAsmRegClass, layout: &TyAndLayout<'tcx>, + instance: Instance<'_>, ) -> &'ll Type { match (reg, layout.abi) { (InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg), Abi::Scalar(s)) => { @@ -1242,6 +1279,12 @@ fn llvm_fixup_output_type<'ll, 'tcx>( _ => layout.llvm_type(cx), } } + (InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::freg), Abi::Scalar(s)) + if s.primitive() == Primitive::Float(Float::F16) + && !any_target_feature_enabled(cx, instance, &[sym::zfhmin, sym::zfh]) => + { + cx.type_f32() + } _ => layout.llvm_type(cx), } } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index f44fa1bcb4fd1..018442af144cd 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -2054,6 +2054,8 @@ symbols! { yes, yield_expr, ymm_reg, + zfh, + zfhmin, zmm_reg, } } diff --git a/compiler/rustc_target/src/asm/riscv.rs b/compiler/rustc_target/src/asm/riscv.rs index 3845a0e14af09..02a4a5e2ece59 100644 --- a/compiler/rustc_target/src/asm/riscv.rs +++ b/compiler/rustc_target/src/asm/riscv.rs @@ -40,12 +40,13 @@ impl RiscVInlineAsmRegClass { match self { Self::reg => { if arch == InlineAsmArch::RiscV64 { - types! { _: I8, I16, I32, I64, F32, F64; } + types! { _: I8, I16, I32, I64, F16, F32, F64; } } else { - types! { _: I8, I16, I32, F32; } + types! { _: I8, I16, I32, F16, F32; } } } - Self::freg => types! { f: F32; d: F64; }, + // FIXME(f16_f128): Add `q: F128;` once LLVM support the `Q` extension. + Self::freg => types! { f: F16, F32; d: F64; }, Self::vreg => &[], } } diff --git a/tests/assembly/asm/riscv-types.rs b/tests/assembly/asm/riscv-types.rs index 0d1f8305d375e..51b3aaf99d944 100644 --- a/tests/assembly/asm/riscv-types.rs +++ b/tests/assembly/asm/riscv-types.rs @@ -1,12 +1,34 @@ -//@ revisions: riscv64 riscv32 +//@ revisions: riscv64 riscv32 riscv64-zfhmin riscv32-zfhmin riscv64-zfh riscv32-zfh //@ assembly-output: emit-asm + //@[riscv64] compile-flags: --target riscv64imac-unknown-none-elf //@[riscv64] needs-llvm-components: riscv + //@[riscv32] compile-flags: --target riscv32imac-unknown-none-elf //@[riscv32] needs-llvm-components: riscv + +//@[riscv64-zfhmin] compile-flags: --target riscv64imac-unknown-none-elf --cfg riscv64 +//@[riscv64-zfhmin] needs-llvm-components: riscv +//@[riscv64-zfhmin] compile-flags: -C target-feature=+zfhmin +//@[riscv64-zfhmin] filecheck-flags: --check-prefix riscv64 + +//@[riscv32-zfhmin] compile-flags: --target riscv32imac-unknown-none-elf +//@[riscv32-zfhmin] needs-llvm-components: riscv +//@[riscv32-zfhmin] compile-flags: -C target-feature=+zfhmin + +//@[riscv64-zfh] compile-flags: --target riscv64imac-unknown-none-elf --cfg riscv64 +//@[riscv64-zfh] needs-llvm-components: riscv +//@[riscv64-zfh] compile-flags: -C target-feature=+zfh +//@[riscv64-zfh] filecheck-flags: --check-prefix riscv64 --check-prefix zfhmin + +//@[riscv32-zfh] compile-flags: --target riscv32imac-unknown-none-elf +//@[riscv32-zfh] needs-llvm-components: riscv +//@[riscv32-zfh] compile-flags: -C target-feature=+zfh +//@[riscv32-zfh] filecheck-flags: --check-prefix zfhmin + //@ compile-flags: -C target-feature=+d -#![feature(no_core, lang_items, rustc_attrs)] +#![feature(no_core, lang_items, rustc_attrs, f16)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register)] @@ -33,6 +55,7 @@ type ptr = *mut u8; impl Copy for i8 {} impl Copy for i16 {} +impl Copy for f16 {} impl Copy for i32 {} impl Copy for f32 {} impl Copy for i64 {} @@ -103,6 +126,12 @@ macro_rules! check_reg { // CHECK: #NO_APP check!(reg_i8 i8 reg "mv"); +// CHECK-LABEL: reg_f16: +// CHECK: #APP +// CHECK: mv {{[a-z0-9]+}}, {{[a-z0-9]+}} +// CHECK: #NO_APP +check!(reg_f16 f16 reg "mv"); + // CHECK-LABEL: reg_i16: // CHECK: #APP // CHECK: mv {{[a-z0-9]+}}, {{[a-z0-9]+}} @@ -141,6 +170,14 @@ check!(reg_f64 f64 reg "mv"); // CHECK: #NO_APP check!(reg_ptr ptr reg "mv"); +// CHECK-LABEL: freg_f16: +// zfhmin-NOT: or +// CHECK: #APP +// CHECK: fmv.s f{{[a-z0-9]+}}, f{{[a-z0-9]+}} +// CHECK: #NO_APP +// zfhmin-NOT: or +check!(freg_f16 f16 freg "fmv.s"); + // CHECK-LABEL: freg_f32: // CHECK: #APP // CHECK: fmv.s f{{[a-z0-9]+}}, f{{[a-z0-9]+}} @@ -165,6 +202,12 @@ check_reg!(a0_i8 i8 "a0" "mv"); // CHECK: #NO_APP check_reg!(a0_i16 i16 "a0" "mv"); +// CHECK-LABEL: a0_f16: +// CHECK: #APP +// CHECK: mv a0, a0 +// CHECK: #NO_APP +check_reg!(a0_f16 f16 "a0" "mv"); + // CHECK-LABEL: a0_i32: // CHECK: #APP // CHECK: mv a0, a0 @@ -197,6 +240,14 @@ check_reg!(a0_f64 f64 "a0" "mv"); // CHECK: #NO_APP check_reg!(a0_ptr ptr "a0" "mv"); +// CHECK-LABEL: fa0_f16: +// zfhmin-NOT: or +// CHECK: #APP +// CHECK: fmv.s fa0, fa0 +// CHECK: #NO_APP +// zfhmin-NOT: or +check_reg!(fa0_f16 f16 "fa0" "fmv.s"); + // CHECK-LABEL: fa0_f32: // CHECK: #APP // CHECK: fmv.s fa0, fa0 From d94a40516efd42e0ed6d92645866959ad04e95eb Mon Sep 17 00:00:00 2001 From: Miguel Flores Ruiz de Eguino <1889916+miguelfrde@users.noreply.github.com> Date: Fri, 21 Jun 2024 10:48:30 -0700 Subject: [PATCH 07/10] [fuchsia-test-runner] Remove usage of kw_only We are still at Python 3.8 in Fuchsia infra. This was introduced at Python 3.10. --- src/ci/docker/scripts/fuchsia-test-runner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/scripts/fuchsia-test-runner.py b/src/ci/docker/scripts/fuchsia-test-runner.py index 115ee69a5891b..6db25ff1a809e 100755 --- a/src/ci/docker/scripts/fuchsia-test-runner.py +++ b/src/ci/docker/scripts/fuchsia-test-runner.py @@ -112,7 +112,7 @@ def atomic_link(link: Path, target: Path): os.remove(tmp_file) -@dataclass(kw_only=True) +@dataclass class TestEnvironment: rust_build_dir: Path sdk_dir: Path From 5d5892e9666585ec7e457e3379158438e9d4b959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 21 Jun 2024 21:12:00 +0000 Subject: [PATCH 08/10] Remove stray `.` from error message --- compiler/rustc_hir_analysis/messages.ftl | 2 +- tests/ui/error-codes/E0116.stderr | 2 +- .../incoherent-inherent-impls/no-attr-empty-impl.stderr | 8 ++++---- tests/ui/traits/trait-or-new-type-instead.stderr | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl index 8c740d87e9535..b8f610e569670 100644 --- a/compiler/rustc_hir_analysis/messages.ftl +++ b/compiler/rustc_hir_analysis/messages.ftl @@ -194,7 +194,7 @@ hir_analysis_inherent_ty_outside = cannot define inherent `impl` for a type outs .span_help = alternatively add `#[rustc_has_incoherent_inherent_impls]` to the type and `#[rustc_allow_incoherent_impl]` to the relevant impl items hir_analysis_inherent_ty_outside_new = cannot define inherent `impl` for a type outside of the crate where the type is defined - .label = impl for type defined outside of crate. + .label = impl for type defined outside of crate .note = define and implement a trait or new type instead hir_analysis_inherent_ty_outside_primitive = cannot define inherent `impl` for primitive types outside of `core` diff --git a/tests/ui/error-codes/E0116.stderr b/tests/ui/error-codes/E0116.stderr index bf215435ba6a0..1ea5a57f46db1 100644 --- a/tests/ui/error-codes/E0116.stderr +++ b/tests/ui/error-codes/E0116.stderr @@ -2,7 +2,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher --> $DIR/E0116.rs:1:1 | LL | impl Vec {} - | ^^^^^^^^^^^^ impl for type defined outside of crate. + | ^^^^^^^^^^^^ impl for type defined outside of crate | = note: define and implement a trait or new type instead diff --git a/tests/ui/incoherent-inherent-impls/no-attr-empty-impl.stderr b/tests/ui/incoherent-inherent-impls/no-attr-empty-impl.stderr index 6dc1680cf89f8..f8491697910c0 100644 --- a/tests/ui/incoherent-inherent-impls/no-attr-empty-impl.stderr +++ b/tests/ui/incoherent-inherent-impls/no-attr-empty-impl.stderr @@ -2,7 +2,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher --> $DIR/no-attr-empty-impl.rs:4:1 | LL | impl extern_crate::StructWithAttr {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate | = note: define and implement a trait or new type instead @@ -10,7 +10,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher --> $DIR/no-attr-empty-impl.rs:7:1 | LL | impl extern_crate::StructNoAttr {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate | = note: define and implement a trait or new type instead @@ -18,7 +18,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher --> $DIR/no-attr-empty-impl.rs:10:1 | LL | impl extern_crate::EnumWithAttr {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate | = note: define and implement a trait or new type instead @@ -26,7 +26,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher --> $DIR/no-attr-empty-impl.rs:13:1 | LL | impl extern_crate::EnumNoAttr {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate | = note: define and implement a trait or new type instead diff --git a/tests/ui/traits/trait-or-new-type-instead.stderr b/tests/ui/traits/trait-or-new-type-instead.stderr index 17ee939887864..5f5aa3ac56982 100644 --- a/tests/ui/traits/trait-or-new-type-instead.stderr +++ b/tests/ui/traits/trait-or-new-type-instead.stderr @@ -2,7 +2,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher --> $DIR/trait-or-new-type-instead.rs:1:1 | LL | impl Option { - | ^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. + | ^^^^^^^^^^^^^^^^^ impl for type defined outside of crate | = note: define and implement a trait or new type instead From ea681ef2814b321177d1eee437b8867d31141754 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Fri, 21 Jun 2024 18:20:41 -0400 Subject: [PATCH 09/10] Add a tidy rule to make sure that diagnostics don't end in periods --- src/tools/tidy/Cargo.toml | 1 + src/tools/tidy/src/fluent_period.rs | 84 +++++++++++++++++++++++++++++ src/tools/tidy/src/lib.rs | 1 + src/tools/tidy/src/main.rs | 1 + 4 files changed, 87 insertions(+) create mode 100644 src/tools/tidy/src/fluent_period.rs diff --git a/src/tools/tidy/Cargo.toml b/src/tools/tidy/Cargo.toml index 63963b0bd1ced..f39438bd9ace2 100644 --- a/src/tools/tidy/Cargo.toml +++ b/src/tools/tidy/Cargo.toml @@ -13,6 +13,7 @@ ignore = "0.4.18" semver = "1.0" termcolor = "1.1.3" rustc-hash = "1.1.0" +fluent-syntax = "0.11.1" [[bin]] name = "rust-tidy" diff --git a/src/tools/tidy/src/fluent_period.rs b/src/tools/tidy/src/fluent_period.rs new file mode 100644 index 0000000000000..3a1fb6daf4854 --- /dev/null +++ b/src/tools/tidy/src/fluent_period.rs @@ -0,0 +1,84 @@ +//! Checks that no Fluent messages or attributes end in periods (except ellipses) + +use fluent_syntax::ast::{Entry, PatternElement}; + +use crate::walk::{filter_dirs, walk}; +use std::path::Path; + +fn filter_fluent(path: &Path) -> bool { + if let Some(ext) = path.extension() { ext.to_str() != Some("ftl") } else { true } +} + +/// Messages allowed to have `.` at their end. +/// +/// These should probably be reworked eventually. +const ALLOWLIST: &[&str] = &[ + "const_eval_long_running", + "const_eval_validation_failure_note", + "driver_impl_ice", + "incremental_corrupt_file", + "mir_build_pointer_pattern", +]; + +fn check_period(filename: &str, contents: &str, bad: &mut bool) { + if filename.contains("codegen") { + // FIXME: Too many codegen messages have periods right now... + return; + } + + let (Ok(parse) | Err((parse, _))) = fluent_syntax::parser::parse(contents); + for entry in &parse.body { + if let Entry::Message(m) = entry { + if ALLOWLIST.contains(&m.id.name) { + continue; + } + + if let Some(pat) = &m.value { + if let Some(PatternElement::TextElement { value }) = pat.elements.last() { + // We don't care about ellipses. + if value.ends_with(".") && !value.ends_with("...") { + let ll = find_line(contents, *value); + let name = m.id.name; + tidy_error!(bad, "{filename}:{ll}: message `{name}` ends in a period"); + } + } + } + + for attr in &m.attributes { + // Teach notes usually have long messages. + if attr.id.name == "teach_note" { + continue; + } + + if let Some(PatternElement::TextElement { value }) = attr.value.elements.last() { + if value.ends_with(".") && !value.ends_with("...") { + let ll = find_line(contents, *value); + let name = attr.id.name; + tidy_error!(bad, "{filename}:{ll}: attr `{name}` ends in a period"); + } + } + } + } + } +} + +/// Evil cursed bad hack. Requires that `value` be a substr (in memory) of `contents`. +fn find_line(haystack: &str, needle: &str) -> usize { + for (ll, line) in haystack.lines().enumerate() { + if line.as_ptr() > needle.as_ptr() { + return ll; + } + } + + 1 +} + +pub fn check(path: &Path, bad: &mut bool) { + walk( + path, + |path, is_dir| filter_dirs(path) || (!is_dir && filter_fluent(path)), + &mut |ent, contents| { + check_period(ent.path().to_str().unwrap(), contents, bad); + }, + ); +} diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs index ae9d2b8b8dc87..ecd32727fa058 100644 --- a/src/tools/tidy/src/lib.rs +++ b/src/tools/tidy/src/lib.rs @@ -72,6 +72,7 @@ pub mod ext_tool_checks; pub mod extdeps; pub mod features; pub mod fluent_alphabetical; +pub mod fluent_period; mod fluent_used; pub(crate) mod iter_header; pub mod known_bug; diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs index 1d2b2e4d03472..ec6fc1f07f11e 100644 --- a/src/tools/tidy/src/main.rs +++ b/src/tools/tidy/src/main.rs @@ -115,6 +115,7 @@ fn main() { // Checks that only make sense for the compiler. check!(error_codes, &root_path, &[&compiler_path, &librustdoc_path], verbose); check!(fluent_alphabetical, &compiler_path, bless); + check!(fluent_period, &compiler_path); check!(target_policy, &root_path); // Checks that only make sense for the std libs. From ffd72b1700a6c96b2468e9259fdb4beea11717e0 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Fri, 21 Jun 2024 18:20:45 -0400 Subject: [PATCH 10/10] Fix remaining cases --- Cargo.lock | 1 + compiler/rustc_ast_lowering/messages.ftl | 2 +- compiler/rustc_const_eval/messages.ftl | 3 +-- compiler/rustc_hir_analysis/messages.ftl | 4 ++-- compiler/rustc_lint/messages.ftl | 8 +++---- compiler/rustc_metadata/messages.ftl | 4 ++-- compiler/rustc_mir_build/messages.ftl | 2 +- compiler/rustc_passes/messages.ftl | 18 +++++++-------- compiler/rustc_resolve/messages.ftl | 2 +- compiler/rustc_session/messages.ftl | 4 ++-- tests/ui/abi/abi-typo-unstable.stderr | 2 +- ...cv-discoverability-guidance.riscv32.stderr | 4 ++-- ...cv-discoverability-guidance.riscv64.stderr | 4 ++-- tests/ui/codemap_tests/unicode.normal.stderr | 2 +- tests/ui/error-codes/E0116.stderr | 2 +- tests/ui/error-codes/E0519.stderr | 2 +- ...issue-43106-gating-of-builtin-attrs.stderr | 4 ++-- .../no-attr-empty-impl.stderr | 8 +++---- .../mcdc-condition-limit.bad.stderr | 2 +- .../mcdc-condition-limit.rs | 2 +- .../ui/lifetimes/no_lending_iterators.stderr | 2 +- .../ui/lint/lint-attr-everywhere-late.stderr | 22 +++++++++---------- .../lint-enum-intrinsics-non-enums.stderr | 18 +++++++-------- ...assoc_type_bounds_sized_unnecessary.stderr | 2 +- tests/ui/parser/issues/issue-8537.stderr | 2 +- tests/ui/suggestions/abi-typo.stderr | 2 +- .../duplicate-diagnostic.stderr | 8 +++---- .../traits/trait-or-new-type-instead.stderr | 2 +- 28 files changed, 69 insertions(+), 69 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6fc077871155e..77dcd056f8777 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5700,6 +5700,7 @@ name = "tidy" version = "0.1.0" dependencies = [ "cargo_metadata 0.15.4", + "fluent-syntax", "ignore", "miropt-test-tools", "regex", diff --git a/compiler/rustc_ast_lowering/messages.ftl b/compiler/rustc_ast_lowering/messages.ftl index 7d81e45d314d8..52164d6ef1648 100644 --- a/compiler/rustc_ast_lowering/messages.ftl +++ b/compiler/rustc_ast_lowering/messages.ftl @@ -78,7 +78,7 @@ ast_lowering_inline_asm_unsupported_target = ast_lowering_invalid_abi = invalid ABI: found `{$abi}` .label = invalid ABI - .note = invoke `{$command}` for a full list of supported calling conventions. + .note = invoke `{$command}` for a full list of supported calling conventions ast_lowering_invalid_abi_clobber_abi = invalid ABI for `clobber_abi` diff --git a/compiler/rustc_const_eval/messages.ftl b/compiler/rustc_const_eval/messages.ftl index 1a7e5bd70921b..1476fe285ef5c 100644 --- a/compiler/rustc_const_eval/messages.ftl +++ b/compiler/rustc_const_eval/messages.ftl @@ -341,8 +341,7 @@ const_eval_unallowed_fn_pointer_call = function pointer calls are not allowed in const_eval_unallowed_heap_allocations = allocations are not allowed in {const_eval_const_context}s .label = allocation not allowed in {const_eval_const_context}s - .teach_note = - The value of statics and constants must be known at compile time, and they live for the entire lifetime of a program. Creating a boxed value allocates memory on the heap at runtime, and therefore cannot be done at compile time. + .teach_note = The value of statics and constants must be known at compile time, and they live for the entire lifetime of a program. Creating a boxed value allocates memory on the heap at runtime, and therefore cannot be done at compile time. const_eval_unallowed_inline_asm = inline assembly is not allowed in {const_eval_const_context}s diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl index 8c740d87e9535..ca653e50aab76 100644 --- a/compiler/rustc_hir_analysis/messages.ftl +++ b/compiler/rustc_hir_analysis/messages.ftl @@ -194,7 +194,7 @@ hir_analysis_inherent_ty_outside = cannot define inherent `impl` for a type outs .span_help = alternatively add `#[rustc_has_incoherent_inherent_impls]` to the type and `#[rustc_allow_incoherent_impl]` to the relevant impl items hir_analysis_inherent_ty_outside_new = cannot define inherent `impl` for a type outside of the crate where the type is defined - .label = impl for type defined outside of crate. + .label = impl for type defined outside of crate .note = define and implement a trait or new type instead hir_analysis_inherent_ty_outside_primitive = cannot define inherent `impl` for primitive types outside of `core` @@ -544,7 +544,7 @@ hir_analysis_unrecognized_intrinsic_function = hir_analysis_unused_associated_type_bounds = unnecessary associated type bound for not object safe associated type - .note = this associated type has a `where Self: Sized` bound. Thus, while the associated type can be specified, it cannot be used in any way, because trait objects are not `Sized`. + .note = this associated type has a `where Self: Sized` bound, and while the associated type can be specified, it cannot be used because trait objects are never `Sized` .suggestion = remove this bound hir_analysis_unused_generic_parameter = diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl index 468673f05c118..fdedf2c2e6d38 100644 --- a/compiler/rustc_lint/messages.ftl +++ b/compiler/rustc_lint/messages.ftl @@ -75,7 +75,7 @@ lint_builtin_deprecated_attr_default_suggestion = remove this attribute lint_builtin_deprecated_attr_link = use of deprecated attribute `{$name}`: {$reason}. See {$link} .msg_suggestion = {$msg} .default_suggestion = remove this attribute -lint_builtin_deprecated_attr_used = use of deprecated attribute `{$name}`: no longer used. +lint_builtin_deprecated_attr_used = use of deprecated attribute `{$name}`: no longer used lint_builtin_deref_nullptr = dereferencing a null pointer .label = this code causes undefined behavior when executed @@ -213,7 +213,7 @@ lint_default_hash_types = prefer `{$preferred}` over `{$used}`, it has better pe lint_default_source = `forbid` lint level is the default for {$id} lint_deprecated_lint_name = - lint name `{$name}` is deprecated and may not have an effect in the future. + lint name `{$name}` is deprecated and may not have an effect in the future .suggestion = change it to .help = change it to {$replace} @@ -244,11 +244,11 @@ lint_duplicate_matcher_binding = duplicate matcher binding lint_enum_intrinsics_mem_discriminant = the return value of `mem::discriminant` is unspecified when called with a non-enum type - .note = the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `{$ty_param}`, which is not an enum. + .note = the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `{$ty_param}`, which is not an enum lint_enum_intrinsics_mem_variant = the return value of `mem::variant_count` is unspecified when called with a non-enum type - .note = the type parameter of `variant_count` should be an enum, but it was instantiated with the type `{$ty_param}`, which is not an enum. + .note = the type parameter of `variant_count` should be an enum, but it was instantiated with the type `{$ty_param}`, which is not an enum lint_expectation = this lint expectation is unfulfilled .note = the `unfulfilled_lint_expectations` lint can't be expected and will always produce this message diff --git a/compiler/rustc_metadata/messages.ftl b/compiler/rustc_metadata/messages.ftl index 932603cd6b267..415399ed06c7f 100644 --- a/compiler/rustc_metadata/messages.ftl +++ b/compiler/rustc_metadata/messages.ftl @@ -248,13 +248,13 @@ metadata_rustc_lib_required = .help = try adding `extern crate rustc_driver;` at the top level of this crate metadata_stable_crate_id_collision = - found crates (`{$crate_name0}` and `{$crate_name1}`) with colliding StableCrateId values. + found crates (`{$crate_name0}` and `{$crate_name1}`) with colliding StableCrateId values metadata_std_required = `std` is required by `{$current_crate}` because it does not declare `#![no_std]` metadata_symbol_conflicts_current = - the current crate is indistinguishable from one of its dependencies: it has the same crate-name `{$crate_name}` and was compiled with the same `-C metadata` arguments. This will result in symbol conflicts between the two. + the current crate is indistinguishable from one of its dependencies: it has the same crate-name `{$crate_name}` and was compiled with the same `-C metadata` arguments, so this will result in symbol conflicts between the two metadata_target_no_std_support = the `{$locator_triple}` target may not support the standard library diff --git a/compiler/rustc_mir_build/messages.ftl b/compiler/rustc_mir_build/messages.ftl index 1ee8777c27414..0c277811fdacf 100644 --- a/compiler/rustc_mir_build/messages.ftl +++ b/compiler/rustc_mir_build/messages.ftl @@ -103,7 +103,7 @@ mir_build_deref_raw_pointer_requires_unsafe_unsafe_op_in_unsafe_fn_allowed = .note = raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior .label = dereference of raw pointer -mir_build_exceeds_mcdc_condition_limit = Number of conditions in decision ({$num_conditions}) exceeds limit ({$max_conditions}). MC/DC analysis will not count this expression. +mir_build_exceeds_mcdc_condition_limit = number of conditions in decision ({$num_conditions}) exceeds limit ({$max_conditions}), so MC/DC analysis will not count this expression mir_build_extern_static_requires_unsafe = use of extern static is unsafe and requires unsafe block diff --git a/compiler/rustc_passes/messages.ftl b/compiler/rustc_passes/messages.ftl index 84dbd192723e1..84c71c4bed29b 100644 --- a/compiler/rustc_passes/messages.ftl +++ b/compiler/rustc_passes/messages.ftl @@ -14,7 +14,7 @@ passes_abi_of = fn_abi_of({$fn_name}) = {$fn_abi} passes_allow_incoherent_impl = - `rustc_allow_incoherent_impl` attribute should be applied to impl items. + `rustc_allow_incoherent_impl` attribute should be applied to impl items .label = the only currently supported targets are inherent methods passes_allow_internal_unstable = @@ -253,8 +253,8 @@ passes_doc_test_unknown_spotlight = .no_op_note = `doc(spotlight)` is now a no-op passes_duplicate_diagnostic_item_in_crate = - duplicate diagnostic item in crate `{$crate_name}`: `{$name}`. - .note = the diagnostic item is first defined in crate `{$orig_crate_name}`. + duplicate diagnostic item in crate `{$crate_name}`: `{$name}` + .note = the diagnostic item is first defined in crate `{$orig_crate_name}` passes_duplicate_feature_err = the feature `{$feature}` has already been declared @@ -263,27 +263,27 @@ passes_duplicate_lang_item = found duplicate lang item `{$lang_item_name}` .first_defined_span = the lang item is first defined here .first_defined_crate_depends = the lang item is first defined in crate `{$orig_crate_name}` (which `{$orig_dependency_of}` depends on) - .first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}`. + .first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}` .first_definition_local = first definition in the local crate (`{$orig_crate_name}`) .second_definition_local = second definition in the local crate (`{$crate_name}`) .first_definition_path = first definition in `{$orig_crate_name}` loaded from {$orig_path} .second_definition_path = second definition in `{$crate_name}` loaded from {$path} passes_duplicate_lang_item_crate = - duplicate lang item in crate `{$crate_name}`: `{$lang_item_name}`. + duplicate lang item in crate `{$crate_name}`: `{$lang_item_name}` .first_defined_span = the lang item is first defined here .first_defined_crate_depends = the lang item is first defined in crate `{$orig_crate_name}` (which `{$orig_dependency_of}` depends on) - .first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}`. + .first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}` .first_definition_local = first definition in the local crate (`{$orig_crate_name}`) .second_definition_local = second definition in the local crate (`{$crate_name}`) .first_definition_path = first definition in `{$orig_crate_name}` loaded from {$orig_path} .second_definition_path = second definition in `{$crate_name}` loaded from {$path} passes_duplicate_lang_item_crate_depends = - duplicate lang item in crate `{$crate_name}` (which `{$dependency_of}` depends on): `{$lang_item_name}`. + duplicate lang item in crate `{$crate_name}` (which `{$dependency_of}` depends on): `{$lang_item_name}` .first_defined_span = the lang item is first defined here .first_defined_crate_depends = the lang item is first defined in crate `{$orig_crate_name}` (which `{$orig_dependency_of}` depends on) - .first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}`. + .first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}` .first_definition_local = first definition in the local crate (`{$orig_crate_name}`) .second_definition_local = second definition in the local crate (`{$crate_name}`) .first_definition_path = first definition in `{$orig_crate_name}` loaded from {$orig_path} @@ -315,7 +315,7 @@ passes_ffi_pure_invalid_target = `#[ffi_pure]` may only be used on foreign functions passes_has_incoherent_inherent_impl = - `rustc_has_incoherent_inherent_impls` attribute should be applied to types or traits. + `rustc_has_incoherent_inherent_impls` attribute should be applied to types or traits .label = only adts, extern types and traits are supported passes_ignored_attr = diff --git a/compiler/rustc_resolve/messages.ftl b/compiler/rustc_resolve/messages.ftl index 358f25e233434..4b9c36ad39fb5 100644 --- a/compiler/rustc_resolve/messages.ftl +++ b/compiler/rustc_resolve/messages.ftl @@ -240,7 +240,7 @@ resolve_label_with_similar_name_reachable = resolve_lending_iterator_report_error = associated type `Iterator::Item` is declared without lifetime parameters, so using a borrowed type for them requires that lifetime to come from the implemented type - .note = you can't create an `Iterator` that borrows each `Item` from itself, but you can instead create a new type that borrows your existing type and implement `Iterator` for that new type. + .note = you can't create an `Iterator` that borrows each `Item` from itself, but you can instead create a new type that borrows your existing type and implement `Iterator` for that new type resolve_lifetime_param_in_enum_discriminant = lifetime parameters may not be used in enum discriminant values diff --git a/compiler/rustc_session/messages.ftl b/compiler/rustc_session/messages.ftl index b8dacc6968d30..b84280a3ccf3f 100644 --- a/compiler/rustc_session/messages.ftl +++ b/compiler/rustc_session/messages.ftl @@ -82,9 +82,9 @@ session_octal_float_literal_not_supported = octal float literal is not supported session_optimization_fuel_exhausted = optimization-fuel-exhausted: {$msg} -session_profile_sample_use_file_does_not_exist = file `{$path}` passed to `-C profile-sample-use` does not exist. +session_profile_sample_use_file_does_not_exist = file `{$path}` passed to `-C profile-sample-use` does not exist -session_profile_use_file_does_not_exist = file `{$path}` passed to `-C profile-use` does not exist. +session_profile_use_file_does_not_exist = file `{$path}` passed to `-C profile-use` does not exist session_sanitizer_cfi_canonical_jump_tables_requires_cfi = `-Zsanitizer-cfi-canonical-jump-tables` requires `-Zsanitizer=cfi` diff --git a/tests/ui/abi/abi-typo-unstable.stderr b/tests/ui/abi/abi-typo-unstable.stderr index d31cc2a896f72..9ba67ad7dbe4a 100644 --- a/tests/ui/abi/abi-typo-unstable.stderr +++ b/tests/ui/abi/abi-typo-unstable.stderr @@ -4,7 +4,7 @@ error[E0703]: invalid ABI: found `rust-intrinsec` LL | extern "rust-intrinsec" fn rust_intrinsic() {} | ^^^^^^^^^^^^^^^^ invalid ABI | - = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions. + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions error: aborting due to 1 previous error diff --git a/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr b/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr index 02082c13f91a7..e80411fda344e 100644 --- a/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr +++ b/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr @@ -7,7 +7,7 @@ LL | extern "riscv-interrupt" fn isr() {} | invalid ABI | help: did you mean: `"riscv-interrupt-m"` | - = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions. + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions = note: please use one of riscv-interrupt-m or riscv-interrupt-s for machine- or supervisor-level interrupts, respectively error[E0703]: invalid ABI: found `riscv-interrupt-u` @@ -19,7 +19,7 @@ LL | extern "riscv-interrupt-u" fn isr_U() {} | invalid ABI | help: did you mean: `"riscv-interrupt-m"` | - = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions. + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions = note: user-mode interrupt handlers have been removed from LLVM pending standardization, see: https://reviews.llvm.org/D149314 error: aborting due to 2 previous errors diff --git a/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr b/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr index 02082c13f91a7..e80411fda344e 100644 --- a/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr +++ b/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr @@ -7,7 +7,7 @@ LL | extern "riscv-interrupt" fn isr() {} | invalid ABI | help: did you mean: `"riscv-interrupt-m"` | - = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions. + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions = note: please use one of riscv-interrupt-m or riscv-interrupt-s for machine- or supervisor-level interrupts, respectively error[E0703]: invalid ABI: found `riscv-interrupt-u` @@ -19,7 +19,7 @@ LL | extern "riscv-interrupt-u" fn isr_U() {} | invalid ABI | help: did you mean: `"riscv-interrupt-m"` | - = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions. + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions = note: user-mode interrupt handlers have been removed from LLVM pending standardization, see: https://reviews.llvm.org/D149314 error: aborting due to 2 previous errors diff --git a/tests/ui/codemap_tests/unicode.normal.stderr b/tests/ui/codemap_tests/unicode.normal.stderr index a6e22e1c38f9c..0f254e0246f41 100644 --- a/tests/ui/codemap_tests/unicode.normal.stderr +++ b/tests/ui/codemap_tests/unicode.normal.stderr @@ -4,7 +4,7 @@ error[E0703]: invalid ABI: found `路濫狼á́́` LL | extern "路濫狼á́́" fn foo() {} | ^^^^^^^^^ invalid ABI | - = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions. + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0116.stderr b/tests/ui/error-codes/E0116.stderr index bf215435ba6a0..1ea5a57f46db1 100644 --- a/tests/ui/error-codes/E0116.stderr +++ b/tests/ui/error-codes/E0116.stderr @@ -2,7 +2,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher --> $DIR/E0116.rs:1:1 | LL | impl Vec {} - | ^^^^^^^^^^^^ impl for type defined outside of crate. + | ^^^^^^^^^^^^ impl for type defined outside of crate | = note: define and implement a trait or new type instead diff --git a/tests/ui/error-codes/E0519.stderr b/tests/ui/error-codes/E0519.stderr index 4fbd268134f20..a814277cafae2 100644 --- a/tests/ui/error-codes/E0519.stderr +++ b/tests/ui/error-codes/E0519.stderr @@ -1,4 +1,4 @@ -error[E0519]: the current crate is indistinguishable from one of its dependencies: it has the same crate-name `crateresolve1` and was compiled with the same `-C metadata` arguments. This will result in symbol conflicts between the two. +error[E0519]: the current crate is indistinguishable from one of its dependencies: it has the same crate-name `crateresolve1` and was compiled with the same `-C metadata` arguments, so this will result in symbol conflicts between the two --> $DIR/E0519.rs:8:1 | LL | extern crate crateresolve1; diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr index 30039267979fb..88732f75cb4e1 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr @@ -186,7 +186,7 @@ warning: unknown lint: `x5100` LL | #[deny(x5100)] impl S { } | ^^^^^ -warning: use of deprecated attribute `crate_id`: no longer used. +warning: use of deprecated attribute `crate_id`: no longer used --> $DIR/issue-43106-gating-of-builtin-attrs.rs:84:1 | LL | #![crate_id = "10"] @@ -194,7 +194,7 @@ LL | #![crate_id = "10"] | = note: `#[warn(deprecated)]` on by default -warning: use of deprecated attribute `no_start`: no longer used. +warning: use of deprecated attribute `no_start`: no longer used --> $DIR/issue-43106-gating-of-builtin-attrs.rs:94:1 | LL | #![no_start] diff --git a/tests/ui/incoherent-inherent-impls/no-attr-empty-impl.stderr b/tests/ui/incoherent-inherent-impls/no-attr-empty-impl.stderr index 6dc1680cf89f8..f8491697910c0 100644 --- a/tests/ui/incoherent-inherent-impls/no-attr-empty-impl.stderr +++ b/tests/ui/incoherent-inherent-impls/no-attr-empty-impl.stderr @@ -2,7 +2,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher --> $DIR/no-attr-empty-impl.rs:4:1 | LL | impl extern_crate::StructWithAttr {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate | = note: define and implement a trait or new type instead @@ -10,7 +10,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher --> $DIR/no-attr-empty-impl.rs:7:1 | LL | impl extern_crate::StructNoAttr {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate | = note: define and implement a trait or new type instead @@ -18,7 +18,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher --> $DIR/no-attr-empty-impl.rs:10:1 | LL | impl extern_crate::EnumWithAttr {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate | = note: define and implement a trait or new type instead @@ -26,7 +26,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher --> $DIR/no-attr-empty-impl.rs:13:1 | LL | impl extern_crate::EnumNoAttr {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate | = note: define and implement a trait or new type instead diff --git a/tests/ui/instrument-coverage/mcdc-condition-limit.bad.stderr b/tests/ui/instrument-coverage/mcdc-condition-limit.bad.stderr index 5df6aaf980414..15fa3f6ee115f 100644 --- a/tests/ui/instrument-coverage/mcdc-condition-limit.bad.stderr +++ b/tests/ui/instrument-coverage/mcdc-condition-limit.bad.stderr @@ -1,4 +1,4 @@ -warning: Number of conditions in decision (7) exceeds limit (6). MC/DC analysis will not count this expression. +warning: number of conditions in decision (7) exceeds limit (6), so MC/DC analysis will not count this expression --> $DIR/mcdc-condition-limit.rs:29:8 | LL | if a && b && c && d && e && f && g { diff --git a/tests/ui/instrument-coverage/mcdc-condition-limit.rs b/tests/ui/instrument-coverage/mcdc-condition-limit.rs index de3770b5709d0..eb19ddec78fd5 100644 --- a/tests/ui/instrument-coverage/mcdc-condition-limit.rs +++ b/tests/ui/instrument-coverage/mcdc-condition-limit.rs @@ -26,7 +26,7 @@ fn main() { fn main() { // 7 conditions is too many, so issue a diagnostic. let [a, b, c, d, e, f, g] = <[bool; 7]>::default(); - if a && b && c && d && e && f && g { //[bad]~ WARNING Number of conditions in decision + if a && b && c && d && e && f && g { //[bad]~ WARNING number of conditions in decision core::hint::black_box("hello"); } } diff --git a/tests/ui/lifetimes/no_lending_iterators.stderr b/tests/ui/lifetimes/no_lending_iterators.stderr index c3784770d7926..9ceaef2f9b1aa 100644 --- a/tests/ui/lifetimes/no_lending_iterators.stderr +++ b/tests/ui/lifetimes/no_lending_iterators.stderr @@ -4,7 +4,7 @@ error: associated type `Iterator::Item` is declared without lifetime parameters, LL | type Item = &str; | ^ | -note: you can't create an `Iterator` that borrows each `Item` from itself, but you can instead create a new type that borrows your existing type and implement `Iterator` for that new type. +note: you can't create an `Iterator` that borrows each `Item` from itself, but you can instead create a new type that borrows your existing type and implement `Iterator` for that new type --> $DIR/no_lending_iterators.rs:3:19 | LL | impl Iterator for Data { diff --git a/tests/ui/lint/lint-attr-everywhere-late.stderr b/tests/ui/lint/lint-attr-everywhere-late.stderr index 7fe078068feef..ddc31905afbcf 100644 --- a/tests/ui/lint/lint-attr-everywhere-late.stderr +++ b/tests/ui/lint/lint-attr-everywhere-late.stderr @@ -154,7 +154,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | fn assoc_fn() { discriminant::(&123); } | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum --> $DIR/lint-attr-everywhere-late.rs:96:41 | LL | fn assoc_fn() { discriminant::(&123); } @@ -208,7 +208,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | let _ = discriminant::(&123); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum --> $DIR/lint-attr-everywhere-late.rs:139:33 | LL | let _ = discriminant::(&123); @@ -237,7 +237,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | discriminant::(&123); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum --> $DIR/lint-attr-everywhere-late.rs:155:33 | LL | discriminant::(&123); @@ -254,7 +254,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | discriminant::(&123); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum --> $DIR/lint-attr-everywhere-late.rs:161:33 | LL | discriminant::(&123); @@ -283,7 +283,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | discriminant::(&123); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum --> $DIR/lint-attr-everywhere-late.rs:173:29 | LL | discriminant::(&123); @@ -300,7 +300,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | discriminant::(&123); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum --> $DIR/lint-attr-everywhere-late.rs:177:29 | LL | discriminant::(&123); @@ -317,7 +317,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | discriminant::(&123); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum --> $DIR/lint-attr-everywhere-late.rs:182:25 | LL | discriminant::(&123); @@ -334,7 +334,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | [#[deny(enum_intrinsics_non_enums)] discriminant::(&123)]; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum --> $DIR/lint-attr-everywhere-late.rs:184:61 | LL | [#[deny(enum_intrinsics_non_enums)] discriminant::(&123)]; @@ -351,7 +351,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | (#[deny(enum_intrinsics_non_enums)] discriminant::(&123),); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum --> $DIR/lint-attr-everywhere-late.rs:185:61 | LL | (#[deny(enum_intrinsics_non_enums)] discriminant::(&123),); @@ -368,7 +368,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | call(#[deny(enum_intrinsics_non_enums)] discriminant::(&123)); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum --> $DIR/lint-attr-everywhere-late.rs:187:65 | LL | call(#[deny(enum_intrinsics_non_enums)] discriminant::(&123)); @@ -385,7 +385,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | TupleStruct(#[deny(enum_intrinsics_non_enums)] discriminant::(&123)); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum --> $DIR/lint-attr-everywhere-late.rs:189:72 | LL | TupleStruct(#[deny(enum_intrinsics_non_enums)] discriminant::(&123)); diff --git a/tests/ui/lint/lint-enum-intrinsics-non-enums.stderr b/tests/ui/lint/lint-enum-intrinsics-non-enums.stderr index 63ed2503cf39f..f9eeaebe21f43 100644 --- a/tests/ui/lint/lint-enum-intrinsics-non-enums.stderr +++ b/tests/ui/lint/lint-enum-intrinsics-non-enums.stderr @@ -4,7 +4,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | discriminant(&()); | ^^^^^^^^^^^^^^^^^ | -note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `()`, which is not an enum. +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `()`, which is not an enum --> $DIR/lint-enum-intrinsics-non-enums.rs:26:18 | LL | discriminant(&()); @@ -17,7 +17,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | discriminant(&&SomeEnum::B); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `&SomeEnum`, which is not an enum. +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `&SomeEnum`, which is not an enum --> $DIR/lint-enum-intrinsics-non-enums.rs:29:18 | LL | discriminant(&&SomeEnum::B); @@ -29,7 +29,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | discriminant(&SomeStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `SomeStruct`, which is not an enum. +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `SomeStruct`, which is not an enum --> $DIR/lint-enum-intrinsics-non-enums.rs:32:18 | LL | discriminant(&SomeStruct); @@ -41,7 +41,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | discriminant(&123u32); | ^^^^^^^^^^^^^^^^^^^^^ | -note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `u32`, which is not an enum. +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `u32`, which is not an enum --> $DIR/lint-enum-intrinsics-non-enums.rs:35:18 | LL | discriminant(&123u32); @@ -53,7 +53,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | discriminant(&&123i8); | ^^^^^^^^^^^^^^^^^^^^^ | -note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `&i8`, which is not an enum. +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `&i8`, which is not an enum --> $DIR/lint-enum-intrinsics-non-enums.rs:38:18 | LL | discriminant(&&123i8); @@ -65,7 +65,7 @@ error: the return value of `mem::variant_count` is unspecified when called with LL | variant_count::<&str>(); | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `&str`, which is not an enum. + = note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `&str`, which is not an enum error: the return value of `mem::variant_count` is unspecified when called with a non-enum type --> $DIR/lint-enum-intrinsics-non-enums.rs:49:5 @@ -73,7 +73,7 @@ error: the return value of `mem::variant_count` is unspecified when called with LL | variant_count::<*const u8>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `*const u8`, which is not an enum. + = note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `*const u8`, which is not an enum error: the return value of `mem::variant_count` is unspecified when called with a non-enum type --> $DIR/lint-enum-intrinsics-non-enums.rs:52:5 @@ -81,7 +81,7 @@ error: the return value of `mem::variant_count` is unspecified when called with LL | variant_count::<()>(); | ^^^^^^^^^^^^^^^^^^^^^ | - = note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `()`, which is not an enum. + = note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `()`, which is not an enum error: the return value of `mem::variant_count` is unspecified when called with a non-enum type --> $DIR/lint-enum-intrinsics-non-enums.rs:55:5 @@ -89,7 +89,7 @@ error: the return value of `mem::variant_count` is unspecified when called with LL | variant_count::<&SomeEnum>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `&SomeEnum`, which is not an enum. + = note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `&SomeEnum`, which is not an enum error: aborting due to 9 previous errors diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr b/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr index f2bc8bd8400ce..7cd6175a5ad6a 100644 --- a/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr +++ b/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr @@ -4,7 +4,7 @@ warning: unnecessary associated type bound for not object safe associated type LL | fn foo(_: &dyn Foo) {} | ^^^^^^^^ help: remove this bound | - = note: this associated type has a `where Self: Sized` bound. Thus, while the associated type can be specified, it cannot be used in any way, because trait objects are not `Sized`. + = note: this associated type has a `where Self: Sized` bound, and while the associated type can be specified, it cannot be used because trait objects are never `Sized` = note: `#[warn(unused_associated_type_bounds)]` on by default warning: 1 warning emitted diff --git a/tests/ui/parser/issues/issue-8537.stderr b/tests/ui/parser/issues/issue-8537.stderr index 0d636bd28a50b..b685464d8d4fb 100644 --- a/tests/ui/parser/issues/issue-8537.stderr +++ b/tests/ui/parser/issues/issue-8537.stderr @@ -4,7 +4,7 @@ error[E0703]: invalid ABI: found `invalid-ab_isize` LL | "invalid-ab_isize" | ^^^^^^^^^^^^^^^^^^ invalid ABI | - = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions. + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/abi-typo.stderr b/tests/ui/suggestions/abi-typo.stderr index ea474e3212532..5195c43220b41 100644 --- a/tests/ui/suggestions/abi-typo.stderr +++ b/tests/ui/suggestions/abi-typo.stderr @@ -7,7 +7,7 @@ LL | extern "cdedl" fn cdedl() {} | invalid ABI | help: did you mean: `"cdecl"` | - = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions. + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions error: aborting due to 1 previous error diff --git a/tests/ui/tool-attributes/duplicate-diagnostic.stderr b/tests/ui/tool-attributes/duplicate-diagnostic.stderr index 26bd6a82e3417..3cd438004c8e2 100644 --- a/tests/ui/tool-attributes/duplicate-diagnostic.stderr +++ b/tests/ui/tool-attributes/duplicate-diagnostic.stderr @@ -1,14 +1,14 @@ -error: duplicate diagnostic item in crate `p2`: `Foo`. +error: duplicate diagnostic item in crate `p2`: `Foo` | - = note: the diagnostic item is first defined in crate `p1`. + = note: the diagnostic item is first defined in crate `p1` -error: duplicate diagnostic item in crate `duplicate_diagnostic`: `Foo`. +error: duplicate diagnostic item in crate `duplicate_diagnostic`: `Foo` --> $DIR/duplicate-diagnostic.rs:12:1 | LL | pub struct Foo {} | ^^^^^^^^^^^^^^ | - = note: the diagnostic item is first defined in crate `p2`. + = note: the diagnostic item is first defined in crate `p2` error: aborting due to 2 previous errors diff --git a/tests/ui/traits/trait-or-new-type-instead.stderr b/tests/ui/traits/trait-or-new-type-instead.stderr index 17ee939887864..5f5aa3ac56982 100644 --- a/tests/ui/traits/trait-or-new-type-instead.stderr +++ b/tests/ui/traits/trait-or-new-type-instead.stderr @@ -2,7 +2,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher --> $DIR/trait-or-new-type-instead.rs:1:1 | LL | impl Option { - | ^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. + | ^^^^^^^^^^^^^^^^^ impl for type defined outside of crate | = note: define and implement a trait or new type instead