| author | bors <bors@rust-lang.org> 2024-06-22 05:51:57 UTC |
| committer | bors <bors@rust-lang.org> 2024-06-22 05:51:57 UTC |
| log | f0aceed540be1d2c761c7beedf09d243f3377298 |
| tree | 64b3d7f75d32bd10332c31c5e3845ef14c5c1c20 |
| parent | 10e1f5d2121831991a1bebb8cda044a1677aaddf |
| parent | 1916b3d57fce92a42c6acf85b1d9cbf59f16978a |
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: rollup51 files changed, 412 insertions(+), 128 deletions(-)
Cargo.lock+1| ... | ... | @@ -5700,6 +5700,7 @@ name = "tidy" |
| 5700 | 5700 | version = "0.1.0" |
| 5701 | 5701 | dependencies = [ |
| 5702 | 5702 | "cargo_metadata 0.15.4", |
| 5703 | "fluent-syntax", | |
| 5703 | 5704 | "ignore", |
| 5704 | 5705 | "miropt-test-tools", |
| 5705 | 5706 | "regex", |
compiler/rustc_ast_lowering/messages.ftl+1-1| ... | ... | @@ -78,7 +78,7 @@ ast_lowering_inline_asm_unsupported_target = |
| 78 | 78 | ast_lowering_invalid_abi = |
| 79 | 79 | invalid ABI: found `{$abi}` |
| 80 | 80 | .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 | |
| 82 | 82 | |
| 83 | 83 | ast_lowering_invalid_abi_clobber_abi = |
| 84 | 84 | invalid ABI for `clobber_abi` |
compiler/rustc_codegen_llvm/src/asm.rs+49-6| ... | ... | @@ -13,7 +13,7 @@ use rustc_codegen_ssa::traits::*; |
| 13 | 13 | use rustc_data_structures::fx::FxHashMap; |
| 14 | 14 | use rustc_middle::ty::layout::TyAndLayout; |
| 15 | 15 | use rustc_middle::{bug, span_bug, ty::Instance}; |
| 16 | use rustc_span::{Pos, Span}; | |
| 16 | use rustc_span::{sym, Pos, Span, Symbol}; | |
| 17 | 17 | use rustc_target::abi::*; |
| 18 | 18 | use rustc_target::asm::*; |
| 19 | 19 | use tracing::debug; |
| ... | ... | @@ -64,7 +64,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { |
| 64 | 64 | let mut layout = None; |
| 65 | 65 | let ty = if let Some(ref place) = place { |
| 66 | 66 | 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) | |
| 68 | 68 | } else if matches!( |
| 69 | 69 | reg.reg_class(), |
| 70 | 70 | InlineAsmRegClass::X86( |
| ... | ... | @@ -112,7 +112,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { |
| 112 | 112 | // so we just use the type of the input. |
| 113 | 113 | &in_value.layout |
| 114 | 114 | }; |
| 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); | |
| 116 | 116 | output_types.push(ty); |
| 117 | 117 | op_idx.insert(idx, constraints.len()); |
| 118 | 118 | let prefix = if late { "=" } else { "=&" }; |
| ... | ... | @@ -127,8 +127,13 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { |
| 127 | 127 | for (idx, op) in operands.iter().enumerate() { |
| 128 | 128 | match *op { |
| 129 | 129 | 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 | ); | |
| 132 | 137 | inputs.push(llval); |
| 133 | 138 | op_idx.insert(idx, constraints.len()); |
| 134 | 139 | constraints.push(reg_to_llvm(reg, Some(&value.layout))); |
| ... | ... | @@ -139,6 +144,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { |
| 139 | 144 | in_value.immediate(), |
| 140 | 145 | reg.reg_class(), |
| 141 | 146 | &in_value.layout, |
| 147 | instance, | |
| 142 | 148 | ); |
| 143 | 149 | inputs.push(value); |
| 144 | 150 | |
| ... | ... | @@ -341,7 +347,8 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { |
| 341 | 347 | } else { |
| 342 | 348 | self.extract_value(result, op_idx[&idx] as u64) |
| 343 | 349 | }; |
| 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); | |
| 345 | 352 | OperandValue::Immediate(value).store(self, place); |
| 346 | 353 | } |
| 347 | 354 | } |
| ... | ... | @@ -913,12 +920,22 @@ fn llvm_asm_scalar_type<'ll>(cx: &CodegenCx<'ll, '_>, scalar: Scalar) -> &'ll Ty |
| 913 | 920 | } |
| 914 | 921 | } |
| 915 | 922 | |
| 923 | fn 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 | ||
| 916 | 932 | /// Fix up an input value to work around LLVM bugs. |
| 917 | 933 | fn llvm_fixup_input<'ll, 'tcx>( |
| 918 | 934 | bx: &mut Builder<'_, 'll, 'tcx>, |
| 919 | 935 | mut value: &'ll Value, |
| 920 | 936 | reg: InlineAsmRegClass, |
| 921 | 937 | layout: &TyAndLayout<'tcx>, |
| 938 | instance: Instance<'_>, | |
| 922 | 939 | ) -> &'ll Value { |
| 923 | 940 | let dl = &bx.tcx.data_layout; |
| 924 | 941 | match (reg, layout.abi) { |
| ... | ... | @@ -1029,6 +1046,16 @@ fn llvm_fixup_input<'ll, 'tcx>( |
| 1029 | 1046 | _ => value, |
| 1030 | 1047 | } |
| 1031 | 1048 | } |
| 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 | } | |
| 1032 | 1059 | _ => value, |
| 1033 | 1060 | } |
| 1034 | 1061 | } |
| ... | ... | @@ -1039,6 +1066,7 @@ fn llvm_fixup_output<'ll, 'tcx>( |
| 1039 | 1066 | mut value: &'ll Value, |
| 1040 | 1067 | reg: InlineAsmRegClass, |
| 1041 | 1068 | layout: &TyAndLayout<'tcx>, |
| 1069 | instance: Instance<'_>, | |
| 1042 | 1070 | ) -> &'ll Value { |
| 1043 | 1071 | match (reg, layout.abi) { |
| 1044 | 1072 | (InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg), Abi::Scalar(s)) => { |
| ... | ... | @@ -1140,6 +1168,14 @@ fn llvm_fixup_output<'ll, 'tcx>( |
| 1140 | 1168 | _ => value, |
| 1141 | 1169 | } |
| 1142 | 1170 | } |
| 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 | } | |
| 1143 | 1179 | _ => value, |
| 1144 | 1180 | } |
| 1145 | 1181 | } |
| ... | ... | @@ -1149,6 +1185,7 @@ fn llvm_fixup_output_type<'ll, 'tcx>( |
| 1149 | 1185 | cx: &CodegenCx<'ll, 'tcx>, |
| 1150 | 1186 | reg: InlineAsmRegClass, |
| 1151 | 1187 | layout: &TyAndLayout<'tcx>, |
| 1188 | instance: Instance<'_>, | |
| 1152 | 1189 | ) -> &'ll Type { |
| 1153 | 1190 | match (reg, layout.abi) { |
| 1154 | 1191 | (InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg), Abi::Scalar(s)) => { |
| ... | ... | @@ -1242,6 +1279,12 @@ fn llvm_fixup_output_type<'ll, 'tcx>( |
| 1242 | 1279 | _ => layout.llvm_type(cx), |
| 1243 | 1280 | } |
| 1244 | 1281 | } |
| 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 | } | |
| 1245 | 1288 | _ => layout.llvm_type(cx), |
| 1246 | 1289 | } |
| 1247 | 1290 | } |
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 |
| 341 | 341 | const_eval_unallowed_heap_allocations = |
| 342 | 342 | allocations are not allowed in {const_eval_const_context}s |
| 343 | 343 | .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. | |
| 346 | 345 | |
| 347 | 346 | const_eval_unallowed_inline_asm = |
| 348 | 347 | 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> { |
| 630 | 630 | } |
| 631 | 631 | } |
| 632 | 632 | |
| 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 | ||
| 633 | 640 | /// Bounds-checked *but not align-checked* allocation access. |
| 634 | 641 | pub fn get_ptr_alloc<'a>( |
| 635 | 642 | &'a self, |
| ... | ... | @@ -713,6 +720,16 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { |
| 713 | 720 | Ok((alloc, &mut self.machine)) |
| 714 | 721 | } |
| 715 | 722 | |
| 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 | ||
| 716 | 733 | /// Bounds-checked *but not align-checked* allocation access. |
| 717 | 734 | pub fn get_ptr_alloc_mut<'a>( |
| 718 | 735 | &'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 |
| 194 | 194 | .span_help = alternatively add `#[rustc_has_incoherent_inherent_impls]` to the type and `#[rustc_allow_incoherent_impl]` to the relevant impl items |
| 195 | 195 | |
| 196 | 196 | hir_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 | |
| 198 | 198 | .note = define and implement a trait or new type instead |
| 199 | 199 | |
| 200 | 200 | 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 = |
| 544 | 544 | |
| 545 | 545 | hir_analysis_unused_associated_type_bounds = |
| 546 | 546 | 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` | |
| 548 | 548 | .suggestion = remove this bound |
| 549 | 549 | |
| 550 | 550 | hir_analysis_unused_generic_parameter = |
compiler/rustc_lint/messages.ftl+4-4| ... | ... | @@ -75,7 +75,7 @@ lint_builtin_deprecated_attr_default_suggestion = remove this attribute |
| 75 | 75 | lint_builtin_deprecated_attr_link = use of deprecated attribute `{$name}`: {$reason}. See {$link} |
| 76 | 76 | .msg_suggestion = {$msg} |
| 77 | 77 | .default_suggestion = remove this attribute |
| 78 | lint_builtin_deprecated_attr_used = use of deprecated attribute `{$name}`: no longer used. | |
| 78 | lint_builtin_deprecated_attr_used = use of deprecated attribute `{$name}`: no longer used | |
| 79 | 79 | lint_builtin_deref_nullptr = dereferencing a null pointer |
| 80 | 80 | .label = this code causes undefined behavior when executed |
| 81 | 81 | |
| ... | ... | @@ -213,7 +213,7 @@ lint_default_hash_types = prefer `{$preferred}` over `{$used}`, it has better pe |
| 213 | 213 | lint_default_source = `forbid` lint level is the default for {$id} |
| 214 | 214 | |
| 215 | 215 | lint_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 | |
| 217 | 217 | .suggestion = change it to |
| 218 | 218 | .help = change it to {$replace} |
| 219 | 219 | |
| ... | ... | @@ -244,11 +244,11 @@ lint_duplicate_matcher_binding = duplicate matcher binding |
| 244 | 244 | |
| 245 | 245 | lint_enum_intrinsics_mem_discriminant = |
| 246 | 246 | 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 | |
| 248 | 248 | |
| 249 | 249 | lint_enum_intrinsics_mem_variant = |
| 250 | 250 | 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 | |
| 252 | 252 | |
| 253 | 253 | lint_expectation = this lint expectation is unfulfilled |
| 254 | 254 | .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 = |
| 248 | 248 | .help = try adding `extern crate rustc_driver;` at the top level of this crate |
| 249 | 249 | |
| 250 | 250 | metadata_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 | |
| 252 | 252 | |
| 253 | 253 | metadata_std_required = |
| 254 | 254 | `std` is required by `{$current_crate}` because it does not declare `#![no_std]` |
| 255 | 255 | |
| 256 | 256 | metadata_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 | |
| 258 | 258 | |
| 259 | 259 | metadata_target_no_std_support = |
| 260 | 260 | 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 |
| 40 | 40 | /// Gives direct access to the raw underlying storage. |
| 41 | 41 | /// |
| 42 | 42 | /// Crucially this pointer is compatible with: |
| 43 | /// - other pointers retunred by this method, and | |
| 43 | /// - other pointers returned by this method, and | |
| 44 | 44 | /// - references returned from `deref()`, as long as there was no write. |
| 45 | 45 | 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; | |
| 46 | 53 | } |
| 47 | 54 | |
| 48 | 55 | /// Default `bytes` for `Allocation` is a `Box<u8>`. |
| ... | ... | @@ -62,6 +69,11 @@ impl AllocBytes for Box<[u8]> { |
| 62 | 69 | // Carefully avoiding any intermediate references. |
| 63 | 70 | ptr::addr_of_mut!(**self).cast() |
| 64 | 71 | } |
| 72 | ||
| 73 | fn as_ptr(&self) -> *const u8 { | |
| 74 | // Carefully avoiding any intermediate references. | |
| 75 | ptr::addr_of!(**self).cast() | |
| 76 | } | |
| 65 | 77 | } |
| 66 | 78 | |
| 67 | 79 | /// 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> |
| 490 | 502 | self.provenance.clear(range, cx)?; |
| 491 | 503 | |
| 492 | 504 | 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`. | |
| 494 | 506 | let begin_ptr = self.bytes.as_mut_ptr().wrapping_add(range.start.bytes_usize()); |
| 495 | 507 | let len = range.end().bytes_usize() - range.start.bytes_usize(); |
| 496 | 508 | Ok(ptr::slice_from_raw_parts_mut(begin_ptr, len)) |
| 497 | 509 | } |
| 498 | 510 | |
| 499 | 511 | /// 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 | |
| 501 | 513 | /// `OFFSET_IS_ADDR` is true. |
| 502 | 514 | pub fn get_bytes_unchecked_raw_mut(&mut self) -> *mut u8 { |
| 503 | 515 | assert!(Prov::OFFSET_IS_ADDR); |
| 504 | 516 | self.bytes.as_mut_ptr() |
| 505 | 517 | } |
| 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 | } | |
| 506 | 526 | } |
| 507 | 527 | |
| 508 | 528 | /// 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 = |
| 103 | 103 | .note = raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior |
| 104 | 104 | .label = dereference of raw pointer |
| 105 | 105 | |
| 106 | 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. | |
| 106 | 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 | |
| 107 | 107 | |
| 108 | 108 | mir_build_extern_static_requires_unsafe = |
| 109 | 109 | use of extern static is unsafe and requires unsafe block |
compiler/rustc_passes/messages.ftl+9-9| ... | ... | @@ -14,7 +14,7 @@ passes_abi_of = |
| 14 | 14 | fn_abi_of({$fn_name}) = {$fn_abi} |
| 15 | 15 | |
| 16 | 16 | passes_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 | |
| 18 | 18 | .label = the only currently supported targets are inherent methods |
| 19 | 19 | |
| 20 | 20 | passes_allow_internal_unstable = |
| ... | ... | @@ -253,8 +253,8 @@ passes_doc_test_unknown_spotlight = |
| 253 | 253 | .no_op_note = `doc(spotlight)` is now a no-op |
| 254 | 254 | |
| 255 | 255 | passes_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}` | |
| 258 | 258 | |
| 259 | 259 | passes_duplicate_feature_err = |
| 260 | 260 | the feature `{$feature}` has already been declared |
| ... | ... | @@ -263,27 +263,27 @@ passes_duplicate_lang_item = |
| 263 | 263 | found duplicate lang item `{$lang_item_name}` |
| 264 | 264 | .first_defined_span = the lang item is first defined here |
| 265 | 265 | .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}` | |
| 267 | 267 | .first_definition_local = first definition in the local crate (`{$orig_crate_name}`) |
| 268 | 268 | .second_definition_local = second definition in the local crate (`{$crate_name}`) |
| 269 | 269 | .first_definition_path = first definition in `{$orig_crate_name}` loaded from {$orig_path} |
| 270 | 270 | .second_definition_path = second definition in `{$crate_name}` loaded from {$path} |
| 271 | 271 | |
| 272 | 272 | passes_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}` | |
| 274 | 274 | .first_defined_span = the lang item is first defined here |
| 275 | 275 | .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}` | |
| 277 | 277 | .first_definition_local = first definition in the local crate (`{$orig_crate_name}`) |
| 278 | 278 | .second_definition_local = second definition in the local crate (`{$crate_name}`) |
| 279 | 279 | .first_definition_path = first definition in `{$orig_crate_name}` loaded from {$orig_path} |
| 280 | 280 | .second_definition_path = second definition in `{$crate_name}` loaded from {$path} |
| 281 | 281 | |
| 282 | 282 | passes_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}` | |
| 284 | 284 | .first_defined_span = the lang item is first defined here |
| 285 | 285 | .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}` | |
| 287 | 287 | .first_definition_local = first definition in the local crate (`{$orig_crate_name}`) |
| 288 | 288 | .second_definition_local = second definition in the local crate (`{$crate_name}`) |
| 289 | 289 | .first_definition_path = first definition in `{$orig_crate_name}` loaded from {$orig_path} |
| ... | ... | @@ -315,7 +315,7 @@ passes_ffi_pure_invalid_target = |
| 315 | 315 | `#[ffi_pure]` may only be used on foreign functions |
| 316 | 316 | |
| 317 | 317 | passes_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 | |
| 319 | 319 | .label = only adts, extern types and traits are supported |
| 320 | 320 | |
| 321 | 321 | passes_ignored_attr = |
compiler/rustc_resolve/messages.ftl+1-1| ... | ... | @@ -240,7 +240,7 @@ resolve_label_with_similar_name_reachable = |
| 240 | 240 | |
| 241 | 241 | resolve_lending_iterator_report_error = |
| 242 | 242 | 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 | |
| 244 | 244 | |
| 245 | 245 | resolve_lifetime_param_in_enum_discriminant = |
| 246 | 246 | 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 |
| 82 | 82 | |
| 83 | 83 | session_optimization_fuel_exhausted = optimization-fuel-exhausted: {$msg} |
| 84 | 84 | |
| 85 | session_profile_sample_use_file_does_not_exist = file `{$path}` passed to `-C profile-sample-use` does not exist. | |
| 85 | session_profile_sample_use_file_does_not_exist = file `{$path}` passed to `-C profile-sample-use` does not exist | |
| 86 | 86 | |
| 87 | session_profile_use_file_does_not_exist = file `{$path}` passed to `-C profile-use` does not exist. | |
| 87 | session_profile_use_file_does_not_exist = file `{$path}` passed to `-C profile-use` does not exist | |
| 88 | 88 | |
| 89 | 89 | session_sanitizer_cfi_canonical_jump_tables_requires_cfi = `-Zsanitizer-cfi-canonical-jump-tables` requires `-Zsanitizer=cfi` |
| 90 | 90 |
compiler/rustc_smir/src/rustc_smir/context.rs+7| ... | ... | @@ -533,6 +533,13 @@ impl<'tcx> Context for TablesWrapper<'tcx> { |
| 533 | 533 | Ok(tables.fn_abi_of_instance(instance, List::empty())?.stable(&mut *tables)) |
| 534 | 534 | } |
| 535 | 535 | |
| 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 | ||
| 536 | 543 | fn instance_def_id(&self, def: InstanceDef) -> stable_mir::DefId { |
| 537 | 544 | let mut tables = self.0.borrow_mut(); |
| 538 | 545 | let def_id = tables.instances[def].def_id(); |
compiler/rustc_span/src/symbol.rs+2| ... | ... | @@ -2054,6 +2054,8 @@ symbols! { |
| 2054 | 2054 | yes, |
| 2055 | 2055 | yield_expr, |
| 2056 | 2056 | ymm_reg, |
| 2057 | zfh, | |
| 2058 | zfhmin, | |
| 2057 | 2059 | zmm_reg, |
| 2058 | 2060 | } |
| 2059 | 2061 | } |
compiler/rustc_target/src/asm/riscv.rs+4-3| ... | ... | @@ -40,12 +40,13 @@ impl RiscVInlineAsmRegClass { |
| 40 | 40 | match self { |
| 41 | 41 | Self::reg => { |
| 42 | 42 | if arch == InlineAsmArch::RiscV64 { |
| 43 | types! { _: I8, I16, I32, I64, F32, F64; } | |
| 43 | types! { _: I8, I16, I32, I64, F16, F32, F64; } | |
| 44 | 44 | } else { |
| 45 | types! { _: I8, I16, I32, F32; } | |
| 45 | types! { _: I8, I16, I32, F16, F32; } | |
| 46 | 46 | } |
| 47 | 47 | } |
| 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; }, | |
| 49 | 50 | Self::vreg => &[], |
| 50 | 51 | } |
| 51 | 52 | } |
compiler/stable_mir/src/compiler_interface.rs+3| ... | ... | @@ -215,6 +215,9 @@ pub trait Context { |
| 215 | 215 | /// Get an instance ABI. |
| 216 | 216 | fn instance_abi(&self, def: InstanceDef) -> Result<FnAbi, Error>; |
| 217 | 217 | |
| 218 | /// Get the ABI of a function pointer. | |
| 219 | fn fn_ptr_abi(&self, fn_ptr: PolyFnSig) -> Result<FnAbi, Error>; | |
| 220 | ||
| 218 | 221 | /// Get the layout of a type. |
| 219 | 222 | fn ty_layout(&self, ty: Ty) -> Result<Layout, Error>; |
| 220 | 223 |
compiler/stable_mir/src/ty.rs+11-1| ... | ... | @@ -2,7 +2,7 @@ use super::{ |
| 2 | 2 | mir::{Body, Mutability, Safety}, |
| 3 | 3 | with, DefId, Error, Symbol, |
| 4 | 4 | }; |
| 5 | use crate::abi::Layout; | |
| 5 | use crate::abi::{FnAbi, Layout}; | |
| 6 | 6 | use crate::crate_def::{CrateDef, CrateDefType}; |
| 7 | 7 | use crate::mir::alloc::{read_target_int, read_target_uint, AllocId}; |
| 8 | 8 | use crate::mir::mono::StaticDef; |
| ... | ... | @@ -996,6 +996,16 @@ pub struct AliasTerm { |
| 996 | 996 | |
| 997 | 997 | pub type PolyFnSig = Binder<FnSig>; |
| 998 | 998 | |
| 999 | impl 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 | ||
| 999 | 1009 | #[derive(Clone, Debug, Eq, PartialEq)] |
| 1000 | 1010 | pub struct FnSig { |
| 1001 | 1011 | 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): |
| 112 | 112 | os.remove(tmp_file) |
| 113 | 113 | |
| 114 | 114 | |
| 115 | @dataclass(kw_only=True) | |
| 115 | @dataclass | |
| 116 | 116 | class TestEnvironment: |
| 117 | 117 | rust_build_dir: Path |
| 118 | 118 | sdk_dir: Path |
src/tools/miri/src/alloc_bytes.rs+4| ... | ... | @@ -108,4 +108,8 @@ impl AllocBytes for MiriAllocBytes { |
| 108 | 108 | fn as_mut_ptr(&mut self) -> *mut u8 { |
| 109 | 109 | self.ptr |
| 110 | 110 | } |
| 111 | ||
| 112 | fn as_ptr(&self) -> *const u8 { | |
| 113 | self.ptr | |
| 114 | } | |
| 111 | 115 | } |
src/tools/tidy/Cargo.toml+1| ... | ... | @@ -13,6 +13,7 @@ ignore = "0.4.18" |
| 13 | 13 | semver = "1.0" |
| 14 | 14 | termcolor = "1.1.3" |
| 15 | 15 | rustc-hash = "1.1.0" |
| 16 | fluent-syntax = "0.11.1" | |
| 16 | 17 | |
| 17 | 18 | [[bin]] |
| 18 | 19 | name = "rust-tidy" |
src/tools/tidy/src/allowed_run_make_makefiles.txt-3| ... | ... | @@ -14,7 +14,6 @@ run-make/compiler-lookup-paths-2/Makefile |
| 14 | 14 | run-make/compiler-lookup-paths/Makefile |
| 15 | 15 | run-make/compiler-rt-works-on-mingw/Makefile |
| 16 | 16 | run-make/crate-hash-rustc-version/Makefile |
| 17 | run-make/crate-name-priority/Makefile | |
| 18 | 17 | run-make/cross-lang-lto-clang/Makefile |
| 19 | 18 | run-make/cross-lang-lto-pgo-smoketest/Makefile |
| 20 | 19 | run-make/cross-lang-lto-upstream-rlibs/Makefile |
| ... | ... | @@ -31,7 +30,6 @@ run-make/emit-shared-files/Makefile |
| 31 | 30 | run-make/emit-stack-sizes/Makefile |
| 32 | 31 | run-make/emit-to-stdout/Makefile |
| 33 | 32 | run-make/env-dep-info/Makefile |
| 34 | run-make/error-writing-dependencies/Makefile | |
| 35 | 33 | run-make/export-executable-symbols/Makefile |
| 36 | 34 | run-make/extern-diff-internal-name/Makefile |
| 37 | 35 | run-make/extern-flag-disambiguates/Makefile |
| ... | ... | @@ -154,7 +152,6 @@ run-make/raw-dylib-inline-cross-dylib/Makefile |
| 154 | 152 | run-make/raw-dylib-link-ordinal/Makefile |
| 155 | 153 | run-make/raw-dylib-stdcall-ordinal/Makefile |
| 156 | 154 | run-make/redundant-libs/Makefile |
| 157 | run-make/relocation-model/Makefile | |
| 158 | 155 | run-make/relro-levels/Makefile |
| 159 | 156 | run-make/remap-path-prefix-dwarf/Makefile |
| 160 | 157 | run-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 | ||
| 3 | use fluent_syntax::ast::{Entry, PatternElement}; | |
| 4 | ||
| 5 | use crate::walk::{filter_dirs, walk}; | |
| 6 | use std::path::Path; | |
| 7 | ||
| 8 | fn 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. | |
| 15 | const 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 | ||
| 23 | fn 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`. | |
| 66 | fn 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 | ||
| 76 | pub 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; |
| 72 | 72 | pub mod extdeps; |
| 73 | 73 | pub mod features; |
| 74 | 74 | pub mod fluent_alphabetical; |
| 75 | pub mod fluent_period; | |
| 75 | 76 | mod fluent_used; |
| 76 | 77 | pub(crate) mod iter_header; |
| 77 | 78 | pub mod known_bug; |
src/tools/tidy/src/main.rs+1| ... | ... | @@ -115,6 +115,7 @@ fn main() { |
| 115 | 115 | // Checks that only make sense for the compiler. |
| 116 | 116 | check!(error_codes, &root_path, &[&compiler_path, &librustdoc_path], verbose); |
| 117 | 117 | check!(fluent_alphabetical, &compiler_path, bless); |
| 118 | check!(fluent_period, &compiler_path); | |
| 118 | 119 | check!(target_policy, &root_path); |
| 119 | 120 | |
| 120 | 121 | // 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 | |
| 2 | 2 | //@ assembly-output: emit-asm |
| 3 | ||
| 3 | 4 | //@[riscv64] compile-flags: --target riscv64imac-unknown-none-elf |
| 4 | 5 | //@[riscv64] needs-llvm-components: riscv |
| 6 | ||
| 5 | 7 | //@[riscv32] compile-flags: --target riscv32imac-unknown-none-elf |
| 6 | 8 | //@[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 | ||
| 7 | 29 | //@ compile-flags: -C target-feature=+d |
| 8 | 30 | |
| 9 | #![feature(no_core, lang_items, rustc_attrs)] | |
| 31 | #![feature(no_core, lang_items, rustc_attrs, f16)] | |
| 10 | 32 | #![crate_type = "rlib"] |
| 11 | 33 | #![no_core] |
| 12 | 34 | #![allow(asm_sub_register)] |
| ... | ... | @@ -33,6 +55,7 @@ type ptr = *mut u8; |
| 33 | 55 | |
| 34 | 56 | impl Copy for i8 {} |
| 35 | 57 | impl Copy for i16 {} |
| 58 | impl Copy for f16 {} | |
| 36 | 59 | impl Copy for i32 {} |
| 37 | 60 | impl Copy for f32 {} |
| 38 | 61 | impl Copy for i64 {} |
| ... | ... | @@ -103,6 +126,12 @@ macro_rules! check_reg { |
| 103 | 126 | // CHECK: #NO_APP |
| 104 | 127 | check!(reg_i8 i8 reg "mv"); |
| 105 | 128 | |
| 129 | // CHECK-LABEL: reg_f16: | |
| 130 | // CHECK: #APP | |
| 131 | // CHECK: mv {{[a-z0-9]+}}, {{[a-z0-9]+}} | |
| 132 | // CHECK: #NO_APP | |
| 133 | check!(reg_f16 f16 reg "mv"); | |
| 134 | ||
| 106 | 135 | // CHECK-LABEL: reg_i16: |
| 107 | 136 | // CHECK: #APP |
| 108 | 137 | // CHECK: mv {{[a-z0-9]+}}, {{[a-z0-9]+}} |
| ... | ... | @@ -141,6 +170,14 @@ check!(reg_f64 f64 reg "mv"); |
| 141 | 170 | // CHECK: #NO_APP |
| 142 | 171 | check!(reg_ptr ptr reg "mv"); |
| 143 | 172 | |
| 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 | |
| 179 | check!(freg_f16 f16 freg "fmv.s"); | |
| 180 | ||
| 144 | 181 | // CHECK-LABEL: freg_f32: |
| 145 | 182 | // CHECK: #APP |
| 146 | 183 | // CHECK: fmv.s f{{[a-z0-9]+}}, f{{[a-z0-9]+}} |
| ... | ... | @@ -165,6 +202,12 @@ check_reg!(a0_i8 i8 "a0" "mv"); |
| 165 | 202 | // CHECK: #NO_APP |
| 166 | 203 | check_reg!(a0_i16 i16 "a0" "mv"); |
| 167 | 204 | |
| 205 | // CHECK-LABEL: a0_f16: | |
| 206 | // CHECK: #APP | |
| 207 | // CHECK: mv a0, a0 | |
| 208 | // CHECK: #NO_APP | |
| 209 | check_reg!(a0_f16 f16 "a0" "mv"); | |
| 210 | ||
| 168 | 211 | // CHECK-LABEL: a0_i32: |
| 169 | 212 | // CHECK: #APP |
| 170 | 213 | // CHECK: mv a0, a0 |
| ... | ... | @@ -197,6 +240,14 @@ check_reg!(a0_f64 f64 "a0" "mv"); |
| 197 | 240 | // CHECK: #NO_APP |
| 198 | 241 | check_reg!(a0_ptr ptr "a0" "mv"); |
| 199 | 242 | |
| 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 | |
| 249 | check_reg!(fa0_f16 f16 "fa0" "fmv.s"); | |
| 250 | ||
| 200 | 251 | // CHECK-LABEL: fa0_f32: |
| 201 | 252 | // CHECK: #APP |
| 202 | 253 | // CHECK: fmv.s fa0, fa0 |
tests/run-make/crate-name-priority/Makefile deleted-12| ... | ... | @@ -1,12 +0,0 @@ |
| 1 | # ignore-cross-compile | |
| 2 | include ../tools.mk | |
| 3 | ||
| 4 | all: | |
| 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 | ||
| 7 | use run_make_support::{bin_name, fs_wrapper, rustc}; | |
| 8 | ||
| 9 | fn 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 @@ |
| 1 | include ../tools.mk | |
| 2 | ||
| 3 | all: | |
| 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 | ||
| 6 | use 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 | ||
| 11 | fn 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 | |
| 2 | include ../tools.mk | |
| 3 | ||
| 4 | all: 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 | ||
| 13 | ifdef IS_MSVC | |
| 14 | # FIXME(#28026) | |
| 15 | others: | |
| 16 | else | |
| 17 | others: | |
| 18 | 	$(RUSTC) -C relocation-model=static foo.rs | |
| 19 | 	$(call RUN,foo) | |
| 20 | endif |
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 | ||
| 9 | use run_make_support::{run, rustc}; | |
| 10 | ||
| 11 | fn 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<()> { |
| 54 | 54 | let variadic_fn = *get_item(&items, (ItemKind::Fn, "variadic_fn")).unwrap(); |
| 55 | 55 | check_variadic(variadic_fn); |
| 56 | 56 | |
| 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 | ||
| 57 | 72 | ControlFlow::Continue(()) |
| 58 | 73 | } |
| 59 | 74 | |
| ... | ... | @@ -164,6 +179,14 @@ fn generate_input(path: &str) -> std::io::Result<()> { |
| 164 | 179 | pub unsafe extern "C" fn variadic_fn(n: usize, mut args: ...) -> usize {{ |
| 165 | 180 | 0 |
| 166 | 181 | }} |
| 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 | }} | |
| 167 | 190 | "# |
| 168 | 191 | )?; |
| 169 | 192 | Ok(()) |
tests/ui/abi/abi-typo-unstable.stderr+1-1| ... | ... | @@ -4,7 +4,7 @@ error[E0703]: invalid ABI: found `rust-intrinsec` |
| 4 | 4 | LL | extern "rust-intrinsec" fn rust_intrinsic() {} |
| 5 | 5 | | ^^^^^^^^^^^^^^^^ invalid ABI |
| 6 | 6 | | |
| 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 | |
| 8 | 8 | |
| 9 | 9 | error: aborting due to 1 previous error |
| 10 | 10 |
tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr+2-2| ... | ... | @@ -7,7 +7,7 @@ LL | extern "riscv-interrupt" fn isr() {} |
| 7 | 7 | | invalid ABI |
| 8 | 8 | | help: did you mean: `"riscv-interrupt-m"` |
| 9 | 9 | | |
| 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 | |
| 11 | 11 | = note: please use one of riscv-interrupt-m or riscv-interrupt-s for machine- or supervisor-level interrupts, respectively |
| 12 | 12 | |
| 13 | 13 | error[E0703]: invalid ABI: found `riscv-interrupt-u` |
| ... | ... | @@ -19,7 +19,7 @@ LL | extern "riscv-interrupt-u" fn isr_U() {} |
| 19 | 19 | | invalid ABI |
| 20 | 20 | | help: did you mean: `"riscv-interrupt-m"` |
| 21 | 21 | | |
| 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 | |
| 23 | 23 | = note: user-mode interrupt handlers have been removed from LLVM pending standardization, see: https://reviews.llvm.org/D149314 |
| 24 | 24 | |
| 25 | 25 | error: 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() {} |
| 7 | 7 | | invalid ABI |
| 8 | 8 | | help: did you mean: `"riscv-interrupt-m"` |
| 9 | 9 | | |
| 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 | |
| 11 | 11 | = note: please use one of riscv-interrupt-m or riscv-interrupt-s for machine- or supervisor-level interrupts, respectively |
| 12 | 12 | |
| 13 | 13 | error[E0703]: invalid ABI: found `riscv-interrupt-u` |
| ... | ... | @@ -19,7 +19,7 @@ LL | extern "riscv-interrupt-u" fn isr_U() {} |
| 19 | 19 | | invalid ABI |
| 20 | 20 | | help: did you mean: `"riscv-interrupt-m"` |
| 21 | 21 | | |
| 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 | |
| 23 | 23 | = note: user-mode interrupt handlers have been removed from LLVM pending standardization, see: https://reviews.llvm.org/D149314 |
| 24 | 24 | |
| 25 | 25 | error: aborting due to 2 previous errors |
tests/ui/codemap_tests/unicode.normal.stderr+1-1| ... | ... | @@ -4,7 +4,7 @@ error[E0703]: invalid ABI: found `路濫狼á́́` |
| 4 | 4 | LL | extern "路濫狼á́́" fn foo() {} |
| 5 | 5 | | ^^^^^^^^^ invalid ABI |
| 6 | 6 | | |
| 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 | |
| 8 | 8 | |
| 9 | 9 | error: aborting due to 1 previous error |
| 10 | 10 |
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 |
| 2 | 2 | --> $DIR/E0116.rs:1:1 |
| 3 | 3 | | |
| 4 | 4 | LL | impl Vec<u8> {} |
| 5 | | ^^^^^^^^^^^^ impl for type defined outside of crate. | |
| 5 | | ^^^^^^^^^^^^ impl for type defined outside of crate | |
| 6 | 6 | | |
| 7 | 7 | = note: define and implement a trait or new type instead |
| 8 | 8 |
tests/ui/error-codes/E0519.stderr+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | 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. | |
| 1 | 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 | |
| 2 | 2 | --> $DIR/E0519.rs:8:1 |
| 3 | 3 | | |
| 4 | 4 | LL | extern crate crateresolve1; |
tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr+2-2| ... | ... | @@ -186,7 +186,7 @@ warning: unknown lint: `x5100` |
| 186 | 186 | LL | #[deny(x5100)] impl S { } |
| 187 | 187 | | ^^^^^ |
| 188 | 188 | |
| 189 | warning: use of deprecated attribute `crate_id`: no longer used. | |
| 189 | warning: use of deprecated attribute `crate_id`: no longer used | |
| 190 | 190 | --> $DIR/issue-43106-gating-of-builtin-attrs.rs:84:1 |
| 191 | 191 | | |
| 192 | 192 | LL | #![crate_id = "10"] |
| ... | ... | @@ -194,7 +194,7 @@ LL | #![crate_id = "10"] |
| 194 | 194 | | |
| 195 | 195 | = note: `#[warn(deprecated)]` on by default |
| 196 | 196 | |
| 197 | warning: use of deprecated attribute `no_start`: no longer used. | |
| 197 | warning: use of deprecated attribute `no_start`: no longer used | |
| 198 | 198 | --> $DIR/issue-43106-gating-of-builtin-attrs.rs:94:1 |
| 199 | 199 | | |
| 200 | 200 | LL | #![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 |
| 2 | 2 | --> $DIR/no-attr-empty-impl.rs:4:1 |
| 3 | 3 | | |
| 4 | 4 | LL | impl extern_crate::StructWithAttr {} |
| 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. | |
| 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate | |
| 6 | 6 | | |
| 7 | 7 | = note: define and implement a trait or new type instead |
| 8 | 8 | |
| ... | ... | @@ -10,7 +10,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher |
| 10 | 10 | --> $DIR/no-attr-empty-impl.rs:7:1 |
| 11 | 11 | | |
| 12 | 12 | LL | impl extern_crate::StructNoAttr {} |
| 13 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. | |
| 13 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate | |
| 14 | 14 | | |
| 15 | 15 | = note: define and implement a trait or new type instead |
| 16 | 16 | |
| ... | ... | @@ -18,7 +18,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher |
| 18 | 18 | --> $DIR/no-attr-empty-impl.rs:10:1 |
| 19 | 19 | | |
| 20 | 20 | LL | impl extern_crate::EnumWithAttr {} |
| 21 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. | |
| 21 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate | |
| 22 | 22 | | |
| 23 | 23 | = note: define and implement a trait or new type instead |
| 24 | 24 | |
| ... | ... | @@ -26,7 +26,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher |
| 26 | 26 | --> $DIR/no-attr-empty-impl.rs:13:1 |
| 27 | 27 | | |
| 28 | 28 | LL | impl extern_crate::EnumNoAttr {} |
| 29 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. | |
| 29 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate | |
| 30 | 30 | | |
| 31 | 31 | = note: define and implement a trait or new type instead |
| 32 | 32 |
tests/ui/instrument-coverage/mcdc-condition-limit.bad.stderr+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | warning: Number of conditions in decision (7) exceeds limit (6). MC/DC analysis will not count this expression. | |
| 1 | warning: number of conditions in decision (7) exceeds limit (6), so MC/DC analysis will not count this expression | |
| 2 | 2 | --> $DIR/mcdc-condition-limit.rs:29:8 |
| 3 | 3 | | |
| 4 | 4 | LL | if a && b && c && d && e && f && g { |
tests/ui/instrument-coverage/mcdc-condition-limit.rs+1-1| ... | ... | @@ -26,7 +26,7 @@ fn main() { |
| 26 | 26 | fn main() { |
| 27 | 27 | // 7 conditions is too many, so issue a diagnostic. |
| 28 | 28 | 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 | |
| 30 | 30 | core::hint::black_box("hello"); |
| 31 | 31 | } |
| 32 | 32 | } |
tests/ui/lifetimes/no_lending_iterators.stderr+1-1| ... | ... | @@ -4,7 +4,7 @@ error: associated type `Iterator::Item` is declared without lifetime parameters, |
| 4 | 4 | LL | type Item = &str; |
| 5 | 5 | | ^ |
| 6 | 6 | | |
| 7 | 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. | |
| 7 | 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 | |
| 8 | 8 | --> $DIR/no_lending_iterators.rs:3:19 |
| 9 | 9 | | |
| 10 | 10 | LL | 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 |
| 154 | 154 | LL | fn assoc_fn() { discriminant::<i32>(&123); } |
| 155 | 155 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 156 | 156 | | |
| 157 | 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. | |
| 157 | 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 | |
| 158 | 158 | --> $DIR/lint-attr-everywhere-late.rs:96:41 |
| 159 | 159 | | |
| 160 | 160 | LL | fn assoc_fn() { discriminant::<i32>(&123); } |
| ... | ... | @@ -208,7 +208,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a |
| 208 | 208 | LL | let _ = discriminant::<i32>(&123); |
| 209 | 209 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 210 | 210 | | |
| 211 | 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. | |
| 211 | 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 | |
| 212 | 212 | --> $DIR/lint-attr-everywhere-late.rs:139:33 |
| 213 | 213 | | |
| 214 | 214 | LL | let _ = discriminant::<i32>(&123); |
| ... | ... | @@ -237,7 +237,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a |
| 237 | 237 | LL | discriminant::<i32>(&123); |
| 238 | 238 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 239 | 239 | | |
| 240 | 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. | |
| 240 | 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 | |
| 241 | 241 | --> $DIR/lint-attr-everywhere-late.rs:155:33 |
| 242 | 242 | | |
| 243 | 243 | LL | discriminant::<i32>(&123); |
| ... | ... | @@ -254,7 +254,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a |
| 254 | 254 | LL | discriminant::<i32>(&123); |
| 255 | 255 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 256 | 256 | | |
| 257 | 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. | |
| 257 | 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 | |
| 258 | 258 | --> $DIR/lint-attr-everywhere-late.rs:161:33 |
| 259 | 259 | | |
| 260 | 260 | LL | discriminant::<i32>(&123); |
| ... | ... | @@ -283,7 +283,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a |
| 283 | 283 | LL | discriminant::<i32>(&123); |
| 284 | 284 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 285 | 285 | | |
| 286 | 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. | |
| 286 | 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 | |
| 287 | 287 | --> $DIR/lint-attr-everywhere-late.rs:173:29 |
| 288 | 288 | | |
| 289 | 289 | LL | discriminant::<i32>(&123); |
| ... | ... | @@ -300,7 +300,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a |
| 300 | 300 | LL | discriminant::<i32>(&123); |
| 301 | 301 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 302 | 302 | | |
| 303 | 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. | |
| 303 | 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 | |
| 304 | 304 | --> $DIR/lint-attr-everywhere-late.rs:177:29 |
| 305 | 305 | | |
| 306 | 306 | LL | discriminant::<i32>(&123); |
| ... | ... | @@ -317,7 +317,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a |
| 317 | 317 | LL | discriminant::<i32>(&123); |
| 318 | 318 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 319 | 319 | | |
| 320 | 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. | |
| 320 | 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 | |
| 321 | 321 | --> $DIR/lint-attr-everywhere-late.rs:182:25 |
| 322 | 322 | | |
| 323 | 323 | LL | discriminant::<i32>(&123); |
| ... | ... | @@ -334,7 +334,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a |
| 334 | 334 | LL | [#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123)]; |
| 335 | 335 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 336 | 336 | | |
| 337 | 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. | |
| 337 | 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 | |
| 338 | 338 | --> $DIR/lint-attr-everywhere-late.rs:184:61 |
| 339 | 339 | | |
| 340 | 340 | LL | [#[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 |
| 351 | 351 | LL | (#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123),); |
| 352 | 352 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 353 | 353 | | |
| 354 | 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. | |
| 354 | 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 | |
| 355 | 355 | --> $DIR/lint-attr-everywhere-late.rs:185:61 |
| 356 | 356 | | |
| 357 | 357 | LL | (#[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 |
| 368 | 368 | LL | call(#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123)); |
| 369 | 369 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 370 | 370 | | |
| 371 | 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. | |
| 371 | 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 | |
| 372 | 372 | --> $DIR/lint-attr-everywhere-late.rs:187:65 |
| 373 | 373 | | |
| 374 | 374 | LL | 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 |
| 385 | 385 | LL | TupleStruct(#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123)); |
| 386 | 386 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 387 | 387 | | |
| 388 | 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. | |
| 388 | 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 | |
| 389 | 389 | --> $DIR/lint-attr-everywhere-late.rs:189:72 |
| 390 | 390 | | |
| 391 | 391 | LL | 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 |
| 4 | 4 | LL | discriminant(&()); |
| 5 | 5 | | ^^^^^^^^^^^^^^^^^ |
| 6 | 6 | | |
| 7 | 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. | |
| 7 | 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 | |
| 8 | 8 | --> $DIR/lint-enum-intrinsics-non-enums.rs:26:18 |
| 9 | 9 | | |
| 10 | 10 | LL | discriminant(&()); |
| ... | ... | @@ -17,7 +17,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a |
| 17 | 17 | LL | discriminant(&&SomeEnum::B); |
| 18 | 18 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 19 | 19 | | |
| 20 | 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. | |
| 20 | 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 | |
| 21 | 21 | --> $DIR/lint-enum-intrinsics-non-enums.rs:29:18 |
| 22 | 22 | | |
| 23 | 23 | LL | discriminant(&&SomeEnum::B); |
| ... | ... | @@ -29,7 +29,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a |
| 29 | 29 | LL | discriminant(&SomeStruct); |
| 30 | 30 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 31 | 31 | | |
| 32 | 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. | |
| 32 | 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 | |
| 33 | 33 | --> $DIR/lint-enum-intrinsics-non-enums.rs:32:18 |
| 34 | 34 | | |
| 35 | 35 | LL | discriminant(&SomeStruct); |
| ... | ... | @@ -41,7 +41,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a |
| 41 | 41 | LL | discriminant(&123u32); |
| 42 | 42 | | ^^^^^^^^^^^^^^^^^^^^^ |
| 43 | 43 | | |
| 44 | 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. | |
| 44 | 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 | |
| 45 | 45 | --> $DIR/lint-enum-intrinsics-non-enums.rs:35:18 |
| 46 | 46 | | |
| 47 | 47 | LL | discriminant(&123u32); |
| ... | ... | @@ -53,7 +53,7 @@ error: the return value of `mem::discriminant` is unspecified when called with a |
| 53 | 53 | LL | discriminant(&&123i8); |
| 54 | 54 | | ^^^^^^^^^^^^^^^^^^^^^ |
| 55 | 55 | | |
| 56 | 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. | |
| 56 | 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 | |
| 57 | 57 | --> $DIR/lint-enum-intrinsics-non-enums.rs:38:18 |
| 58 | 58 | | |
| 59 | 59 | LL | discriminant(&&123i8); |
| ... | ... | @@ -65,7 +65,7 @@ error: the return value of `mem::variant_count` is unspecified when called with |
| 65 | 65 | LL | variant_count::<&str>(); |
| 66 | 66 | | ^^^^^^^^^^^^^^^^^^^^^^^ |
| 67 | 67 | | |
| 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 | |
| 69 | 69 | |
| 70 | 70 | error: the return value of `mem::variant_count` is unspecified when called with a non-enum type |
| 71 | 71 | --> $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 |
| 73 | 73 | LL | variant_count::<*const u8>(); |
| 74 | 74 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 75 | 75 | | |
| 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 | |
| 77 | 77 | |
| 78 | 78 | error: the return value of `mem::variant_count` is unspecified when called with a non-enum type |
| 79 | 79 | --> $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 |
| 81 | 81 | LL | variant_count::<()>(); |
| 82 | 82 | | ^^^^^^^^^^^^^^^^^^^^^ |
| 83 | 83 | | |
| 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 | |
| 85 | 85 | |
| 86 | 86 | error: the return value of `mem::variant_count` is unspecified when called with a non-enum type |
| 87 | 87 | --> $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 |
| 89 | 89 | LL | variant_count::<&SomeEnum>(); |
| 90 | 90 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 91 | 91 | | |
| 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 | |
| 93 | 93 | |
| 94 | 94 | error: aborting due to 9 previous errors |
| 95 | 95 |
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 |
| 4 | 4 | LL | fn foo(_: &dyn Foo<Bar = ()>) {} |
| 5 | 5 | | ^^^^^^^^ help: remove this bound |
| 6 | 6 | | |
| 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` | |
| 8 | 8 | = note: `#[warn(unused_associated_type_bounds)]` on by default |
| 9 | 9 | |
| 10 | 10 | warning: 1 warning emitted |
tests/ui/parser/issues/issue-8537.stderr+1-1| ... | ... | @@ -4,7 +4,7 @@ error[E0703]: invalid ABI: found `invalid-ab_isize` |
| 4 | 4 | LL | "invalid-ab_isize" |
| 5 | 5 | | ^^^^^^^^^^^^^^^^^^ invalid ABI |
| 6 | 6 | | |
| 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 | |
| 8 | 8 | |
| 9 | 9 | error: aborting due to 1 previous error |
| 10 | 10 |
tests/ui/suggestions/abi-typo.stderr+1-1| ... | ... | @@ -7,7 +7,7 @@ LL | extern "cdedl" fn cdedl() {} |
| 7 | 7 | | invalid ABI |
| 8 | 8 | | help: did you mean: `"cdecl"` |
| 9 | 9 | | |
| 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 | |
| 11 | 11 | |
| 12 | 12 | error: aborting due to 1 previous error |
| 13 | 13 |
tests/ui/tool-attributes/duplicate-diagnostic.stderr+4-4| ... | ... | @@ -1,14 +1,14 @@ |
| 1 | error: duplicate diagnostic item in crate `p2`: `Foo`. | |
| 1 | error: duplicate diagnostic item in crate `p2`: `Foo` | |
| 2 | 2 | | |
| 3 | = note: the diagnostic item is first defined in crate `p1`. | |
| 3 | = note: the diagnostic item is first defined in crate `p1` | |
| 4 | 4 | |
| 5 | error: duplicate diagnostic item in crate `duplicate_diagnostic`: `Foo`. | |
| 5 | error: duplicate diagnostic item in crate `duplicate_diagnostic`: `Foo` | |
| 6 | 6 | --> $DIR/duplicate-diagnostic.rs:12:1 |
| 7 | 7 | | |
| 8 | 8 | LL | pub struct Foo {} |
| 9 | 9 | | ^^^^^^^^^^^^^^ |
| 10 | 10 | | |
| 11 | = note: the diagnostic item is first defined in crate `p2`. | |
| 11 | = note: the diagnostic item is first defined in crate `p2` | |
| 12 | 12 | |
| 13 | 13 | error: aborting due to 2 previous errors |
| 14 | 14 |
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 |
| 2 | 2 | --> $DIR/trait-or-new-type-instead.rs:1:1 |
| 3 | 3 | | |
| 4 | 4 | LL | impl<T> Option<T> { |
| 5 | | ^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. | |
| 5 | | ^^^^^^^^^^^^^^^^^ impl for type defined outside of crate | |
| 6 | 6 | | |
| 7 | 7 | = note: define and implement a trait or new type instead |
| 8 | 8 |