authorbors <bors@rust-lang.org> 2024-06-22 05:51:57 UTC
committerbors <bors@rust-lang.org> 2024-06-22 05:51:57 UTC
logf0aceed540be1d2c761c7beedf09d243f3377298
tree64b3d7f75d32bd10332c31c5e3845ef14c5c1c20
parent10e1f5d2121831991a1bebb8cda044a1677aaddf
parent1916b3d57fce92a42c6acf85b1d9cbf59f16978a

Auto merge of #126817 - workingjubilee:rollup-0rg0k55, r=workingjubilee

Rollup of 7 pull requests Successful merges: - #126530 (Add `f16` inline ASM support for RISC-V) - #126712 (Migrate `relocation-model`, `error-writing-dependencies` and `crate-name-priority` `run-make` tests to rmake) - #126722 (Add method to get `FnAbi` of function pointer) - #126787 (Add direct accessors for memory addresses in `Machine` (for Miri)) - #126798 ([fuchsia-test-runner] Remove usage of kw_only) - #126809 (Remove stray `.` from error message) - #126811 (Add a tidy rule to check that fluent messages and attrs don't end in `.`) r? `@ghost` `@rustbot` modify labels: rollup

51 files changed, 412 insertions(+), 128 deletions(-)

Cargo.lock+1
......@@ -5700,6 +5700,7 @@ name = "tidy"
57005700version = "0.1.0"
57015701dependencies = [
57025702 "cargo_metadata 0.15.4",
5703 "fluent-syntax",
57035704 "ignore",
57045705 "miropt-test-tools",
57055706 "regex",
compiler/rustc_ast_lowering/messages.ftl+1-1
......@@ -78,7 +78,7 @@ ast_lowering_inline_asm_unsupported_target =
7878ast_lowering_invalid_abi =
7979 invalid ABI: found `{$abi}`
8080 .label = invalid ABI
81 .note = invoke `{$command}` for a full list of supported calling conventions.
81 .note = invoke `{$command}` for a full list of supported calling conventions
8282
8383ast_lowering_invalid_abi_clobber_abi =
8484 invalid ABI for `clobber_abi`
compiler/rustc_codegen_llvm/src/asm.rs+49-6
......@@ -13,7 +13,7 @@ use rustc_codegen_ssa::traits::*;
1313use rustc_data_structures::fx::FxHashMap;
1414use rustc_middle::ty::layout::TyAndLayout;
1515use rustc_middle::{bug, span_bug, ty::Instance};
16use rustc_span::{Pos, Span};
16use rustc_span::{sym, Pos, Span, Symbol};
1717use rustc_target::abi::*;
1818use rustc_target::asm::*;
1919use tracing::debug;
......@@ -64,7 +64,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
6464 let mut layout = None;
6565 let ty = if let Some(ref place) = place {
6666 layout = Some(&place.layout);
67 llvm_fixup_output_type(self.cx, reg.reg_class(), &place.layout)
67 llvm_fixup_output_type(self.cx, reg.reg_class(), &place.layout, instance)
6868 } else if matches!(
6969 reg.reg_class(),
7070 InlineAsmRegClass::X86(
......@@ -112,7 +112,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
112112 // so we just use the type of the input.
113113 &in_value.layout
114114 };
115 let ty = llvm_fixup_output_type(self.cx, reg.reg_class(), layout);
115 let ty = llvm_fixup_output_type(self.cx, reg.reg_class(), layout, instance);
116116 output_types.push(ty);
117117 op_idx.insert(idx, constraints.len());
118118 let prefix = if late { "=" } else { "=&" };
......@@ -127,8 +127,13 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
127127 for (idx, op) in operands.iter().enumerate() {
128128 match *op {
129129 InlineAsmOperandRef::In { reg, value } => {
130 let llval =
131 llvm_fixup_input(self, value.immediate(), reg.reg_class(), &value.layout);
130 let llval = llvm_fixup_input(
131 self,
132 value.immediate(),
133 reg.reg_class(),
134 &value.layout,
135 instance,
136 );
132137 inputs.push(llval);
133138 op_idx.insert(idx, constraints.len());
134139 constraints.push(reg_to_llvm(reg, Some(&value.layout)));
......@@ -139,6 +144,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
139144 in_value.immediate(),
140145 reg.reg_class(),
141146 &in_value.layout,
147 instance,
142148 );
143149 inputs.push(value);
144150
......@@ -341,7 +347,8 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
341347 } else {
342348 self.extract_value(result, op_idx[&idx] as u64)
343349 };
344 let value = llvm_fixup_output(self, value, reg.reg_class(), &place.layout);
350 let value =
351 llvm_fixup_output(self, value, reg.reg_class(), &place.layout, instance);
345352 OperandValue::Immediate(value).store(self, place);
346353 }
347354 }
......@@ -913,12 +920,22 @@ fn llvm_asm_scalar_type<'ll>(cx: &CodegenCx<'ll, '_>, scalar: Scalar) -> &'ll Ty
913920 }
914921}
915922
923fn any_target_feature_enabled(
924 cx: &CodegenCx<'_, '_>,
925 instance: Instance<'_>,
926 features: &[Symbol],
927) -> bool {
928 let enabled = cx.tcx.asm_target_features(instance.def_id());
929 features.iter().any(|feat| enabled.contains(feat))
930}
931
916932/// Fix up an input value to work around LLVM bugs.
917933fn llvm_fixup_input<'ll, 'tcx>(
918934 bx: &mut Builder<'_, 'll, 'tcx>,
919935 mut value: &'ll Value,
920936 reg: InlineAsmRegClass,
921937 layout: &TyAndLayout<'tcx>,
938 instance: Instance<'_>,
922939) -> &'ll Value {
923940 let dl = &bx.tcx.data_layout;
924941 match (reg, layout.abi) {
......@@ -1029,6 +1046,16 @@ fn llvm_fixup_input<'ll, 'tcx>(
10291046 _ => value,
10301047 }
10311048 }
1049 (InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::freg), Abi::Scalar(s))
1050 if s.primitive() == Primitive::Float(Float::F16)
1051 && !any_target_feature_enabled(bx, instance, &[sym::zfhmin, sym::zfh]) =>
1052 {
1053 // Smaller floats are always "NaN-boxed" inside larger floats on RISC-V.
1054 let value = bx.bitcast(value, bx.type_i16());
1055 let value = bx.zext(value, bx.type_i32());
1056 let value = bx.or(value, bx.const_u32(0xFFFF_0000));
1057 bx.bitcast(value, bx.type_f32())
1058 }
10321059 _ => value,
10331060 }
10341061}
......@@ -1039,6 +1066,7 @@ fn llvm_fixup_output<'ll, 'tcx>(
10391066 mut value: &'ll Value,
10401067 reg: InlineAsmRegClass,
10411068 layout: &TyAndLayout<'tcx>,
1069 instance: Instance<'_>,
10421070) -> &'ll Value {
10431071 match (reg, layout.abi) {
10441072 (InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg), Abi::Scalar(s)) => {
......@@ -1140,6 +1168,14 @@ fn llvm_fixup_output<'ll, 'tcx>(
11401168 _ => value,
11411169 }
11421170 }
1171 (InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::freg), Abi::Scalar(s))
1172 if s.primitive() == Primitive::Float(Float::F16)
1173 && !any_target_feature_enabled(bx, instance, &[sym::zfhmin, sym::zfh]) =>
1174 {
1175 let value = bx.bitcast(value, bx.type_i32());
1176 let value = bx.trunc(value, bx.type_i16());
1177 bx.bitcast(value, bx.type_f16())
1178 }
11431179 _ => value,
11441180 }
11451181}
......@@ -1149,6 +1185,7 @@ fn llvm_fixup_output_type<'ll, 'tcx>(
11491185 cx: &CodegenCx<'ll, 'tcx>,
11501186 reg: InlineAsmRegClass,
11511187 layout: &TyAndLayout<'tcx>,
1188 instance: Instance<'_>,
11521189) -> &'ll Type {
11531190 match (reg, layout.abi) {
11541191 (InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg), Abi::Scalar(s)) => {
......@@ -1242,6 +1279,12 @@ fn llvm_fixup_output_type<'ll, 'tcx>(
12421279 _ => layout.llvm_type(cx),
12431280 }
12441281 }
1282 (InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::freg), Abi::Scalar(s))
1283 if s.primitive() == Primitive::Float(Float::F16)
1284 && !any_target_feature_enabled(cx, instance, &[sym::zfhmin, sym::zfh]) =>
1285 {
1286 cx.type_f32()
1287 }
12451288 _ => layout.llvm_type(cx),
12461289 }
12471290}
compiler/rustc_const_eval/messages.ftl+1-2
......@@ -341,8 +341,7 @@ const_eval_unallowed_fn_pointer_call = function pointer calls are not allowed in
341341const_eval_unallowed_heap_allocations =
342342 allocations are not allowed in {const_eval_const_context}s
343343 .label = allocation not allowed in {const_eval_const_context}s
344 .teach_note =
345 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.
344 .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.
346345
347346const_eval_unallowed_inline_asm =
348347 inline assembly is not allowed in {const_eval_const_context}s
compiler/rustc_const_eval/src/interpret/memory.rs+17
......@@ -630,6 +630,13 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
630630 }
631631 }
632632
633 /// Gives raw, immutable access to the `Allocation` address, without bounds or alignment checks.
634 /// The caller is responsible for calling the access hooks!
635 pub fn get_alloc_bytes_unchecked_raw(&self, id: AllocId) -> InterpResult<'tcx, *const u8> {
636 let alloc = self.get_alloc_raw(id)?;
637 Ok(alloc.get_bytes_unchecked_raw())
638 }
639
633640 /// Bounds-checked *but not align-checked* allocation access.
634641 pub fn get_ptr_alloc<'a>(
635642 &'a self,
......@@ -713,6 +720,16 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
713720 Ok((alloc, &mut self.machine))
714721 }
715722
723 /// Gives raw, mutable access to the `Allocation` address, without bounds or alignment checks.
724 /// The caller is responsible for calling the access hooks!
725 pub fn get_alloc_bytes_unchecked_raw_mut(
726 &mut self,
727 id: AllocId,
728 ) -> InterpResult<'tcx, *mut u8> {
729 let alloc = self.get_alloc_raw_mut(id)?.0;
730 Ok(alloc.get_bytes_unchecked_raw_mut())
731 }
732
716733 /// Bounds-checked *but not align-checked* allocation access.
717734 pub fn get_ptr_alloc_mut<'a>(
718735 &'a mut self,
compiler/rustc_hir_analysis/messages.ftl+2-2
......@@ -194,7 +194,7 @@ hir_analysis_inherent_ty_outside = cannot define inherent `impl` for a type outs
194194 .span_help = alternatively add `#[rustc_has_incoherent_inherent_impls]` to the type and `#[rustc_allow_incoherent_impl]` to the relevant impl items
195195
196196hir_analysis_inherent_ty_outside_new = cannot define inherent `impl` for a type outside of the crate where the type is defined
197 .label = impl for type defined outside of crate.
197 .label = impl for type defined outside of crate
198198 .note = define and implement a trait or new type instead
199199
200200hir_analysis_inherent_ty_outside_primitive = cannot define inherent `impl` for primitive types outside of `core`
......@@ -544,7 +544,7 @@ hir_analysis_unrecognized_intrinsic_function =
544544
545545hir_analysis_unused_associated_type_bounds =
546546 unnecessary associated type bound for not object safe associated type
547 .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`.
547 .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`
548548 .suggestion = remove this bound
549549
550550hir_analysis_unused_generic_parameter =
compiler/rustc_lint/messages.ftl+4-4
......@@ -75,7 +75,7 @@ lint_builtin_deprecated_attr_default_suggestion = remove this attribute
7575lint_builtin_deprecated_attr_link = use of deprecated attribute `{$name}`: {$reason}. See {$link}
7676 .msg_suggestion = {$msg}
7777 .default_suggestion = remove this attribute
78lint_builtin_deprecated_attr_used = use of deprecated attribute `{$name}`: no longer used.
78lint_builtin_deprecated_attr_used = use of deprecated attribute `{$name}`: no longer used
7979lint_builtin_deref_nullptr = dereferencing a null pointer
8080 .label = this code causes undefined behavior when executed
8181
......@@ -213,7 +213,7 @@ lint_default_hash_types = prefer `{$preferred}` over `{$used}`, it has better pe
213213lint_default_source = `forbid` lint level is the default for {$id}
214214
215215lint_deprecated_lint_name =
216 lint name `{$name}` is deprecated and may not have an effect in the future.
216 lint name `{$name}` is deprecated and may not have an effect in the future
217217 .suggestion = change it to
218218 .help = change it to {$replace}
219219
......@@ -244,11 +244,11 @@ lint_duplicate_matcher_binding = duplicate matcher binding
244244
245245lint_enum_intrinsics_mem_discriminant =
246246 the return value of `mem::discriminant` is unspecified when called with a non-enum type
247 .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.
247 .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
248248
249249lint_enum_intrinsics_mem_variant =
250250 the return value of `mem::variant_count` is unspecified when called with a non-enum type
251 .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.
251 .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
252252
253253lint_expectation = this lint expectation is unfulfilled
254254 .note = the `unfulfilled_lint_expectations` lint can't be expected and will always produce this message
compiler/rustc_metadata/messages.ftl+2-2
......@@ -248,13 +248,13 @@ metadata_rustc_lib_required =
248248 .help = try adding `extern crate rustc_driver;` at the top level of this crate
249249
250250metadata_stable_crate_id_collision =
251 found crates (`{$crate_name0}` and `{$crate_name1}`) with colliding StableCrateId values.
251 found crates (`{$crate_name0}` and `{$crate_name1}`) with colliding StableCrateId values
252252
253253metadata_std_required =
254254 `std` is required by `{$current_crate}` because it does not declare `#![no_std]`
255255
256256metadata_symbol_conflicts_current =
257 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.
257 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
258258
259259metadata_target_no_std_support =
260260 the `{$locator_triple}` target may not support the standard library
compiler/rustc_middle/src/mir/interpret/allocation.rs+23-3
......@@ -40,9 +40,16 @@ pub trait AllocBytes: Clone + fmt::Debug + Deref<Target = [u8]> + DerefMut<Targe
4040 /// Gives direct access to the raw underlying storage.
4141 ///
4242 /// Crucially this pointer is compatible with:
43 /// - other pointers retunred by this method, and
43 /// - other pointers returned by this method, and
4444 /// - references returned from `deref()`, as long as there was no write.
4545 fn as_mut_ptr(&mut self) -> *mut u8;
46
47 /// Gives direct access to the raw underlying storage.
48 ///
49 /// Crucially this pointer is compatible with:
50 /// - other pointers returned by this method, and
51 /// - references returned from `deref()`, as long as there was no write.
52 fn as_ptr(&self) -> *const u8;
4653}
4754
4855/// Default `bytes` for `Allocation` is a `Box<u8>`.
......@@ -62,6 +69,11 @@ impl AllocBytes for Box<[u8]> {
6269 // Carefully avoiding any intermediate references.
6370 ptr::addr_of_mut!(**self).cast()
6471 }
72
73 fn as_ptr(&self) -> *const u8 {
74 // Carefully avoiding any intermediate references.
75 ptr::addr_of!(**self).cast()
76 }
6577}
6678
6779/// This type represents an Allocation in the Miri/CTFE core engine.
......@@ -490,19 +502,27 @@ impl<Prov: Provenance, Extra, Bytes: AllocBytes> Allocation<Prov, Extra, Bytes>
490502 self.provenance.clear(range, cx)?;
491503
492504 assert!(range.end().bytes_usize() <= self.bytes.len()); // need to do our own bounds-check
493 // Cruciall, we go via `AllocBytes::as_mut_ptr`, not `AllocBytes::deref_mut`.
505 // Crucially, we go via `AllocBytes::as_mut_ptr`, not `AllocBytes::deref_mut`.
494506 let begin_ptr = self.bytes.as_mut_ptr().wrapping_add(range.start.bytes_usize());
495507 let len = range.end().bytes_usize() - range.start.bytes_usize();
496508 Ok(ptr::slice_from_raw_parts_mut(begin_ptr, len))
497509 }
498510
499511 /// This gives direct mutable access to the entire buffer, just exposing their internal state
500 /// without reseting anything. Directly exposes `AllocBytes::as_mut_ptr`. Only works if
512 /// without resetting anything. Directly exposes `AllocBytes::as_mut_ptr`. Only works if
501513 /// `OFFSET_IS_ADDR` is true.
502514 pub fn get_bytes_unchecked_raw_mut(&mut self) -> *mut u8 {
503515 assert!(Prov::OFFSET_IS_ADDR);
504516 self.bytes.as_mut_ptr()
505517 }
518
519 /// This gives direct immutable access to the entire buffer, just exposing their internal state
520 /// without resetting anything. Directly exposes `AllocBytes::as_ptr`. Only works if
521 /// `OFFSET_IS_ADDR` is true.
522 pub fn get_bytes_unchecked_raw(&self) -> *const u8 {
523 assert!(Prov::OFFSET_IS_ADDR);
524 self.bytes.as_ptr()
525 }
506526}
507527
508528/// Reading and writing.
compiler/rustc_mir_build/messages.ftl+1-1
......@@ -103,7 +103,7 @@ mir_build_deref_raw_pointer_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
103103 .note = raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
104104 .label = dereference of raw pointer
105105
106mir_build_exceeds_mcdc_condition_limit = Number of conditions in decision ({$num_conditions}) exceeds limit ({$max_conditions}). MC/DC analysis will not count this expression.
106mir_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
107107
108108mir_build_extern_static_requires_unsafe =
109109 use of extern static is unsafe and requires unsafe block
compiler/rustc_passes/messages.ftl+9-9
......@@ -14,7 +14,7 @@ passes_abi_of =
1414 fn_abi_of({$fn_name}) = {$fn_abi}
1515
1616passes_allow_incoherent_impl =
17 `rustc_allow_incoherent_impl` attribute should be applied to impl items.
17 `rustc_allow_incoherent_impl` attribute should be applied to impl items
1818 .label = the only currently supported targets are inherent methods
1919
2020passes_allow_internal_unstable =
......@@ -253,8 +253,8 @@ passes_doc_test_unknown_spotlight =
253253 .no_op_note = `doc(spotlight)` is now a no-op
254254
255255passes_duplicate_diagnostic_item_in_crate =
256 duplicate diagnostic item in crate `{$crate_name}`: `{$name}`.
257 .note = the diagnostic item is first defined in crate `{$orig_crate_name}`.
256 duplicate diagnostic item in crate `{$crate_name}`: `{$name}`
257 .note = the diagnostic item is first defined in crate `{$orig_crate_name}`
258258
259259passes_duplicate_feature_err =
260260 the feature `{$feature}` has already been declared
......@@ -263,27 +263,27 @@ passes_duplicate_lang_item =
263263 found duplicate lang item `{$lang_item_name}`
264264 .first_defined_span = the lang item is first defined here
265265 .first_defined_crate_depends = the lang item is first defined in crate `{$orig_crate_name}` (which `{$orig_dependency_of}` depends on)
266 .first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}`.
266 .first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}`
267267 .first_definition_local = first definition in the local crate (`{$orig_crate_name}`)
268268 .second_definition_local = second definition in the local crate (`{$crate_name}`)
269269 .first_definition_path = first definition in `{$orig_crate_name}` loaded from {$orig_path}
270270 .second_definition_path = second definition in `{$crate_name}` loaded from {$path}
271271
272272passes_duplicate_lang_item_crate =
273 duplicate lang item in crate `{$crate_name}`: `{$lang_item_name}`.
273 duplicate lang item in crate `{$crate_name}`: `{$lang_item_name}`
274274 .first_defined_span = the lang item is first defined here
275275 .first_defined_crate_depends = the lang item is first defined in crate `{$orig_crate_name}` (which `{$orig_dependency_of}` depends on)
276 .first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}`.
276 .first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}`
277277 .first_definition_local = first definition in the local crate (`{$orig_crate_name}`)
278278 .second_definition_local = second definition in the local crate (`{$crate_name}`)
279279 .first_definition_path = first definition in `{$orig_crate_name}` loaded from {$orig_path}
280280 .second_definition_path = second definition in `{$crate_name}` loaded from {$path}
281281
282282passes_duplicate_lang_item_crate_depends =
283 duplicate lang item in crate `{$crate_name}` (which `{$dependency_of}` depends on): `{$lang_item_name}`.
283 duplicate lang item in crate `{$crate_name}` (which `{$dependency_of}` depends on): `{$lang_item_name}`
284284 .first_defined_span = the lang item is first defined here
285285 .first_defined_crate_depends = the lang item is first defined in crate `{$orig_crate_name}` (which `{$orig_dependency_of}` depends on)
286 .first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}`.
286 .first_defined_crate = the lang item is first defined in crate `{$orig_crate_name}`
287287 .first_definition_local = first definition in the local crate (`{$orig_crate_name}`)
288288 .second_definition_local = second definition in the local crate (`{$crate_name}`)
289289 .first_definition_path = first definition in `{$orig_crate_name}` loaded from {$orig_path}
......@@ -315,7 +315,7 @@ passes_ffi_pure_invalid_target =
315315 `#[ffi_pure]` may only be used on foreign functions
316316
317317passes_has_incoherent_inherent_impl =
318 `rustc_has_incoherent_inherent_impls` attribute should be applied to types or traits.
318 `rustc_has_incoherent_inherent_impls` attribute should be applied to types or traits
319319 .label = only adts, extern types and traits are supported
320320
321321passes_ignored_attr =
compiler/rustc_resolve/messages.ftl+1-1
......@@ -240,7 +240,7 @@ resolve_label_with_similar_name_reachable =
240240
241241resolve_lending_iterator_report_error =
242242 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
243 .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.
243 .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
244244
245245resolve_lifetime_param_in_enum_discriminant =
246246 lifetime parameters may not be used in enum discriminant values
compiler/rustc_session/messages.ftl+2-2
......@@ -82,9 +82,9 @@ session_octal_float_literal_not_supported = octal float literal is not supported
8282
8383session_optimization_fuel_exhausted = optimization-fuel-exhausted: {$msg}
8484
85session_profile_sample_use_file_does_not_exist = file `{$path}` passed to `-C profile-sample-use` does not exist.
85session_profile_sample_use_file_does_not_exist = file `{$path}` passed to `-C profile-sample-use` does not exist
8686
87session_profile_use_file_does_not_exist = file `{$path}` passed to `-C profile-use` does not exist.
87session_profile_use_file_does_not_exist = file `{$path}` passed to `-C profile-use` does not exist
8888
8989session_sanitizer_cfi_canonical_jump_tables_requires_cfi = `-Zsanitizer-cfi-canonical-jump-tables` requires `-Zsanitizer=cfi`
9090
compiler/rustc_smir/src/rustc_smir/context.rs+7
......@@ -533,6 +533,13 @@ impl<'tcx> Context for TablesWrapper<'tcx> {
533533 Ok(tables.fn_abi_of_instance(instance, List::empty())?.stable(&mut *tables))
534534 }
535535
536 fn fn_ptr_abi(&self, fn_ptr: PolyFnSig) -> Result<FnAbi, Error> {
537 let mut tables = self.0.borrow_mut();
538 let tcx = tables.tcx;
539 let sig = fn_ptr.internal(&mut *tables, tcx);
540 Ok(tables.fn_abi_of_fn_ptr(sig, List::empty())?.stable(&mut *tables))
541 }
542
536543 fn instance_def_id(&self, def: InstanceDef) -> stable_mir::DefId {
537544 let mut tables = self.0.borrow_mut();
538545 let def_id = tables.instances[def].def_id();
compiler/rustc_span/src/symbol.rs+2
......@@ -2054,6 +2054,8 @@ symbols! {
20542054 yes,
20552055 yield_expr,
20562056 ymm_reg,
2057 zfh,
2058 zfhmin,
20572059 zmm_reg,
20582060 }
20592061}
compiler/rustc_target/src/asm/riscv.rs+4-3
......@@ -40,12 +40,13 @@ impl RiscVInlineAsmRegClass {
4040 match self {
4141 Self::reg => {
4242 if arch == InlineAsmArch::RiscV64 {
43 types! { _: I8, I16, I32, I64, F32, F64; }
43 types! { _: I8, I16, I32, I64, F16, F32, F64; }
4444 } else {
45 types! { _: I8, I16, I32, F32; }
45 types! { _: I8, I16, I32, F16, F32; }
4646 }
4747 }
48 Self::freg => types! { f: F32; d: F64; },
48 // FIXME(f16_f128): Add `q: F128;` once LLVM support the `Q` extension.
49 Self::freg => types! { f: F16, F32; d: F64; },
4950 Self::vreg => &[],
5051 }
5152 }
compiler/stable_mir/src/compiler_interface.rs+3
......@@ -215,6 +215,9 @@ pub trait Context {
215215 /// Get an instance ABI.
216216 fn instance_abi(&self, def: InstanceDef) -> Result<FnAbi, Error>;
217217
218 /// Get the ABI of a function pointer.
219 fn fn_ptr_abi(&self, fn_ptr: PolyFnSig) -> Result<FnAbi, Error>;
220
218221 /// Get the layout of a type.
219222 fn ty_layout(&self, ty: Ty) -> Result<Layout, Error>;
220223
compiler/stable_mir/src/ty.rs+11-1
......@@ -2,7 +2,7 @@ use super::{
22 mir::{Body, Mutability, Safety},
33 with, DefId, Error, Symbol,
44};
5use crate::abi::Layout;
5use crate::abi::{FnAbi, Layout};
66use crate::crate_def::{CrateDef, CrateDefType};
77use crate::mir::alloc::{read_target_int, read_target_uint, AllocId};
88use crate::mir::mono::StaticDef;
......@@ -996,6 +996,16 @@ pub struct AliasTerm {
996996
997997pub type PolyFnSig = Binder<FnSig>;
998998
999impl PolyFnSig {
1000 /// Compute a `FnAbi` suitable for indirect calls, i.e. to `fn` pointers.
1001 ///
1002 /// NB: this doesn't handle virtual calls - those should use `Instance::fn_abi`
1003 /// instead, where the instance is an `InstanceKind::Virtual`.
1004 pub fn fn_ptr_abi(self) -> Result<FnAbi, Error> {
1005 with(|cx| cx.fn_ptr_abi(self))
1006 }
1007}
1008
9991009#[derive(Clone, Debug, Eq, PartialEq)]
10001010pub struct FnSig {
10011011 pub inputs_and_output: Vec<Ty>,
src/ci/docker/scripts/fuchsia-test-runner.py+1-1
......@@ -112,7 +112,7 @@ def atomic_link(link: Path, target: Path):
112112 os.remove(tmp_file)
113113
114114
115@dataclass(kw_only=True)
115@dataclass
116116class TestEnvironment:
117117 rust_build_dir: Path
118118 sdk_dir: Path
src/tools/miri/src/alloc_bytes.rs+4
......@@ -108,4 +108,8 @@ impl AllocBytes for MiriAllocBytes {
108108 fn as_mut_ptr(&mut self) -> *mut u8 {
109109 self.ptr
110110 }
111
112 fn as_ptr(&self) -> *const u8 {
113 self.ptr
114 }
111115}
src/tools/tidy/Cargo.toml+1
......@@ -13,6 +13,7 @@ ignore = "0.4.18"
1313semver = "1.0"
1414termcolor = "1.1.3"
1515rustc-hash = "1.1.0"
16fluent-syntax = "0.11.1"
1617
1718[[bin]]
1819name = "rust-tidy"
src/tools/tidy/src/allowed_run_make_makefiles.txt-3
......@@ -14,7 +14,6 @@ run-make/compiler-lookup-paths-2/Makefile
1414run-make/compiler-lookup-paths/Makefile
1515run-make/compiler-rt-works-on-mingw/Makefile
1616run-make/crate-hash-rustc-version/Makefile
17run-make/crate-name-priority/Makefile
1817run-make/cross-lang-lto-clang/Makefile
1918run-make/cross-lang-lto-pgo-smoketest/Makefile
2019run-make/cross-lang-lto-upstream-rlibs/Makefile
......@@ -31,7 +30,6 @@ run-make/emit-shared-files/Makefile
3130run-make/emit-stack-sizes/Makefile
3231run-make/emit-to-stdout/Makefile
3332run-make/env-dep-info/Makefile
34run-make/error-writing-dependencies/Makefile
3533run-make/export-executable-symbols/Makefile
3634run-make/extern-diff-internal-name/Makefile
3735run-make/extern-flag-disambiguates/Makefile
......@@ -154,7 +152,6 @@ run-make/raw-dylib-inline-cross-dylib/Makefile
154152run-make/raw-dylib-link-ordinal/Makefile
155153run-make/raw-dylib-stdcall-ordinal/Makefile
156154run-make/redundant-libs/Makefile
157run-make/relocation-model/Makefile
158155run-make/relro-levels/Makefile
159156run-make/remap-path-prefix-dwarf/Makefile
160157run-make/remap-path-prefix/Makefile
src/tools/tidy/src/fluent_period.rs created+84
......@@ -0,0 +1,84 @@
1//! Checks that no Fluent messages or attributes end in periods (except ellipses)
2
3use fluent_syntax::ast::{Entry, PatternElement};
4
5use crate::walk::{filter_dirs, walk};
6use std::path::Path;
7
8fn filter_fluent(path: &Path) -> bool {
9 if let Some(ext) = path.extension() { ext.to_str() != Some("ftl") } else { true }
10}
11
12/// Messages allowed to have `.` at their end.
13///
14/// These should probably be reworked eventually.
15const ALLOWLIST: &[&str] = &[
16 "const_eval_long_running",
17 "const_eval_validation_failure_note",
18 "driver_impl_ice",
19 "incremental_corrupt_file",
20 "mir_build_pointer_pattern",
21];
22
23fn check_period(filename: &str, contents: &str, bad: &mut bool) {
24 if filename.contains("codegen") {
25 // FIXME: Too many codegen messages have periods right now...
26 return;
27 }
28
29 let (Ok(parse) | Err((parse, _))) = fluent_syntax::parser::parse(contents);
30 for entry in &parse.body {
31 if let Entry::Message(m) = entry {
32 if ALLOWLIST.contains(&m.id.name) {
33 continue;
34 }
35
36 if let Some(pat) = &m.value {
37 if let Some(PatternElement::TextElement { value }) = pat.elements.last() {
38 // We don't care about ellipses.
39 if value.ends_with(".") && !value.ends_with("...") {
40 let ll = find_line(contents, *value);
41 let name = m.id.name;
42 tidy_error!(bad, "{filename}:{ll}: message `{name}` ends in a period");
43 }
44 }
45 }
46
47 for attr in &m.attributes {
48 // Teach notes usually have long messages.
49 if attr.id.name == "teach_note" {
50 continue;
51 }
52
53 if let Some(PatternElement::TextElement { value }) = attr.value.elements.last() {
54 if value.ends_with(".") && !value.ends_with("...") {
55 let ll = find_line(contents, *value);
56 let name = attr.id.name;
57 tidy_error!(bad, "{filename}:{ll}: attr `{name}` ends in a period");
58 }
59 }
60 }
61 }
62 }
63}
64
65/// Evil cursed bad hack. Requires that `value` be a substr (in memory) of `contents`.
66fn find_line(haystack: &str, needle: &str) -> usize {
67 for (ll, line) in haystack.lines().enumerate() {
68 if line.as_ptr() > needle.as_ptr() {
69 return ll;
70 }
71 }
72
73 1
74}
75
76pub fn check(path: &Path, bad: &mut bool) {
77 walk(
78 path,
79 |path, is_dir| filter_dirs(path) || (!is_dir && filter_fluent(path)),
80 &mut |ent, contents| {
81 check_period(ent.path().to_str().unwrap(), contents, bad);
82 },
83 );
84}
src/tools/tidy/src/lib.rs+1
......@@ -72,6 +72,7 @@ pub mod ext_tool_checks;
7272pub mod extdeps;
7373pub mod features;
7474pub mod fluent_alphabetical;
75pub mod fluent_period;
7576mod fluent_used;
7677pub(crate) mod iter_header;
7778pub mod known_bug;
src/tools/tidy/src/main.rs+1
......@@ -115,6 +115,7 @@ fn main() {
115115 // Checks that only make sense for the compiler.
116116 check!(error_codes, &root_path, &[&compiler_path, &librustdoc_path], verbose);
117117 check!(fluent_alphabetical, &compiler_path, bless);
118 check!(fluent_period, &compiler_path);
118119 check!(target_policy, &root_path);
119120
120121 // Checks that only make sense for the std libs.
tests/assembly/asm/riscv-types.rs+53-2
......@@ -1,12 +1,34 @@
1//@ revisions: riscv64 riscv32
1//@ revisions: riscv64 riscv32 riscv64-zfhmin riscv32-zfhmin riscv64-zfh riscv32-zfh
22//@ assembly-output: emit-asm
3
34//@[riscv64] compile-flags: --target riscv64imac-unknown-none-elf
45//@[riscv64] needs-llvm-components: riscv
6
57//@[riscv32] compile-flags: --target riscv32imac-unknown-none-elf
68//@[riscv32] needs-llvm-components: riscv
9
10//@[riscv64-zfhmin] compile-flags: --target riscv64imac-unknown-none-elf --cfg riscv64
11//@[riscv64-zfhmin] needs-llvm-components: riscv
12//@[riscv64-zfhmin] compile-flags: -C target-feature=+zfhmin
13//@[riscv64-zfhmin] filecheck-flags: --check-prefix riscv64
14
15//@[riscv32-zfhmin] compile-flags: --target riscv32imac-unknown-none-elf
16//@[riscv32-zfhmin] needs-llvm-components: riscv
17//@[riscv32-zfhmin] compile-flags: -C target-feature=+zfhmin
18
19//@[riscv64-zfh] compile-flags: --target riscv64imac-unknown-none-elf --cfg riscv64
20//@[riscv64-zfh] needs-llvm-components: riscv
21//@[riscv64-zfh] compile-flags: -C target-feature=+zfh
22//@[riscv64-zfh] filecheck-flags: --check-prefix riscv64 --check-prefix zfhmin
23
24//@[riscv32-zfh] compile-flags: --target riscv32imac-unknown-none-elf
25//@[riscv32-zfh] needs-llvm-components: riscv
26//@[riscv32-zfh] compile-flags: -C target-feature=+zfh
27//@[riscv32-zfh] filecheck-flags: --check-prefix zfhmin
28
729//@ compile-flags: -C target-feature=+d
830
9#![feature(no_core, lang_items, rustc_attrs)]
31#![feature(no_core, lang_items, rustc_attrs, f16)]
1032#![crate_type = "rlib"]
1133#![no_core]
1234#![allow(asm_sub_register)]
......@@ -33,6 +55,7 @@ type ptr = *mut u8;
3355
3456impl Copy for i8 {}
3557impl Copy for i16 {}
58impl Copy for f16 {}
3659impl Copy for i32 {}
3760impl Copy for f32 {}
3861impl Copy for i64 {}
......@@ -103,6 +126,12 @@ macro_rules! check_reg {
103126// CHECK: #NO_APP
104127check!(reg_i8 i8 reg "mv");
105128
129// CHECK-LABEL: reg_f16:
130// CHECK: #APP
131// CHECK: mv {{[a-z0-9]+}}, {{[a-z0-9]+}}
132// CHECK: #NO_APP
133check!(reg_f16 f16 reg "mv");
134
106135// CHECK-LABEL: reg_i16:
107136// CHECK: #APP
108137// CHECK: mv {{[a-z0-9]+}}, {{[a-z0-9]+}}
......@@ -141,6 +170,14 @@ check!(reg_f64 f64 reg "mv");
141170// CHECK: #NO_APP
142171check!(reg_ptr ptr reg "mv");
143172
173// CHECK-LABEL: freg_f16:
174// zfhmin-NOT: or
175// CHECK: #APP
176// CHECK: fmv.s f{{[a-z0-9]+}}, f{{[a-z0-9]+}}
177// CHECK: #NO_APP
178// zfhmin-NOT: or
179check!(freg_f16 f16 freg "fmv.s");
180
144181// CHECK-LABEL: freg_f32:
145182// CHECK: #APP
146183// CHECK: fmv.s f{{[a-z0-9]+}}, f{{[a-z0-9]+}}
......@@ -165,6 +202,12 @@ check_reg!(a0_i8 i8 "a0" "mv");
165202// CHECK: #NO_APP
166203check_reg!(a0_i16 i16 "a0" "mv");
167204
205// CHECK-LABEL: a0_f16:
206// CHECK: #APP
207// CHECK: mv a0, a0
208// CHECK: #NO_APP
209check_reg!(a0_f16 f16 "a0" "mv");
210
168211// CHECK-LABEL: a0_i32:
169212// CHECK: #APP
170213// CHECK: mv a0, a0
......@@ -197,6 +240,14 @@ check_reg!(a0_f64 f64 "a0" "mv");
197240// CHECK: #NO_APP
198241check_reg!(a0_ptr ptr "a0" "mv");
199242
243// CHECK-LABEL: fa0_f16:
244// zfhmin-NOT: or
245// CHECK: #APP
246// CHECK: fmv.s fa0, fa0
247// CHECK: #NO_APP
248// zfhmin-NOT: or
249check_reg!(fa0_f16 f16 "fa0" "fmv.s");
250
200251// CHECK-LABEL: fa0_f32:
201252// CHECK: #APP
202253// CHECK: fmv.s fa0, fa0
tests/run-make/crate-name-priority/Makefile deleted-12
......@@ -1,12 +0,0 @@
1# ignore-cross-compile
2include ../tools.mk
3
4all:
5 $(RUSTC) foo.rs
6 rm $(TMPDIR)/$(call BIN,foo)
7 $(RUSTC) foo.rs --crate-name bar
8 rm $(TMPDIR)/$(call BIN,bar)
9 $(RUSTC) foo1.rs
10 rm $(TMPDIR)/$(call BIN,foo)
11 $(RUSTC) foo1.rs -o $(TMPDIR)/$(call BIN,bar1)
12 rm $(TMPDIR)/$(call BIN,bar1)
tests/run-make/crate-name-priority/rmake.rs created+18
......@@ -0,0 +1,18 @@
1// The `crate_name` rustc flag should have higher priority
2// over `#![crate_name = "foo"]` defined inside the source code.
3// This test has a conflict between crate_names defined in the .rs files
4// and the compiler flags, and checks that the flag is favoured each time.
5// See https://github.com/rust-lang/rust/pull/15518
6
7use run_make_support::{bin_name, fs_wrapper, rustc};
8
9fn main() {
10 rustc().input("foo.rs").run();
11 fs_wrapper::remove_file(bin_name("foo"));
12 rustc().input("foo.rs").crate_name("bar").run();
13 fs_wrapper::remove_file(bin_name("bar"));
14 rustc().input("foo1.rs").run();
15 fs_wrapper::remove_file(bin_name("foo"));
16 rustc().input("foo1.rs").output(bin_name("bar1")).run();
17 fs_wrapper::remove_file(bin_name("bar1"));
18}
tests/run-make/error-writing-dependencies/Makefile deleted-8
......@@ -1,8 +0,0 @@
1include ../tools.mk
2
3all:
4 # Let's get a nice error message
5 $(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | \
6 $(CGREP) "error writing dependencies"
7 # Make sure the filename shows up
8 $(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | $(CGREP) "baz"
tests/run-make/error-writing-dependencies/rmake.rs created+17
......@@ -0,0 +1,17 @@
1// Invalid paths passed to rustc used to cause internal compilation errors
2// alongside an obscure error message. This was turned into a standard error,
3// and this test checks that the cleaner error message is printed instead.
4// See https://github.com/rust-lang/rust/issues/13517
5
6use run_make_support::rustc;
7
8// NOTE: This cannot be a UI test due to the --out-dir flag, which is
9// already present by default in UI testing.
10
11fn main() {
12 let out = rustc().input("foo.rs").emit("dep-info").out_dir("foo/bar/baz").run_fail();
13 // The error message should be informative.
14 out.assert_stderr_contains("error writing dependencies");
15 // The filename should appear.
16 out.assert_stderr_contains("baz");
17}
tests/run-make/relocation-model/Makefile deleted-20
......@@ -1,20 +0,0 @@
1# ignore-cross-compile
2include ../tools.mk
3
4all: others
5 $(RUSTC) -C relocation-model=dynamic-no-pic foo.rs
6 $(call RUN,foo)
7
8 $(RUSTC) -C relocation-model=default foo.rs
9 $(call RUN,foo)
10
11 $(RUSTC) -C relocation-model=dynamic-no-pic --crate-type=dylib foo.rs --emit=link,obj
12
13ifdef IS_MSVC
14# FIXME(#28026)
15others:
16else
17others:
18 $(RUSTC) -C relocation-model=static foo.rs
19 $(call RUN,foo)
20endif
tests/run-make/relocation-model/rmake.rs created+24
......@@ -0,0 +1,24 @@
1// Generation of position-independent code (PIC) can be altered
2// through use of the -C relocation-model rustc flag. This test
3// uses varied values with this flag and checks that compilation
4// succeeds.
5// See https://github.com/rust-lang/rust/pull/13340
6
7//@ ignore-cross-compile
8
9use run_make_support::{run, rustc};
10
11fn main() {
12 rustc().arg("-Crelocation-model=static").input("foo.rs").run();
13 run("foo");
14 rustc().arg("-Crelocation-model=dynamic-no-pic").input("foo.rs").run();
15 run("foo");
16 rustc().arg("-Crelocation-model=default").input("foo.rs").run();
17 run("foo");
18 rustc()
19 .arg("-Crelocation-model=dynamic-no-pic")
20 .crate_type("dylib")
21 .emit("link,obj")
22 .input("foo.rs")
23 .run();
24}
tests/ui-fulldeps/stable-mir/check_abi.rs+23
......@@ -54,6 +54,21 @@ fn test_stable_mir() -> ControlFlow<()> {
5454 let variadic_fn = *get_item(&items, (ItemKind::Fn, "variadic_fn")).unwrap();
5555 check_variadic(variadic_fn);
5656
57 // Extract function pointers.
58 let fn_ptr_holder = *get_item(&items, (ItemKind::Fn, "fn_ptr_holder")).unwrap();
59 let fn_ptr_holder_instance = Instance::try_from(fn_ptr_holder).unwrap();
60 let body = fn_ptr_holder_instance.body().unwrap();
61 let args = body.arg_locals();
62
63 // Test fn_abi of function pointer version.
64 let ptr_fn_abi = args[0].ty.kind().fn_sig().unwrap().fn_ptr_abi().unwrap();
65 assert_eq!(ptr_fn_abi, fn_abi);
66
67 // Test variadic_fn of function pointer version.
68 let ptr_variadic_fn_abi = args[1].ty.kind().fn_sig().unwrap().fn_ptr_abi().unwrap();
69 assert!(ptr_variadic_fn_abi.c_variadic);
70 assert_eq!(ptr_variadic_fn_abi.args.len(), 1);
71
5772 ControlFlow::Continue(())
5873}
5974
......@@ -164,6 +179,14 @@ fn generate_input(path: &str) -> std::io::Result<()> {
164179 pub unsafe extern "C" fn variadic_fn(n: usize, mut args: ...) -> usize {{
165180 0
166181 }}
182
183 pub type ComplexFn = fn([u8; 0], char, NonZero<u8>) -> Result<usize, &'static str>;
184 pub type VariadicFn = unsafe extern "C" fn(usize, ...) -> usize;
185
186 pub fn fn_ptr_holder(complex_fn: ComplexFn, variadic_fn: VariadicFn) {{
187 // We only care about the signature.
188 todo!()
189 }}
167190 "#
168191 )?;
169192 Ok(())
tests/ui/abi/abi-typo-unstable.stderr+1-1
......@@ -4,7 +4,7 @@ error[E0703]: invalid ABI: found `rust-intrinsec`
44LL | extern "rust-intrinsec" fn rust_intrinsic() {}
55 | ^^^^^^^^^^^^^^^^ invalid ABI
66 |
7 = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
7 = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
88
99error: aborting due to 1 previous error
1010
tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr+2-2
......@@ -7,7 +7,7 @@ LL | extern "riscv-interrupt" fn isr() {}
77 | invalid ABI
88 | help: did you mean: `"riscv-interrupt-m"`
99 |
10 = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
10 = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
1111 = note: please use one of riscv-interrupt-m or riscv-interrupt-s for machine- or supervisor-level interrupts, respectively
1212
1313error[E0703]: invalid ABI: found `riscv-interrupt-u`
......@@ -19,7 +19,7 @@ LL | extern "riscv-interrupt-u" fn isr_U() {}
1919 | invalid ABI
2020 | help: did you mean: `"riscv-interrupt-m"`
2121 |
22 = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
22 = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
2323 = note: user-mode interrupt handlers have been removed from LLVM pending standardization, see: https://reviews.llvm.org/D149314
2424
2525error: aborting due to 2 previous errors
tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr+2-2
......@@ -7,7 +7,7 @@ LL | extern "riscv-interrupt" fn isr() {}
77 | invalid ABI
88 | help: did you mean: `"riscv-interrupt-m"`
99 |
10 = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
10 = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
1111 = note: please use one of riscv-interrupt-m or riscv-interrupt-s for machine- or supervisor-level interrupts, respectively
1212
1313error[E0703]: invalid ABI: found `riscv-interrupt-u`
......@@ -19,7 +19,7 @@ LL | extern "riscv-interrupt-u" fn isr_U() {}
1919 | invalid ABI
2020 | help: did you mean: `"riscv-interrupt-m"`
2121 |
22 = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
22 = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
2323 = note: user-mode interrupt handlers have been removed from LLVM pending standardization, see: https://reviews.llvm.org/D149314
2424
2525error: aborting due to 2 previous errors
tests/ui/codemap_tests/unicode.normal.stderr+1-1
......@@ -4,7 +4,7 @@ error[E0703]: invalid ABI: found `路濫狼á́́`
44LL | extern "路濫狼á́́" fn foo() {}
55 | ^^^^^^^^^ invalid ABI
66 |
7 = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
7 = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
88
99error: aborting due to 1 previous error
1010
tests/ui/error-codes/E0116.stderr+1-1
......@@ -2,7 +2,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher
22 --> $DIR/E0116.rs:1:1
33 |
44LL | impl Vec<u8> {}
5 | ^^^^^^^^^^^^ impl for type defined outside of crate.
5 | ^^^^^^^^^^^^ impl for type defined outside of crate
66 |
77 = note: define and implement a trait or new type instead
88
tests/ui/error-codes/E0519.stderr+1-1
......@@ -1,4 +1,4 @@
1error[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.
1error[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
22 --> $DIR/E0519.rs:8:1
33 |
44LL | extern crate crateresolve1;
tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr+2-2
......@@ -186,7 +186,7 @@ warning: unknown lint: `x5100`
186186LL | #[deny(x5100)] impl S { }
187187 | ^^^^^
188188
189warning: use of deprecated attribute `crate_id`: no longer used.
189warning: use of deprecated attribute `crate_id`: no longer used
190190 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:84:1
191191 |
192192LL | #![crate_id = "10"]
......@@ -194,7 +194,7 @@ LL | #![crate_id = "10"]
194194 |
195195 = note: `#[warn(deprecated)]` on by default
196196
197warning: use of deprecated attribute `no_start`: no longer used.
197warning: use of deprecated attribute `no_start`: no longer used
198198 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:94:1
199199 |
200200LL | #![no_start]
tests/ui/incoherent-inherent-impls/no-attr-empty-impl.stderr+4-4
......@@ -2,7 +2,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher
22 --> $DIR/no-attr-empty-impl.rs:4:1
33 |
44LL | impl extern_crate::StructWithAttr {}
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate.
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate
66 |
77 = note: define and implement a trait or new type instead
88
......@@ -10,7 +10,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher
1010 --> $DIR/no-attr-empty-impl.rs:7:1
1111 |
1212LL | impl extern_crate::StructNoAttr {}
13 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate.
13 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate
1414 |
1515 = note: define and implement a trait or new type instead
1616
......@@ -18,7 +18,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher
1818 --> $DIR/no-attr-empty-impl.rs:10:1
1919 |
2020LL | impl extern_crate::EnumWithAttr {}
21 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate.
21 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate
2222 |
2323 = note: define and implement a trait or new type instead
2424
......@@ -26,7 +26,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher
2626 --> $DIR/no-attr-empty-impl.rs:13:1
2727 |
2828LL | impl extern_crate::EnumNoAttr {}
29 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate.
29 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate
3030 |
3131 = note: define and implement a trait or new type instead
3232
tests/ui/instrument-coverage/mcdc-condition-limit.bad.stderr+1-1
......@@ -1,4 +1,4 @@
1warning: Number of conditions in decision (7) exceeds limit (6). MC/DC analysis will not count this expression.
1warning: number of conditions in decision (7) exceeds limit (6), so MC/DC analysis will not count this expression
22 --> $DIR/mcdc-condition-limit.rs:29:8
33 |
44LL | if a && b && c && d && e && f && g {
tests/ui/instrument-coverage/mcdc-condition-limit.rs+1-1
......@@ -26,7 +26,7 @@ fn main() {
2626fn main() {
2727 // 7 conditions is too many, so issue a diagnostic.
2828 let [a, b, c, d, e, f, g] = <[bool; 7]>::default();
29 if a && b && c && d && e && f && g { //[bad]~ WARNING Number of conditions in decision
29 if a && b && c && d && e && f && g { //[bad]~ WARNING number of conditions in decision
3030 core::hint::black_box("hello");
3131 }
3232}
tests/ui/lifetimes/no_lending_iterators.stderr+1-1
......@@ -4,7 +4,7 @@ error: associated type `Iterator::Item` is declared without lifetime parameters,
44LL | type Item = &str;
55 | ^
66 |
7note: 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.
7note: 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
88 --> $DIR/no_lending_iterators.rs:3:19
99 |
1010LL | impl Iterator for Data {
tests/ui/lint/lint-attr-everywhere-late.stderr+11-11
......@@ -154,7 +154,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
154154LL | fn assoc_fn() { discriminant::<i32>(&123); }
155155 | ^^^^^^^^^^^^^^^^^^^^^^^^^
156156 |
157note: 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.
157note: 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
158158 --> $DIR/lint-attr-everywhere-late.rs:96:41
159159 |
160160LL | fn assoc_fn() { discriminant::<i32>(&123); }
......@@ -208,7 +208,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
208208LL | let _ = discriminant::<i32>(&123);
209209 | ^^^^^^^^^^^^^^^^^^^^^^^^^
210210 |
211note: 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.
211note: 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
212212 --> $DIR/lint-attr-everywhere-late.rs:139:33
213213 |
214214LL | let _ = discriminant::<i32>(&123);
......@@ -237,7 +237,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
237237LL | discriminant::<i32>(&123);
238238 | ^^^^^^^^^^^^^^^^^^^^^^^^^
239239 |
240note: 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.
240note: 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
241241 --> $DIR/lint-attr-everywhere-late.rs:155:33
242242 |
243243LL | discriminant::<i32>(&123);
......@@ -254,7 +254,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
254254LL | discriminant::<i32>(&123);
255255 | ^^^^^^^^^^^^^^^^^^^^^^^^^
256256 |
257note: 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.
257note: 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
258258 --> $DIR/lint-attr-everywhere-late.rs:161:33
259259 |
260260LL | discriminant::<i32>(&123);
......@@ -283,7 +283,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
283283LL | discriminant::<i32>(&123);
284284 | ^^^^^^^^^^^^^^^^^^^^^^^^^
285285 |
286note: 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.
286note: 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
287287 --> $DIR/lint-attr-everywhere-late.rs:173:29
288288 |
289289LL | discriminant::<i32>(&123);
......@@ -300,7 +300,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
300300LL | discriminant::<i32>(&123);
301301 | ^^^^^^^^^^^^^^^^^^^^^^^^^
302302 |
303note: 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.
303note: 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
304304 --> $DIR/lint-attr-everywhere-late.rs:177:29
305305 |
306306LL | discriminant::<i32>(&123);
......@@ -317,7 +317,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
317317LL | discriminant::<i32>(&123);
318318 | ^^^^^^^^^^^^^^^^^^^^^^^^^
319319 |
320note: 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.
320note: 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
321321 --> $DIR/lint-attr-everywhere-late.rs:182:25
322322 |
323323LL | discriminant::<i32>(&123);
......@@ -334,7 +334,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
334334LL | [#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123)];
335335 | ^^^^^^^^^^^^^^^^^^^^^^^^^
336336 |
337note: 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.
337note: 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
338338 --> $DIR/lint-attr-everywhere-late.rs:184:61
339339 |
340340LL | [#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123)];
......@@ -351,7 +351,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
351351LL | (#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123),);
352352 | ^^^^^^^^^^^^^^^^^^^^^^^^^
353353 |
354note: 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.
354note: 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
355355 --> $DIR/lint-attr-everywhere-late.rs:185:61
356356 |
357357LL | (#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123),);
......@@ -368,7 +368,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
368368LL | call(#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123));
369369 | ^^^^^^^^^^^^^^^^^^^^^^^^^
370370 |
371note: 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.
371note: 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
372372 --> $DIR/lint-attr-everywhere-late.rs:187:65
373373 |
374374LL | call(#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123));
......@@ -385,7 +385,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
385385LL | TupleStruct(#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123));
386386 | ^^^^^^^^^^^^^^^^^^^^^^^^^
387387 |
388note: 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.
388note: 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
389389 --> $DIR/lint-attr-everywhere-late.rs:189:72
390390 |
391391LL | TupleStruct(#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123));
tests/ui/lint/lint-enum-intrinsics-non-enums.stderr+9-9
......@@ -4,7 +4,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
44LL | discriminant(&());
55 | ^^^^^^^^^^^^^^^^^
66 |
7note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `()`, which is not an enum.
7note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `()`, which is not an enum
88 --> $DIR/lint-enum-intrinsics-non-enums.rs:26:18
99 |
1010LL | discriminant(&());
......@@ -17,7 +17,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
1717LL | discriminant(&&SomeEnum::B);
1818 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1919 |
20note: 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.
20note: 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
2121 --> $DIR/lint-enum-intrinsics-non-enums.rs:29:18
2222 |
2323LL | discriminant(&&SomeEnum::B);
......@@ -29,7 +29,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
2929LL | discriminant(&SomeStruct);
3030 | ^^^^^^^^^^^^^^^^^^^^^^^^^
3131 |
32note: 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.
32note: 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
3333 --> $DIR/lint-enum-intrinsics-non-enums.rs:32:18
3434 |
3535LL | discriminant(&SomeStruct);
......@@ -41,7 +41,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
4141LL | discriminant(&123u32);
4242 | ^^^^^^^^^^^^^^^^^^^^^
4343 |
44note: 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.
44note: 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
4545 --> $DIR/lint-enum-intrinsics-non-enums.rs:35:18
4646 |
4747LL | discriminant(&123u32);
......@@ -53,7 +53,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a
5353LL | discriminant(&&123i8);
5454 | ^^^^^^^^^^^^^^^^^^^^^
5555 |
56note: 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.
56note: 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
5757 --> $DIR/lint-enum-intrinsics-non-enums.rs:38:18
5858 |
5959LL | discriminant(&&123i8);
......@@ -65,7 +65,7 @@ error: the return value of `mem::variant_count` is unspecified when called with
6565LL | variant_count::<&str>();
6666 | ^^^^^^^^^^^^^^^^^^^^^^^
6767 |
68 = note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `&str`, which is not an enum.
68 = note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `&str`, which is not an enum
6969
7070error: the return value of `mem::variant_count` is unspecified when called with a non-enum type
7171 --> $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
7373LL | variant_count::<*const u8>();
7474 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7575 |
76 = 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.
76 = 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
7777
7878error: the return value of `mem::variant_count` is unspecified when called with a non-enum type
7979 --> $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
8181LL | variant_count::<()>();
8282 | ^^^^^^^^^^^^^^^^^^^^^
8383 |
84 = note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `()`, which is not an enum.
84 = note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `()`, which is not an enum
8585
8686error: the return value of `mem::variant_count` is unspecified when called with a non-enum type
8787 --> $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
8989LL | variant_count::<&SomeEnum>();
9090 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9191 |
92 = note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `&SomeEnum`, which is not an enum.
92 = note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `&SomeEnum`, which is not an enum
9393
9494error: aborting due to 9 previous errors
9595
tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr+1-1
......@@ -4,7 +4,7 @@ warning: unnecessary associated type bound for not object safe associated type
44LL | fn foo(_: &dyn Foo<Bar = ()>) {}
55 | ^^^^^^^^ help: remove this bound
66 |
7 = 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`.
7 = 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`
88 = note: `#[warn(unused_associated_type_bounds)]` on by default
99
1010warning: 1 warning emitted
tests/ui/parser/issues/issue-8537.stderr+1-1
......@@ -4,7 +4,7 @@ error[E0703]: invalid ABI: found `invalid-ab_isize`
44LL | "invalid-ab_isize"
55 | ^^^^^^^^^^^^^^^^^^ invalid ABI
66 |
7 = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
7 = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
88
99error: aborting due to 1 previous error
1010
tests/ui/suggestions/abi-typo.stderr+1-1
......@@ -7,7 +7,7 @@ LL | extern "cdedl" fn cdedl() {}
77 | invalid ABI
88 | help: did you mean: `"cdecl"`
99 |
10 = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
10 = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
1111
1212error: aborting due to 1 previous error
1313
tests/ui/tool-attributes/duplicate-diagnostic.stderr+4-4
......@@ -1,14 +1,14 @@
1error: duplicate diagnostic item in crate `p2`: `Foo`.
1error: duplicate diagnostic item in crate `p2`: `Foo`
22 |
3 = note: the diagnostic item is first defined in crate `p1`.
3 = note: the diagnostic item is first defined in crate `p1`
44
5error: duplicate diagnostic item in crate `duplicate_diagnostic`: `Foo`.
5error: duplicate diagnostic item in crate `duplicate_diagnostic`: `Foo`
66 --> $DIR/duplicate-diagnostic.rs:12:1
77 |
88LL | pub struct Foo {}
99 | ^^^^^^^^^^^^^^
1010 |
11 = note: the diagnostic item is first defined in crate `p2`.
11 = note: the diagnostic item is first defined in crate `p2`
1212
1313error: aborting due to 2 previous errors
1414
tests/ui/traits/trait-or-new-type-instead.stderr+1-1
......@@ -2,7 +2,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher
22 --> $DIR/trait-or-new-type-instead.rs:1:1
33 |
44LL | impl<T> Option<T> {
5 | ^^^^^^^^^^^^^^^^^ impl for type defined outside of crate.
5 | ^^^^^^^^^^^^^^^^^ impl for type defined outside of crate
66 |
77 = note: define and implement a trait or new type instead
88