| author | bors <bors@rust-lang.org> 2025-08-08 20:53:33 UTC |
| committer | bors <bors@rust-lang.org> 2025-08-08 20:53:33 UTC |
| log | ffb9d94dcf4ade0d534842be3672d5e9f47e1333 |
| tree | fae25695be80c3e9e2f78b7e084763d52fe0462a |
| parent | de3efa79f95852c7427587f1d535bfea7c0d6779 |
| parent | 660bf919dc5dec96d319cce59702b0355bd8452c |
Rollup of 8 pull requests
Successful merges:
- rust-lang/rust#139451 (Add `target_env = "macabi"` and `target_env = "sim"`)
- rust-lang/rust#144039 (Use `tcx.short_string()` in more diagnostics)
- rust-lang/rust#144192 (atomicrmw on pointers: move integer-pointer cast hacks into backend)
- rust-lang/rust#144545 (In rustc_pattern_analysis, put `true` witnesses before `false` witnesses)
- rust-lang/rust#144579 (Implement declarative (`macro_rules!`) attribute macros (RFC 3697))
- rust-lang/rust#144649 (Account for bare tuples and `Pin` methods in field searching logic)
- rust-lang/rust#144775 (more strongly dissuade use of `skip_binder`)
- rust-lang/rust#144987 (Enable f16 and f128 on targets that were fixed in LLVM21)
r? `@ghost`
`@rustbot` modify labels: rollup179 files changed, 1734 insertions(+), 791 deletions(-)
compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs+12-12| ... | ... | @@ -969,7 +969,7 @@ fn codegen_regular_intrinsic_call<'tcx>( |
| 969 | 969 | |
| 970 | 970 | let layout = amount.layout(); |
| 971 | 971 | match layout.ty.kind() { |
| 972 | ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {} | |
| 972 | ty::Uint(_) | ty::Int(_) => {} | |
| 973 | 973 | _ => { |
| 974 | 974 | report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty); |
| 975 | 975 | return Ok(()); |
| ... | ... | @@ -982,7 +982,7 @@ fn codegen_regular_intrinsic_call<'tcx>( |
| 982 | 982 | let old = |
| 983 | 983 | fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Add, ptr, amount); |
| 984 | 984 | |
| 985 | let old = CValue::by_val(old, layout); | |
| 985 | let old = CValue::by_val(old, ret.layout()); | |
| 986 | 986 | ret.write_cvalue(fx, old); |
| 987 | 987 | } |
| 988 | 988 | sym::atomic_xsub => { |
| ... | ... | @@ -991,7 +991,7 @@ fn codegen_regular_intrinsic_call<'tcx>( |
| 991 | 991 | |
| 992 | 992 | let layout = amount.layout(); |
| 993 | 993 | match layout.ty.kind() { |
| 994 | ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {} | |
| 994 | ty::Uint(_) | ty::Int(_) => {} | |
| 995 | 995 | _ => { |
| 996 | 996 | report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty); |
| 997 | 997 | return Ok(()); |
| ... | ... | @@ -1004,7 +1004,7 @@ fn codegen_regular_intrinsic_call<'tcx>( |
| 1004 | 1004 | let old = |
| 1005 | 1005 | fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Sub, ptr, amount); |
| 1006 | 1006 | |
| 1007 | let old = CValue::by_val(old, layout); | |
| 1007 | let old = CValue::by_val(old, ret.layout()); | |
| 1008 | 1008 | ret.write_cvalue(fx, old); |
| 1009 | 1009 | } |
| 1010 | 1010 | sym::atomic_and => { |
| ... | ... | @@ -1013,7 +1013,7 @@ fn codegen_regular_intrinsic_call<'tcx>( |
| 1013 | 1013 | |
| 1014 | 1014 | let layout = src.layout(); |
| 1015 | 1015 | match layout.ty.kind() { |
| 1016 | ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {} | |
| 1016 | ty::Uint(_) | ty::Int(_) => {} | |
| 1017 | 1017 | _ => { |
| 1018 | 1018 | report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty); |
| 1019 | 1019 | return Ok(()); |
| ... | ... | @@ -1025,7 +1025,7 @@ fn codegen_regular_intrinsic_call<'tcx>( |
| 1025 | 1025 | |
| 1026 | 1026 | let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::And, ptr, src); |
| 1027 | 1027 | |
| 1028 | let old = CValue::by_val(old, layout); | |
| 1028 | let old = CValue::by_val(old, ret.layout()); | |
| 1029 | 1029 | ret.write_cvalue(fx, old); |
| 1030 | 1030 | } |
| 1031 | 1031 | sym::atomic_or => { |
| ... | ... | @@ -1034,7 +1034,7 @@ fn codegen_regular_intrinsic_call<'tcx>( |
| 1034 | 1034 | |
| 1035 | 1035 | let layout = src.layout(); |
| 1036 | 1036 | match layout.ty.kind() { |
| 1037 | ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {} | |
| 1037 | ty::Uint(_) | ty::Int(_) => {} | |
| 1038 | 1038 | _ => { |
| 1039 | 1039 | report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty); |
| 1040 | 1040 | return Ok(()); |
| ... | ... | @@ -1046,7 +1046,7 @@ fn codegen_regular_intrinsic_call<'tcx>( |
| 1046 | 1046 | |
| 1047 | 1047 | let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Or, ptr, src); |
| 1048 | 1048 | |
| 1049 | let old = CValue::by_val(old, layout); | |
| 1049 | let old = CValue::by_val(old, ret.layout()); | |
| 1050 | 1050 | ret.write_cvalue(fx, old); |
| 1051 | 1051 | } |
| 1052 | 1052 | sym::atomic_xor => { |
| ... | ... | @@ -1055,7 +1055,7 @@ fn codegen_regular_intrinsic_call<'tcx>( |
| 1055 | 1055 | |
| 1056 | 1056 | let layout = src.layout(); |
| 1057 | 1057 | match layout.ty.kind() { |
| 1058 | ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {} | |
| 1058 | ty::Uint(_) | ty::Int(_) => {} | |
| 1059 | 1059 | _ => { |
| 1060 | 1060 | report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty); |
| 1061 | 1061 | return Ok(()); |
| ... | ... | @@ -1067,7 +1067,7 @@ fn codegen_regular_intrinsic_call<'tcx>( |
| 1067 | 1067 | |
| 1068 | 1068 | let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Xor, ptr, src); |
| 1069 | 1069 | |
| 1070 | let old = CValue::by_val(old, layout); | |
| 1070 | let old = CValue::by_val(old, ret.layout()); | |
| 1071 | 1071 | ret.write_cvalue(fx, old); |
| 1072 | 1072 | } |
| 1073 | 1073 | sym::atomic_nand => { |
| ... | ... | @@ -1076,7 +1076,7 @@ fn codegen_regular_intrinsic_call<'tcx>( |
| 1076 | 1076 | |
| 1077 | 1077 | let layout = src.layout(); |
| 1078 | 1078 | match layout.ty.kind() { |
| 1079 | ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {} | |
| 1079 | ty::Uint(_) | ty::Int(_) => {} | |
| 1080 | 1080 | _ => { |
| 1081 | 1081 | report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty); |
| 1082 | 1082 | return Ok(()); |
| ... | ... | @@ -1088,7 +1088,7 @@ fn codegen_regular_intrinsic_call<'tcx>( |
| 1088 | 1088 | |
| 1089 | 1089 | let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Nand, ptr, src); |
| 1090 | 1090 | |
| 1091 | let old = CValue::by_val(old, layout); | |
| 1091 | let old = CValue::by_val(old, ret.layout()); | |
| 1092 | 1092 | ret.write_cvalue(fx, old); |
| 1093 | 1093 | } |
| 1094 | 1094 | sym::atomic_max => { |
compiler/rustc_codegen_gcc/src/builder.rs+6-1| ... | ... | @@ -1671,6 +1671,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { |
| 1671 | 1671 | dst: RValue<'gcc>, |
| 1672 | 1672 | src: RValue<'gcc>, |
| 1673 | 1673 | order: AtomicOrdering, |
| 1674 | ret_ptr: bool, | |
| 1674 | 1675 | ) -> RValue<'gcc> { |
| 1675 | 1676 | let size = get_maybe_pointer_size(src); |
| 1676 | 1677 | let name = match op { |
| ... | ... | @@ -1698,6 +1699,9 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { |
| 1698 | 1699 | let atomic_function = self.context.get_builtin_function(name); |
| 1699 | 1700 | let order = self.context.new_rvalue_from_int(self.i32_type, order.to_gcc()); |
| 1700 | 1701 | |
| 1702 | // FIXME: If `ret_ptr` is true and `src` is an integer, we should really tell GCC | |
| 1703 | // that this is a pointer operation that needs to preserve provenance -- but like LLVM, | |
| 1704 | // GCC does not currently seems to support that. | |
| 1701 | 1705 | let void_ptr_type = self.context.new_type::<*mut ()>(); |
| 1702 | 1706 | let volatile_void_ptr_type = void_ptr_type.make_volatile(); |
| 1703 | 1707 | let dst = self.context.new_cast(self.location, dst, volatile_void_ptr_type); |
| ... | ... | @@ -1705,7 +1709,8 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { |
| 1705 | 1709 | let new_src_type = atomic_function.get_param(1).to_rvalue().get_type(); |
| 1706 | 1710 | let src = self.context.new_bitcast(self.location, src, new_src_type); |
| 1707 | 1711 | let res = self.context.new_call(self.location, atomic_function, &[dst, src, order]); |
| 1708 | self.context.new_cast(self.location, res, src.get_type()) | |
| 1712 | let res_type = if ret_ptr { void_ptr_type } else { src.get_type() }; | |
| 1713 | self.context.new_cast(self.location, res, res_type) | |
| 1709 | 1714 | } |
| 1710 | 1715 | |
| 1711 | 1716 | fn atomic_fence(&mut self, order: AtomicOrdering, scope: SynchronizationScope) { |
compiler/rustc_codegen_llvm/src/builder.rs+6-8| ... | ... | @@ -1327,15 +1327,13 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { |
| 1327 | 1327 | &mut self, |
| 1328 | 1328 | op: rustc_codegen_ssa::common::AtomicRmwBinOp, |
| 1329 | 1329 | dst: &'ll Value, |
| 1330 | mut src: &'ll Value, | |
| 1330 | src: &'ll Value, | |
| 1331 | 1331 | order: rustc_middle::ty::AtomicOrdering, |
| 1332 | ret_ptr: bool, | |
| 1332 | 1333 | ) -> &'ll Value { |
| 1333 | // The only RMW operation that LLVM supports on pointers is compare-exchange. | |
| 1334 | let requires_cast_to_int = self.val_ty(src) == self.type_ptr() | |
| 1335 | && op != rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXchg; | |
| 1336 | if requires_cast_to_int { | |
| 1337 | src = self.ptrtoint(src, self.type_isize()); | |
| 1338 | } | |
| 1334 | // FIXME: If `ret_ptr` is true and `src` is not a pointer, we *should* tell LLVM that the | |
| 1335 | // LHS is a pointer and the operation should be provenance-preserving, but LLVM does not | |
| 1336 | // currently support that (https://github.com/llvm/llvm-project/issues/120837). | |
| 1339 | 1337 | let mut res = unsafe { |
| 1340 | 1338 | llvm::LLVMBuildAtomicRMW( |
| 1341 | 1339 | self.llbuilder, |
| ... | ... | @@ -1346,7 +1344,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { |
| 1346 | 1344 | llvm::False, // SingleThreaded |
| 1347 | 1345 | ) |
| 1348 | 1346 | }; |
| 1349 | if requires_cast_to_int { | |
| 1347 | if ret_ptr && self.val_ty(res) != self.type_ptr() { | |
| 1350 | 1348 | res = self.inttoptr(res, self.type_ptr()); |
| 1351 | 1349 | } |
| 1352 | 1350 | res |
compiler/rustc_codegen_llvm/src/llvm_util.rs+13-11| ... | ... | @@ -377,24 +377,25 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) { |
| 377 | 377 | let target_abi = sess.target.options.abi.as_ref(); |
| 378 | 378 | let target_pointer_width = sess.target.pointer_width; |
| 379 | 379 | let version = get_version(); |
| 380 | let lt_20_1_1 = version < (20, 1, 1); | |
| 381 | let lt_21_0_0 = version < (21, 0, 0); | |
| 380 | 382 | |
| 381 | 383 | cfg.has_reliable_f16 = match (target_arch, target_os) { |
| 382 | // Selection failure <https://github.com/llvm/llvm-project/issues/50374> | |
| 383 | ("s390x", _) => false, | |
| 384 | // LLVM crash without neon <https://github.com/llvm/llvm-project/issues/129394> (now fixed) | |
| 384 | // LLVM crash without neon <https://github.com/llvm/llvm-project/issues/129394> (fixed in llvm20) | |
| 385 | 385 | ("aarch64", _) |
| 386 | if !cfg.target_features.iter().any(|f| f.as_str() == "neon") | |
| 387 | && version < (20, 1, 1) => | |
| 386 | if !cfg.target_features.iter().any(|f| f.as_str() == "neon") && lt_20_1_1 => | |
| 388 | 387 | { |
| 389 | 388 | false |
| 390 | 389 | } |
| 391 | 390 | // Unsupported <https://github.com/llvm/llvm-project/issues/94434> |
| 392 | 391 | ("arm64ec", _) => false, |
| 392 | // Selection failure <https://github.com/llvm/llvm-project/issues/50374> (fixed in llvm21) | |
| 393 | ("s390x", _) if lt_21_0_0 => false, | |
| 393 | 394 | // MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054> |
| 394 | 395 | ("x86_64", "windows") if target_env == "gnu" && target_abi != "llvm" => false, |
| 395 | 396 | // Infinite recursion <https://github.com/llvm/llvm-project/issues/97981> |
| 396 | 397 | ("csky", _) => false, |
| 397 | ("hexagon", _) => false, | |
| 398 | ("hexagon", _) if lt_21_0_0 => false, // (fixed in llvm21) | |
| 398 | 399 | ("powerpc" | "powerpc64", _) => false, |
| 399 | 400 | ("sparc" | "sparc64", _) => false, |
| 400 | 401 | ("wasm32" | "wasm64", _) => false, |
| ... | ... | @@ -407,9 +408,10 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) { |
| 407 | 408 | cfg.has_reliable_f128 = match (target_arch, target_os) { |
| 408 | 409 | // Unsupported <https://github.com/llvm/llvm-project/issues/94434> |
| 409 | 410 | ("arm64ec", _) => false, |
| 410 | // Selection bug <https://github.com/llvm/llvm-project/issues/96432> | |
| 411 | ("mips64" | "mips64r6", _) => false, | |
| 412 | // Selection bug <https://github.com/llvm/llvm-project/issues/95471> | |
| 411 | // Selection bug <https://github.com/llvm/llvm-project/issues/96432> (fixed in llvm20) | |
| 412 | ("mips64" | "mips64r6", _) if lt_20_1_1 => false, | |
| 413 | // Selection bug <https://github.com/llvm/llvm-project/issues/95471>. This issue is closed | |
| 414 | // but basic math still does not work. | |
| 413 | 415 | ("nvptx64", _) => false, |
| 414 | 416 | // Unsupported https://github.com/llvm/llvm-project/issues/121122 |
| 415 | 417 | ("amdgpu", _) => false, |
| ... | ... | @@ -419,8 +421,8 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) { |
| 419 | 421 | // ABI unsupported <https://github.com/llvm/llvm-project/issues/41838> |
| 420 | 422 | ("sparc", _) => false, |
| 421 | 423 | // Stack alignment bug <https://github.com/llvm/llvm-project/issues/77401>. NB: tests may |
| 422 | // not fail if our compiler-builtins is linked. | |
| 423 | ("x86", _) => false, | |
| 424 | // not fail if our compiler-builtins is linked. (fixed in llvm21) | |
| 425 | ("x86", _) if lt_21_0_0 => false, | |
| 424 | 426 | // MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054> |
| 425 | 427 | ("x86_64", "windows") if target_env == "gnu" && target_abi != "llvm" => false, |
| 426 | 428 | // There are no known problems on other platforms, so the only requirement is that symbols |
compiler/rustc_codegen_ssa/messages.ftl+2| ... | ... | @@ -101,6 +101,8 @@ codegen_ssa_invalid_monomorphization_basic_float_type = invalid monomorphization |
| 101 | 101 | |
| 102 | 102 | codegen_ssa_invalid_monomorphization_basic_integer_type = invalid monomorphization of `{$name}` intrinsic: expected basic integer type, found `{$ty}` |
| 103 | 103 | |
| 104 | codegen_ssa_invalid_monomorphization_basic_integer_or_ptr_type = invalid monomorphization of `{$name}` intrinsic: expected basic integer or pointer type, found `{$ty}` | |
| 105 | ||
| 104 | 106 | codegen_ssa_invalid_monomorphization_cannot_return = invalid monomorphization of `{$name}` intrinsic: cannot return `{$ret_ty}`, expected `u{$expected_int_bits}` or `[u8; {$expected_bytes}]` |
| 105 | 107 | |
| 106 | 108 | codegen_ssa_invalid_monomorphization_cast_wide_pointer = invalid monomorphization of `{$name}` intrinsic: cannot cast wide pointer `{$ty}` |
compiler/rustc_codegen_ssa/src/back/apple.rs+2-2| ... | ... | @@ -17,7 +17,7 @@ mod tests; |
| 17 | 17 | |
| 18 | 18 | /// The canonical name of the desired SDK for a given target. |
| 19 | 19 | pub(super) fn sdk_name(target: &Target) -> &'static str { |
| 20 | match (&*target.os, &*target.abi) { | |
| 20 | match (&*target.os, &*target.env) { | |
| 21 | 21 | ("macos", "") => "MacOSX", |
| 22 | 22 | ("ios", "") => "iPhoneOS", |
| 23 | 23 | ("ios", "sim") => "iPhoneSimulator", |
| ... | ... | @@ -34,7 +34,7 @@ pub(super) fn sdk_name(target: &Target) -> &'static str { |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | pub(super) fn macho_platform(target: &Target) -> u32 { |
| 37 | match (&*target.os, &*target.abi) { | |
| 37 | match (&*target.os, &*target.env) { | |
| 38 | 38 | ("macos", _) => object::macho::PLATFORM_MACOS, |
| 39 | 39 | ("ios", "macabi") => object::macho::PLATFORM_MACCATALYST, |
| 40 | 40 | ("ios", "sim") => object::macho::PLATFORM_IOSSIMULATOR, |
compiler/rustc_codegen_ssa/src/back/link.rs+4-4| ... | ... | @@ -3026,7 +3026,7 @@ pub(crate) fn are_upstream_rust_objects_already_included(sess: &Session) -> bool |
| 3026 | 3026 | /// We need to communicate five things to the linker on Apple/Darwin targets: |
| 3027 | 3027 | /// - The architecture. |
| 3028 | 3028 | /// - The operating system (and that it's an Apple platform). |
| 3029 | /// - The environment / ABI. | |
| 3029 | /// - The environment. | |
| 3030 | 3030 | /// - The deployment target. |
| 3031 | 3031 | /// - The SDK version. |
| 3032 | 3032 | fn add_apple_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) { |
| ... | ... | @@ -3040,7 +3040,7 @@ fn add_apple_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavo |
| 3040 | 3040 | // `sess.target.arch` (`target_arch`) is not detailed enough. |
| 3041 | 3041 | let llvm_arch = sess.target.llvm_target.split_once('-').expect("LLVM target must have arch").0; |
| 3042 | 3042 | let target_os = &*sess.target.os; |
| 3043 | let target_abi = &*sess.target.abi; | |
| 3043 | let target_env = &*sess.target.env; | |
| 3044 | 3044 | |
| 3045 | 3045 | // The architecture name to forward to the linker. |
| 3046 | 3046 | // |
| ... | ... | @@ -3091,14 +3091,14 @@ fn add_apple_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavo |
| 3091 | 3091 | // > - visionos-simulator |
| 3092 | 3092 | // > - xros-simulator |
| 3093 | 3093 | // > - driverkit |
| 3094 | let platform_name = match (target_os, target_abi) { | |
| 3094 | let platform_name = match (target_os, target_env) { | |
| 3095 | 3095 | (os, "") => os, |
| 3096 | 3096 | ("ios", "macabi") => "mac-catalyst", |
| 3097 | 3097 | ("ios", "sim") => "ios-simulator", |
| 3098 | 3098 | ("tvos", "sim") => "tvos-simulator", |
| 3099 | 3099 | ("watchos", "sim") => "watchos-simulator", |
| 3100 | 3100 | ("visionos", "sim") => "visionos-simulator", |
| 3101 | _ => bug!("invalid OS/ABI combination for Apple target: {target_os}, {target_abi}"), | |
| 3101 | _ => bug!("invalid OS/env combination for Apple target: {target_os}, {target_env}"), | |
| 3102 | 3102 | }; |
| 3103 | 3103 | |
| 3104 | 3104 | let min_version = sess.apple_deployment_target().fmt_full().to_string(); |
compiler/rustc_codegen_ssa/src/errors.rs+8| ... | ... | @@ -764,6 +764,14 @@ pub enum InvalidMonomorphization<'tcx> { |
| 764 | 764 | ty: Ty<'tcx>, |
| 765 | 765 | }, |
| 766 | 766 | |
| 767 | #[diag(codegen_ssa_invalid_monomorphization_basic_integer_or_ptr_type, code = E0511)] | |
| 768 | BasicIntegerOrPtrType { | |
| 769 | #[primary_span] | |
| 770 | span: Span, | |
| 771 | name: Symbol, | |
| 772 | ty: Ty<'tcx>, | |
| 773 | }, | |
| 774 | ||
| 767 | 775 | #[diag(codegen_ssa_invalid_monomorphization_basic_float_type, code = E0511)] |
| 768 | 776 | BasicFloatType { |
| 769 | 777 | #[primary_span] |
compiler/rustc_codegen_ssa/src/mir/intrinsic.rs+66-16| ... | ... | @@ -92,6 +92,13 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { |
| 92 | 92 | let invalid_monomorphization_int_type = |ty| { |
| 93 | 93 | bx.tcx().dcx().emit_err(InvalidMonomorphization::BasicIntegerType { span, name, ty }); |
| 94 | 94 | }; |
| 95 | let invalid_monomorphization_int_or_ptr_type = |ty| { | |
| 96 | bx.tcx().dcx().emit_err(InvalidMonomorphization::BasicIntegerOrPtrType { | |
| 97 | span, | |
| 98 | name, | |
| 99 | ty, | |
| 100 | }); | |
| 101 | }; | |
| 95 | 102 | |
| 96 | 103 | let parse_atomic_ordering = |ord: ty::Value<'tcx>| { |
| 97 | 104 | let discr = ord.valtree.unwrap_branch()[0].unwrap_leaf(); |
| ... | ... | @@ -351,7 +358,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { |
| 351 | 358 | sym::atomic_load => { |
| 352 | 359 | let ty = fn_args.type_at(0); |
| 353 | 360 | if !(int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_raw_ptr()) { |
| 354 | invalid_monomorphization_int_type(ty); | |
| 361 | invalid_monomorphization_int_or_ptr_type(ty); | |
| 355 | 362 | return Ok(()); |
| 356 | 363 | } |
| 357 | 364 | let ordering = fn_args.const_at(1).to_value(); |
| ... | ... | @@ -367,7 +374,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { |
| 367 | 374 | sym::atomic_store => { |
| 368 | 375 | let ty = fn_args.type_at(0); |
| 369 | 376 | if !(int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_raw_ptr()) { |
| 370 | invalid_monomorphization_int_type(ty); | |
| 377 | invalid_monomorphization_int_or_ptr_type(ty); | |
| 371 | 378 | return Ok(()); |
| 372 | 379 | } |
| 373 | 380 | let ordering = fn_args.const_at(1).to_value(); |
| ... | ... | @@ -377,10 +384,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { |
| 377 | 384 | bx.atomic_store(val, ptr, parse_atomic_ordering(ordering), size); |
| 378 | 385 | return Ok(()); |
| 379 | 386 | } |
| 387 | // These are all AtomicRMW ops | |
| 380 | 388 | sym::atomic_cxchg | sym::atomic_cxchgweak => { |
| 381 | 389 | let ty = fn_args.type_at(0); |
| 382 | 390 | if !(int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_raw_ptr()) { |
| 383 | invalid_monomorphization_int_type(ty); | |
| 391 | invalid_monomorphization_int_or_ptr_type(ty); | |
| 384 | 392 | return Ok(()); |
| 385 | 393 | } |
| 386 | 394 | let succ_ordering = fn_args.const_at(1).to_value(); |
| ... | ... | @@ -407,7 +415,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { |
| 407 | 415 | |
| 408 | 416 | return Ok(()); |
| 409 | 417 | } |
| 410 | // These are all AtomicRMW ops | |
| 411 | 418 | sym::atomic_max | sym::atomic_min => { |
| 412 | 419 | let atom_op = if name == sym::atomic_max { |
| 413 | 420 | AtomicRmwBinOp::AtomicMax |
| ... | ... | @@ -420,7 +427,13 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { |
| 420 | 427 | let ordering = fn_args.const_at(1).to_value(); |
| 421 | 428 | let ptr = args[0].immediate(); |
| 422 | 429 | let val = args[1].immediate(); |
| 423 | bx.atomic_rmw(atom_op, ptr, val, parse_atomic_ordering(ordering)) | |
| 430 | bx.atomic_rmw( | |
| 431 | atom_op, | |
| 432 | ptr, | |
| 433 | val, | |
| 434 | parse_atomic_ordering(ordering), | |
| 435 | /* ret_ptr */ false, | |
| 436 | ) | |
| 424 | 437 | } else { |
| 425 | 438 | invalid_monomorphization_int_type(ty); |
| 426 | 439 | return Ok(()); |
| ... | ... | @@ -438,21 +451,44 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { |
| 438 | 451 | let ordering = fn_args.const_at(1).to_value(); |
| 439 | 452 | let ptr = args[0].immediate(); |
| 440 | 453 | let val = args[1].immediate(); |
| 441 | bx.atomic_rmw(atom_op, ptr, val, parse_atomic_ordering(ordering)) | |
| 454 | bx.atomic_rmw( | |
| 455 | atom_op, | |
| 456 | ptr, | |
| 457 | val, | |
| 458 | parse_atomic_ordering(ordering), | |
| 459 | /* ret_ptr */ false, | |
| 460 | ) | |
| 442 | 461 | } else { |
| 443 | 462 | invalid_monomorphization_int_type(ty); |
| 444 | 463 | return Ok(()); |
| 445 | 464 | } |
| 446 | 465 | } |
| 447 | sym::atomic_xchg | |
| 448 | | sym::atomic_xadd | |
| 466 | sym::atomic_xchg => { | |
| 467 | let ty = fn_args.type_at(0); | |
| 468 | let ordering = fn_args.const_at(1).to_value(); | |
| 469 | if int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_raw_ptr() { | |
| 470 | let ptr = args[0].immediate(); | |
| 471 | let val = args[1].immediate(); | |
| 472 | let atomic_op = AtomicRmwBinOp::AtomicXchg; | |
| 473 | bx.atomic_rmw( | |
| 474 | atomic_op, | |
| 475 | ptr, | |
| 476 | val, | |
| 477 | parse_atomic_ordering(ordering), | |
| 478 | /* ret_ptr */ ty.is_raw_ptr(), | |
| 479 | ) | |
| 480 | } else { | |
| 481 | invalid_monomorphization_int_or_ptr_type(ty); | |
| 482 | return Ok(()); | |
| 483 | } | |
| 484 | } | |
| 485 | sym::atomic_xadd | |
| 449 | 486 | | sym::atomic_xsub |
| 450 | 487 | | sym::atomic_and |
| 451 | 488 | | sym::atomic_nand |
| 452 | 489 | | sym::atomic_or |
| 453 | 490 | | sym::atomic_xor => { |
| 454 | 491 | let atom_op = match name { |
| 455 | sym::atomic_xchg => AtomicRmwBinOp::AtomicXchg, | |
| 456 | 492 | sym::atomic_xadd => AtomicRmwBinOp::AtomicAdd, |
| 457 | 493 | sym::atomic_xsub => AtomicRmwBinOp::AtomicSub, |
| 458 | 494 | sym::atomic_and => AtomicRmwBinOp::AtomicAnd, |
| ... | ... | @@ -462,14 +498,28 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { |
| 462 | 498 | _ => unreachable!(), |
| 463 | 499 | }; |
| 464 | 500 | |
| 465 | let ty = fn_args.type_at(0); | |
| 466 | if int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_raw_ptr() { | |
| 467 | let ordering = fn_args.const_at(1).to_value(); | |
| 468 | let ptr = args[0].immediate(); | |
| 469 | let val = args[1].immediate(); | |
| 470 | bx.atomic_rmw(atom_op, ptr, val, parse_atomic_ordering(ordering)) | |
| 501 | // The type of the in-memory data. | |
| 502 | let ty_mem = fn_args.type_at(0); | |
| 503 | // The type of the 2nd operand, given by-value. | |
| 504 | let ty_op = fn_args.type_at(1); | |
| 505 | ||
| 506 | let ordering = fn_args.const_at(2).to_value(); | |
| 507 | // We require either both arguments to have the same integer type, or the first to | |
| 508 | // be a pointer and the second to be `usize`. | |
| 509 | if (int_type_width_signed(ty_mem, bx.tcx()).is_some() && ty_op == ty_mem) | |
| 510 | || (ty_mem.is_raw_ptr() && ty_op == bx.tcx().types.usize) | |
| 511 | { | |
| 512 | let ptr = args[0].immediate(); // of type "pointer to `ty_mem`" | |
| 513 | let val = args[1].immediate(); // of type `ty_op` | |
| 514 | bx.atomic_rmw( | |
| 515 | atom_op, | |
| 516 | ptr, | |
| 517 | val, | |
| 518 | parse_atomic_ordering(ordering), | |
| 519 | /* ret_ptr */ ty_mem.is_raw_ptr(), | |
| 520 | ) | |
| 471 | 521 | } else { |
| 472 | invalid_monomorphization_int_type(ty); | |
| 522 | invalid_monomorphization_int_or_ptr_type(ty_mem); | |
| 473 | 523 | return Ok(()); |
| 474 | 524 | } |
| 475 | 525 | } |
compiler/rustc_codegen_ssa/src/traits/builder.rs+3| ... | ... | @@ -548,12 +548,15 @@ pub trait BuilderMethods<'a, 'tcx>: |
| 548 | 548 | failure_order: AtomicOrdering, |
| 549 | 549 | weak: bool, |
| 550 | 550 | ) -> (Self::Value, Self::Value); |
| 551 | /// `ret_ptr` indicates whether the return type (which is also the type `dst` points to) | |
| 552 | /// is a pointer or the same type as `src`. | |
| 551 | 553 | fn atomic_rmw( |
| 552 | 554 | &mut self, |
| 553 | 555 | op: AtomicRmwBinOp, |
| 554 | 556 | dst: Self::Value, |
| 555 | 557 | src: Self::Value, |
| 556 | 558 | order: AtomicOrdering, |
| 559 | ret_ptr: bool, | |
| 557 | 560 | ) -> Self::Value; |
| 558 | 561 | fn atomic_fence(&mut self, order: AtomicOrdering, scope: SynchronizationScope); |
| 559 | 562 | fn set_invariant_load(&mut self, load: Self::Value); |
compiler/rustc_errors/src/diagnostic.rs+5| ... | ... | @@ -1382,6 +1382,11 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { |
| 1382 | 1382 | &mut self.long_ty_path |
| 1383 | 1383 | } |
| 1384 | 1384 | |
| 1385 | pub fn with_long_ty_path(mut self, long_ty_path: Option<PathBuf>) -> Self { | |
| 1386 | self.long_ty_path = long_ty_path; | |
| 1387 | self | |
| 1388 | } | |
| 1389 | ||
| 1385 | 1390 | /// Most `emit_producing_guarantee` functions use this as a starting point. |
| 1386 | 1391 | fn emit_producing_nothing(mut self) { |
| 1387 | 1392 | let diag = self.take_diag(); |
compiler/rustc_errors/src/emitter.rs+1-1| ... | ... | @@ -409,7 +409,7 @@ pub trait Emitter { |
| 409 | 409 | if !redundant_span || always_backtrace { |
| 410 | 410 | let msg: Cow<'static, _> = match trace.kind { |
| 411 | 411 | ExpnKind::Macro(MacroKind::Attr, _) => { |
| 412 | "this procedural macro expansion".into() | |
| 412 | "this attribute macro expansion".into() | |
| 413 | 413 | } |
| 414 | 414 | ExpnKind::Macro(MacroKind::Derive, _) => { |
| 415 | 415 | "this derive macro expansion".into() |
compiler/rustc_expand/messages.ftl+3| ... | ... | @@ -70,6 +70,9 @@ expand_invalid_fragment_specifier = |
| 70 | 70 | invalid fragment specifier `{$fragment}` |
| 71 | 71 | .help = {$help} |
| 72 | 72 | |
| 73 | expand_macro_args_bad_delim = macro attribute argument matchers require parentheses | |
| 74 | expand_macro_args_bad_delim_sugg = the delimiters should be `(` and `)` | |
| 75 | ||
| 73 | 76 | expand_macro_body_stability = |
| 74 | 77 | macros cannot have body stability attributes |
| 75 | 78 | .label = invalid body stability attribute |
compiler/rustc_expand/src/errors.rs+18| ... | ... | @@ -482,3 +482,21 @@ mod metavar_exprs { |
| 482 | 482 | pub key: MacroRulesNormalizedIdent, |
| 483 | 483 | } |
| 484 | 484 | } |
| 485 | ||
| 486 | #[derive(Diagnostic)] | |
| 487 | #[diag(expand_macro_args_bad_delim)] | |
| 488 | pub(crate) struct MacroArgsBadDelim { | |
| 489 | #[primary_span] | |
| 490 | pub span: Span, | |
| 491 | #[subdiagnostic] | |
| 492 | pub sugg: MacroArgsBadDelimSugg, | |
| 493 | } | |
| 494 | ||
| 495 | #[derive(Subdiagnostic)] | |
| 496 | #[multipart_suggestion(expand_macro_args_bad_delim_sugg, applicability = "machine-applicable")] | |
| 497 | pub(crate) struct MacroArgsBadDelimSugg { | |
| 498 | #[suggestion_part(code = "(")] | |
| 499 | pub open: Span, | |
| 500 | #[suggestion_part(code = ")")] | |
| 501 | pub close: Span, | |
| 502 | } |
compiler/rustc_expand/src/mbe/diagnostics.rs+41-14| ... | ... | @@ -7,29 +7,40 @@ use rustc_macros::Subdiagnostic; |
| 7 | 7 | use rustc_parse::parser::{Parser, Recovery, token_descr}; |
| 8 | 8 | use rustc_session::parse::ParseSess; |
| 9 | 9 | use rustc_span::source_map::SourceMap; |
| 10 | use rustc_span::{ErrorGuaranteed, Ident, Span}; | |
| 10 | use rustc_span::{DUMMY_SP, ErrorGuaranteed, Ident, Span}; | |
| 11 | 11 | use tracing::debug; |
| 12 | 12 | |
| 13 | 13 | use super::macro_rules::{MacroRule, NoopTracker, parser_from_cx}; |
| 14 | 14 | use crate::expand::{AstFragmentKind, parse_ast_fragment}; |
| 15 | 15 | use crate::mbe::macro_parser::ParseResult::*; |
| 16 | 16 | use crate::mbe::macro_parser::{MatcherLoc, NamedParseResult, TtParser}; |
| 17 | use crate::mbe::macro_rules::{Tracker, try_match_macro}; | |
| 17 | use crate::mbe::macro_rules::{Tracker, try_match_macro, try_match_macro_attr}; | |
| 18 | 18 | |
| 19 | 19 | pub(super) fn failed_to_match_macro( |
| 20 | 20 | psess: &ParseSess, |
| 21 | 21 | sp: Span, |
| 22 | 22 | def_span: Span, |
| 23 | 23 | name: Ident, |
| 24 | arg: TokenStream, | |
| 24 | attr_args: Option<&TokenStream>, | |
| 25 | body: &TokenStream, | |
| 25 | 26 | rules: &[MacroRule], |
| 26 | 27 | ) -> (Span, ErrorGuaranteed) { |
| 27 | 28 | debug!("failed to match macro"); |
| 29 | let def_head_span = if !def_span.is_dummy() && !psess.source_map().is_imported(def_span) { | |
| 30 | psess.source_map().guess_head_span(def_span) | |
| 31 | } else { | |
| 32 | DUMMY_SP | |
| 33 | }; | |
| 34 | ||
| 28 | 35 | // An error occurred, try the expansion again, tracking the expansion closely for better |
| 29 | 36 | // diagnostics. |
| 30 | 37 | let mut tracker = CollectTrackerAndEmitter::new(psess.dcx(), sp); |
| 31 | 38 | |
| 32 | let try_success_result = try_match_macro(psess, name, &arg, rules, &mut tracker); | |
| 39 | let try_success_result = if let Some(attr_args) = attr_args { | |
| 40 | try_match_macro_attr(psess, name, attr_args, body, rules, &mut tracker) | |
| 41 | } else { | |
| 42 | try_match_macro(psess, name, body, rules, &mut tracker) | |
| 43 | }; | |
| 33 | 44 | |
| 34 | 45 | if try_success_result.is_ok() { |
| 35 | 46 | // Nonterminal parser recovery might turn failed matches into successful ones, |
| ... | ... | @@ -47,6 +58,18 @@ pub(super) fn failed_to_match_macro( |
| 47 | 58 | |
| 48 | 59 | let Some(BestFailure { token, msg: label, remaining_matcher, .. }) = tracker.best_failure |
| 49 | 60 | else { |
| 61 | // FIXME: we should report this at macro resolution time, as we do for | |
| 62 | // `resolve_macro_cannot_use_as_attr`. We can do that once we track multiple macro kinds for a | |
| 63 | // Def. | |
| 64 | if attr_args.is_none() && !rules.iter().any(|rule| matches!(rule, MacroRule::Func { .. })) { | |
| 65 | let msg = format!("macro has no rules for function-like invocation `{name}!`"); | |
| 66 | let mut err = psess.dcx().struct_span_err(sp, msg); | |
| 67 | if !def_head_span.is_dummy() { | |
| 68 | let msg = "this macro has no rules for function-like invocation"; | |
| 69 | err.span_label(def_head_span, msg); | |
| 70 | } | |
| 71 | return (sp, err.emit()); | |
| 72 | } | |
| 50 | 73 | return (sp, psess.dcx().span_delayed_bug(sp, "failed to match a macro")); |
| 51 | 74 | }; |
| 52 | 75 | |
| ... | ... | @@ -54,8 +77,8 @@ pub(super) fn failed_to_match_macro( |
| 54 | 77 | |
| 55 | 78 | let mut err = psess.dcx().struct_span_err(span, parse_failure_msg(&token, None)); |
| 56 | 79 | err.span_label(span, label); |
| 57 | if !def_span.is_dummy() && !psess.source_map().is_imported(def_span) { | |
| 58 | err.span_label(psess.source_map().guess_head_span(def_span), "when calling this macro"); | |
| 80 | if !def_head_span.is_dummy() { | |
| 81 | err.span_label(def_head_span, "when calling this macro"); | |
| 59 | 82 | } |
| 60 | 83 | |
| 61 | 84 | annotate_doc_comment(&mut err, psess.source_map(), span); |
| ... | ... | @@ -79,13 +102,16 @@ pub(super) fn failed_to_match_macro( |
| 79 | 102 | } |
| 80 | 103 | |
| 81 | 104 | // Check whether there's a missing comma in this macro call, like `println!("{}" a);` |
| 82 | if let Some((arg, comma_span)) = arg.add_comma() { | |
| 105 | if attr_args.is_none() | |
| 106 | && let Some((body, comma_span)) = body.add_comma() | |
| 107 | { | |
| 83 | 108 | for rule in rules { |
| 84 | let parser = parser_from_cx(psess, arg.clone(), Recovery::Allowed); | |
| 109 | let MacroRule::Func { lhs, .. } = rule else { continue }; | |
| 110 | let parser = parser_from_cx(psess, body.clone(), Recovery::Allowed); | |
| 85 | 111 | let mut tt_parser = TtParser::new(name); |
| 86 | 112 | |
| 87 | 113 | if let Success(_) = |
| 88 | tt_parser.parse_tt(&mut Cow::Borrowed(&parser), &rule.lhs, &mut NoopTracker) | |
| 114 | tt_parser.parse_tt(&mut Cow::Borrowed(&parser), lhs, &mut NoopTracker) | |
| 89 | 115 | { |
| 90 | 116 | if comma_span.is_dummy() { |
| 91 | 117 | err.note("you might be missing a comma"); |
| ... | ... | @@ -116,13 +142,13 @@ struct CollectTrackerAndEmitter<'dcx, 'matcher> { |
| 116 | 142 | |
| 117 | 143 | struct BestFailure { |
| 118 | 144 | token: Token, |
| 119 | position_in_tokenstream: u32, | |
| 145 | position_in_tokenstream: (bool, u32), | |
| 120 | 146 | msg: &'static str, |
| 121 | 147 | remaining_matcher: MatcherLoc, |
| 122 | 148 | } |
| 123 | 149 | |
| 124 | 150 | impl BestFailure { |
| 125 | fn is_better_position(&self, position: u32) -> bool { | |
| 151 | fn is_better_position(&self, position: (bool, u32)) -> bool { | |
| 126 | 152 | position > self.position_in_tokenstream |
| 127 | 153 | } |
| 128 | 154 | } |
| ... | ... | @@ -142,7 +168,7 @@ impl<'dcx, 'matcher> Tracker<'matcher> for CollectTrackerAndEmitter<'dcx, 'match |
| 142 | 168 | } |
| 143 | 169 | } |
| 144 | 170 | |
| 145 | fn after_arm(&mut self, result: &NamedParseResult<Self::Failure>) { | |
| 171 | fn after_arm(&mut self, in_body: bool, result: &NamedParseResult<Self::Failure>) { | |
| 146 | 172 | match result { |
| 147 | 173 | Success(_) => { |
| 148 | 174 | // Nonterminal parser recovery might turn failed matches into successful ones, |
| ... | ... | @@ -155,14 +181,15 @@ impl<'dcx, 'matcher> Tracker<'matcher> for CollectTrackerAndEmitter<'dcx, 'match |
| 155 | 181 | Failure((token, approx_position, msg)) => { |
| 156 | 182 | debug!(?token, ?msg, "a new failure of an arm"); |
| 157 | 183 | |
| 184 | let position_in_tokenstream = (in_body, *approx_position); | |
| 158 | 185 | if self |
| 159 | 186 | .best_failure |
| 160 | 187 | .as_ref() |
| 161 | .is_none_or(|failure| failure.is_better_position(*approx_position)) | |
| 188 | .is_none_or(|failure| failure.is_better_position(position_in_tokenstream)) | |
| 162 | 189 | { |
| 163 | 190 | self.best_failure = Some(BestFailure { |
| 164 | 191 | token: *token, |
| 165 | position_in_tokenstream: *approx_position, | |
| 192 | position_in_tokenstream, | |
| 166 | 193 | msg, |
| 167 | 194 | remaining_matcher: self |
| 168 | 195 | .remaining_matcher |
compiler/rustc_expand/src/mbe/macro_check.rs+5-1| ... | ... | @@ -193,15 +193,19 @@ struct MacroState<'a> { |
| 193 | 193 | /// Arguments: |
| 194 | 194 | /// - `psess` is used to emit diagnostics and lints |
| 195 | 195 | /// - `node_id` is used to emit lints |
| 196 | /// - `lhs` and `rhs` represent the rule | |
| 196 | /// - `args`, `lhs`, and `rhs` represent the rule | |
| 197 | 197 | pub(super) fn check_meta_variables( |
| 198 | 198 | psess: &ParseSess, |
| 199 | 199 | node_id: NodeId, |
| 200 | args: Option<&TokenTree>, | |
| 200 | 201 | lhs: &TokenTree, |
| 201 | 202 | rhs: &TokenTree, |
| 202 | 203 | ) -> Result<(), ErrorGuaranteed> { |
| 203 | 204 | let mut guar = None; |
| 204 | 205 | let mut binders = Binders::default(); |
| 206 | if let Some(args) = args { | |
| 207 | check_binders(psess, node_id, args, &Stack::Empty, &mut binders, &Stack::Empty, &mut guar); | |
| 208 | } | |
| 205 | 209 | check_binders(psess, node_id, lhs, &Stack::Empty, &mut binders, &Stack::Empty, &mut guar); |
| 206 | 210 | check_occurrences(psess, node_id, rhs, &Stack::Empty, &binders, &Stack::Empty, &mut guar); |
| 207 | 211 | guar.map_or(Ok(()), Err) |
compiler/rustc_expand/src/mbe/macro_rules.rs+234-30| ... | ... | @@ -6,12 +6,12 @@ use std::{mem, slice}; |
| 6 | 6 | use ast::token::IdentIsRaw; |
| 7 | 7 | use rustc_ast::token::NtPatKind::*; |
| 8 | 8 | use rustc_ast::token::TokenKind::*; |
| 9 | use rustc_ast::token::{self, NonterminalKind, Token, TokenKind}; | |
| 10 | use rustc_ast::tokenstream::{DelimSpan, TokenStream}; | |
| 9 | use rustc_ast::token::{self, Delimiter, NonterminalKind, Token, TokenKind}; | |
| 10 | use rustc_ast::tokenstream::{self, DelimSpan, TokenStream}; | |
| 11 | 11 | use rustc_ast::{self as ast, DUMMY_NODE_ID, NodeId}; |
| 12 | 12 | use rustc_ast_pretty::pprust; |
| 13 | 13 | use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; |
| 14 | use rustc_errors::{Applicability, Diag, ErrorGuaranteed}; | |
| 14 | use rustc_errors::{Applicability, Diag, ErrorGuaranteed, MultiSpan}; | |
| 15 | 15 | use rustc_feature::Features; |
| 16 | 16 | use rustc_hir as hir; |
| 17 | 17 | use rustc_hir::attrs::AttributeKind; |
| ... | ... | @@ -23,23 +23,26 @@ use rustc_lint_defs::builtin::{ |
| 23 | 23 | use rustc_parse::exp; |
| 24 | 24 | use rustc_parse::parser::{Parser, Recovery}; |
| 25 | 25 | use rustc_session::Session; |
| 26 | use rustc_session::parse::ParseSess; | |
| 26 | use rustc_session::parse::{ParseSess, feature_err}; | |
| 27 | 27 | use rustc_span::edition::Edition; |
| 28 | 28 | use rustc_span::hygiene::Transparency; |
| 29 | 29 | use rustc_span::{Ident, Span, kw, sym}; |
| 30 | 30 | use tracing::{debug, instrument, trace, trace_span}; |
| 31 | 31 | |
| 32 | use super::diagnostics::failed_to_match_macro; | |
| 32 | 33 | use super::macro_parser::{NamedMatches, NamedParseResult}; |
| 33 | 34 | use super::{SequenceRepetition, diagnostics}; |
| 34 | 35 | use crate::base::{ |
| 35 | DummyResult, ExpandResult, ExtCtxt, MacResult, MacroExpanderResult, SyntaxExtension, | |
| 36 | SyntaxExtensionKind, TTMacroExpander, | |
| 36 | AttrProcMacro, DummyResult, ExpandResult, ExtCtxt, MacResult, MacroExpanderResult, | |
| 37 | SyntaxExtension, SyntaxExtensionKind, TTMacroExpander, | |
| 37 | 38 | }; |
| 39 | use crate::errors; | |
| 38 | 40 | use crate::expand::{AstFragment, AstFragmentKind, ensure_complete_parse, parse_ast_fragment}; |
| 41 | use crate::mbe::macro_check::check_meta_variables; | |
| 39 | 42 | use crate::mbe::macro_parser::{Error, ErrorReported, Failure, MatcherLoc, Success, TtParser}; |
| 40 | 43 | use crate::mbe::quoted::{RulePart, parse_one_tt}; |
| 41 | 44 | use crate::mbe::transcribe::transcribe; |
| 42 | use crate::mbe::{self, KleeneOp, macro_check}; | |
| 45 | use crate::mbe::{self, KleeneOp}; | |
| 43 | 46 | |
| 44 | 47 | pub(crate) struct ParserAnyMacro<'a> { |
| 45 | 48 | parser: Parser<'a>, |
| ... | ... | @@ -123,10 +126,17 @@ impl<'a> ParserAnyMacro<'a> { |
| 123 | 126 | } |
| 124 | 127 | } |
| 125 | 128 | |
| 126 | pub(super) struct MacroRule { | |
| 127 | pub(super) lhs: Vec<MatcherLoc>, | |
| 128 | lhs_span: Span, | |
| 129 | rhs: mbe::TokenTree, | |
| 129 | pub(super) enum MacroRule { | |
| 130 | /// A function-style rule, for use with `m!()` | |
| 131 | Func { lhs: Vec<MatcherLoc>, lhs_span: Span, rhs: mbe::TokenTree }, | |
| 132 | /// An attr rule, for use with `#[m]` | |
| 133 | Attr { | |
| 134 | args: Vec<MatcherLoc>, | |
| 135 | args_span: Span, | |
| 136 | body: Vec<MatcherLoc>, | |
| 137 | body_span: Span, | |
| 138 | rhs: mbe::TokenTree, | |
| 139 | }, | |
| 130 | 140 | } |
| 131 | 141 | |
| 132 | 142 | pub struct MacroRulesMacroExpander { |
| ... | ... | @@ -138,10 +148,15 @@ pub struct MacroRulesMacroExpander { |
| 138 | 148 | } |
| 139 | 149 | |
| 140 | 150 | impl MacroRulesMacroExpander { |
| 141 | pub fn get_unused_rule(&self, rule_i: usize) -> Option<(&Ident, Span)> { | |
| 151 | pub fn get_unused_rule(&self, rule_i: usize) -> Option<(&Ident, MultiSpan)> { | |
| 142 | 152 | // If the rhs contains an invocation like `compile_error!`, don't report it as unused. |
| 143 | let rule = &self.rules[rule_i]; | |
| 144 | if has_compile_error_macro(&rule.rhs) { None } else { Some((&self.name, rule.lhs_span)) } | |
| 153 | let (span, rhs) = match self.rules[rule_i] { | |
| 154 | MacroRule::Func { lhs_span, ref rhs, .. } => (MultiSpan::from_span(lhs_span), rhs), | |
| 155 | MacroRule::Attr { args_span, body_span, ref rhs, .. } => { | |
| 156 | (MultiSpan::from_spans(vec![args_span, body_span]), rhs) | |
| 157 | } | |
| 158 | }; | |
| 159 | if has_compile_error_macro(rhs) { None } else { Some((&self.name, span)) } | |
| 145 | 160 | } |
| 146 | 161 | } |
| 147 | 162 | |
| ... | ... | @@ -165,6 +180,28 @@ impl TTMacroExpander for MacroRulesMacroExpander { |
| 165 | 180 | } |
| 166 | 181 | } |
| 167 | 182 | |
| 183 | impl AttrProcMacro for MacroRulesMacroExpander { | |
| 184 | fn expand( | |
| 185 | &self, | |
| 186 | cx: &mut ExtCtxt<'_>, | |
| 187 | sp: Span, | |
| 188 | args: TokenStream, | |
| 189 | body: TokenStream, | |
| 190 | ) -> Result<TokenStream, ErrorGuaranteed> { | |
| 191 | expand_macro_attr( | |
| 192 | cx, | |
| 193 | sp, | |
| 194 | self.span, | |
| 195 | self.node_id, | |
| 196 | self.name, | |
| 197 | self.transparency, | |
| 198 | args, | |
| 199 | body, | |
| 200 | &self.rules, | |
| 201 | ) | |
| 202 | } | |
| 203 | } | |
| 204 | ||
| 168 | 205 | struct DummyExpander(ErrorGuaranteed); |
| 169 | 206 | |
| 170 | 207 | impl TTMacroExpander for DummyExpander { |
| ... | ... | @@ -197,7 +234,7 @@ pub(super) trait Tracker<'matcher> { |
| 197 | 234 | |
| 198 | 235 | /// This is called after an arm has been parsed, either successfully or unsuccessfully. When |
| 199 | 236 | /// this is called, `before_match_loc` was called at least once (with a `MatcherLoc::Eof`). |
| 200 | fn after_arm(&mut self, _result: &NamedParseResult<Self::Failure>) {} | |
| 237 | fn after_arm(&mut self, _in_body: bool, _result: &NamedParseResult<Self::Failure>) {} | |
| 201 | 238 | |
| 202 | 239 | /// For tracing. |
| 203 | 240 | fn description() -> &'static str; |
| ... | ... | @@ -245,14 +282,17 @@ fn expand_macro<'cx>( |
| 245 | 282 | |
| 246 | 283 | match try_success_result { |
| 247 | 284 | Ok((rule_index, rule, named_matches)) => { |
| 248 | let mbe::TokenTree::Delimited(rhs_span, _, ref rhs) = rule.rhs else { | |
| 285 | let MacroRule::Func { rhs, .. } = rule else { | |
| 286 | panic!("try_match_macro returned non-func rule"); | |
| 287 | }; | |
| 288 | let mbe::TokenTree::Delimited(rhs_span, _, rhs) = rhs else { | |
| 249 | 289 | cx.dcx().span_bug(sp, "malformed macro rhs"); |
| 250 | 290 | }; |
| 251 | let arm_span = rule.rhs.span(); | |
| 291 | let arm_span = rhs_span.entire(); | |
| 252 | 292 | |
| 253 | 293 | // rhs has holes ( `$id` and `$(...)` that need filled) |
| 254 | 294 | let id = cx.current_expansion.id; |
| 255 | let tts = match transcribe(psess, &named_matches, rhs, rhs_span, transparency, id) { | |
| 295 | let tts = match transcribe(psess, &named_matches, rhs, *rhs_span, transparency, id) { | |
| 256 | 296 | Ok(tts) => tts, |
| 257 | 297 | Err(err) => { |
| 258 | 298 | let guar = err.emit(); |
| ... | ... | @@ -280,13 +320,76 @@ fn expand_macro<'cx>( |
| 280 | 320 | Err(CanRetry::Yes) => { |
| 281 | 321 | // Retry and emit a better error. |
| 282 | 322 | let (span, guar) = |
| 283 | diagnostics::failed_to_match_macro(cx.psess(), sp, def_span, name, arg, rules); | |
| 323 | failed_to_match_macro(cx.psess(), sp, def_span, name, None, &arg, rules); | |
| 284 | 324 | cx.macro_error_and_trace_macros_diag(); |
| 285 | 325 | DummyResult::any(span, guar) |
| 286 | 326 | } |
| 287 | 327 | } |
| 288 | 328 | } |
| 289 | 329 | |
| 330 | /// Expands the rules based macro defined by `rules` for a given attribute `args` and `body`. | |
| 331 | #[instrument(skip(cx, transparency, args, body, rules))] | |
| 332 | fn expand_macro_attr( | |
| 333 | cx: &mut ExtCtxt<'_>, | |
| 334 | sp: Span, | |
| 335 | def_span: Span, | |
| 336 | node_id: NodeId, | |
| 337 | name: Ident, | |
| 338 | transparency: Transparency, | |
| 339 | args: TokenStream, | |
| 340 | body: TokenStream, | |
| 341 | rules: &[MacroRule], | |
| 342 | ) -> Result<TokenStream, ErrorGuaranteed> { | |
| 343 | let psess = &cx.sess.psess; | |
| 344 | // Macros defined in the current crate have a real node id, | |
| 345 | // whereas macros from an external crate have a dummy id. | |
| 346 | let is_local = node_id != DUMMY_NODE_ID; | |
| 347 | ||
| 348 | if cx.trace_macros() { | |
| 349 | let msg = format!( | |
| 350 | "expanding `$[{name}({})] {}`", | |
| 351 | pprust::tts_to_string(&args), | |
| 352 | pprust::tts_to_string(&body), | |
| 353 | ); | |
| 354 | trace_macros_note(&mut cx.expansions, sp, msg); | |
| 355 | } | |
| 356 | ||
| 357 | // Track nothing for the best performance. | |
| 358 | match try_match_macro_attr(psess, name, &args, &body, rules, &mut NoopTracker) { | |
| 359 | Ok((i, rule, named_matches)) => { | |
| 360 | let MacroRule::Attr { rhs, .. } = rule else { | |
| 361 | panic!("try_macro_match_attr returned non-attr rule"); | |
| 362 | }; | |
| 363 | let mbe::TokenTree::Delimited(rhs_span, _, rhs) = rhs else { | |
| 364 | cx.dcx().span_bug(sp, "malformed macro rhs"); | |
| 365 | }; | |
| 366 | ||
| 367 | let id = cx.current_expansion.id; | |
| 368 | let tts = transcribe(psess, &named_matches, rhs, *rhs_span, transparency, id) | |
| 369 | .map_err(|e| e.emit())?; | |
| 370 | ||
| 371 | if cx.trace_macros() { | |
| 372 | let msg = format!("to `{}`", pprust::tts_to_string(&tts)); | |
| 373 | trace_macros_note(&mut cx.expansions, sp, msg); | |
| 374 | } | |
| 375 | ||
| 376 | if is_local { | |
| 377 | cx.resolver.record_macro_rule_usage(node_id, i); | |
| 378 | } | |
| 379 | ||
| 380 | Ok(tts) | |
| 381 | } | |
| 382 | Err(CanRetry::No(guar)) => Err(guar), | |
| 383 | Err(CanRetry::Yes) => { | |
| 384 | // Retry and emit a better error. | |
| 385 | let (_, guar) = | |
| 386 | failed_to_match_macro(cx.psess(), sp, def_span, name, Some(&args), &body, rules); | |
| 387 | cx.trace_macros_diag(); | |
| 388 | Err(guar) | |
| 389 | } | |
| 390 | } | |
| 391 | } | |
| 392 | ||
| 290 | 393 | pub(super) enum CanRetry { |
| 291 | 394 | Yes, |
| 292 | 395 | /// We are not allowed to retry macro expansion as a fatal error has been emitted already. |
| ... | ... | @@ -327,6 +430,7 @@ pub(super) fn try_match_macro<'matcher, T: Tracker<'matcher>>( |
| 327 | 430 | // Try each arm's matchers. |
| 328 | 431 | let mut tt_parser = TtParser::new(name); |
| 329 | 432 | for (i, rule) in rules.iter().enumerate() { |
| 433 | let MacroRule::Func { lhs, .. } = rule else { continue }; | |
| 330 | 434 | let _tracing_span = trace_span!("Matching arm", %i); |
| 331 | 435 | |
| 332 | 436 | // Take a snapshot of the state of pre-expansion gating at this point. |
| ... | ... | @@ -335,9 +439,9 @@ pub(super) fn try_match_macro<'matcher, T: Tracker<'matcher>>( |
| 335 | 439 | // are not recorded. On the first `Success(..)`ful matcher, the spans are merged. |
| 336 | 440 | let mut gated_spans_snapshot = mem::take(&mut *psess.gated_spans.spans.borrow_mut()); |
| 337 | 441 | |
| 338 | let result = tt_parser.parse_tt(&mut Cow::Borrowed(&parser), &rule.lhs, track); | |
| 442 | let result = tt_parser.parse_tt(&mut Cow::Borrowed(&parser), lhs, track); | |
| 339 | 443 | |
| 340 | track.after_arm(&result); | |
| 444 | track.after_arm(true, &result); | |
| 341 | 445 | |
| 342 | 446 | match result { |
| 343 | 447 | Success(named_matches) => { |
| ... | ... | @@ -372,6 +476,60 @@ pub(super) fn try_match_macro<'matcher, T: Tracker<'matcher>>( |
| 372 | 476 | Err(CanRetry::Yes) |
| 373 | 477 | } |
| 374 | 478 | |
| 479 | /// Try expanding the macro attribute. Returns the index of the successful arm and its | |
| 480 | /// named_matches if it was successful, and nothing if it failed. On failure, it's the caller's job | |
| 481 | /// to use `track` accordingly to record all errors correctly. | |
| 482 | #[instrument(level = "debug", skip(psess, attr_args, attr_body, rules, track), fields(tracking = %T::description()))] | |
| 483 | pub(super) fn try_match_macro_attr<'matcher, T: Tracker<'matcher>>( | |
| 484 | psess: &ParseSess, | |
| 485 | name: Ident, | |
| 486 | attr_args: &TokenStream, | |
| 487 | attr_body: &TokenStream, | |
| 488 | rules: &'matcher [MacroRule], | |
| 489 | track: &mut T, | |
| 490 | ) -> Result<(usize, &'matcher MacroRule, NamedMatches), CanRetry> { | |
| 491 | // This uses the same strategy as `try_match_macro` | |
| 492 | let args_parser = parser_from_cx(psess, attr_args.clone(), T::recovery()); | |
| 493 | let body_parser = parser_from_cx(psess, attr_body.clone(), T::recovery()); | |
| 494 | let mut tt_parser = TtParser::new(name); | |
| 495 | for (i, rule) in rules.iter().enumerate() { | |
| 496 | let MacroRule::Attr { args, body, .. } = rule else { continue }; | |
| 497 | ||
| 498 | let mut gated_spans_snapshot = mem::take(&mut *psess.gated_spans.spans.borrow_mut()); | |
| 499 | ||
| 500 | let result = tt_parser.parse_tt(&mut Cow::Borrowed(&args_parser), args, track); | |
| 501 | track.after_arm(false, &result); | |
| 502 | ||
| 503 | let mut named_matches = match result { | |
| 504 | Success(named_matches) => named_matches, | |
| 505 | Failure(_) => { | |
| 506 | mem::swap(&mut gated_spans_snapshot, &mut psess.gated_spans.spans.borrow_mut()); | |
| 507 | continue; | |
| 508 | } | |
| 509 | Error(_, _) => return Err(CanRetry::Yes), | |
| 510 | ErrorReported(guar) => return Err(CanRetry::No(guar)), | |
| 511 | }; | |
| 512 | ||
| 513 | let result = tt_parser.parse_tt(&mut Cow::Borrowed(&body_parser), body, track); | |
| 514 | track.after_arm(true, &result); | |
| 515 | ||
| 516 | match result { | |
| 517 | Success(body_named_matches) => { | |
| 518 | psess.gated_spans.merge(gated_spans_snapshot); | |
| 519 | named_matches.extend(body_named_matches); | |
| 520 | return Ok((i, rule, named_matches)); | |
| 521 | } | |
| 522 | Failure(_) => { | |
| 523 | mem::swap(&mut gated_spans_snapshot, &mut psess.gated_spans.spans.borrow_mut()) | |
| 524 | } | |
| 525 | Error(_, _) => return Err(CanRetry::Yes), | |
| 526 | ErrorReported(guar) => return Err(CanRetry::No(guar)), | |
| 527 | } | |
| 528 | } | |
| 529 | ||
| 530 | Err(CanRetry::Yes) | |
| 531 | } | |
| 532 | ||
| 375 | 533 | /// Converts a macro item into a syntax extension. |
| 376 | 534 | pub fn compile_declarative_macro( |
| 377 | 535 | sess: &Session, |
| ... | ... | @@ -382,13 +540,13 @@ pub fn compile_declarative_macro( |
| 382 | 540 | span: Span, |
| 383 | 541 | node_id: NodeId, |
| 384 | 542 | edition: Edition, |
| 385 | ) -> (SyntaxExtension, usize) { | |
| 386 | let mk_syn_ext = |expander| { | |
| 387 | let kind = SyntaxExtensionKind::LegacyBang(expander); | |
| 543 | ) -> (SyntaxExtension, Option<Arc<SyntaxExtension>>, usize) { | |
| 544 | let mk_syn_ext = |kind| { | |
| 388 | 545 | let is_local = is_defined_in_current_crate(node_id); |
| 389 | 546 | SyntaxExtension::new(sess, kind, span, Vec::new(), edition, ident.name, attrs, is_local) |
| 390 | 547 | }; |
| 391 | let dummy_syn_ext = |guar| (mk_syn_ext(Arc::new(DummyExpander(guar))), 0); | |
| 548 | let mk_bang_ext = |expander| mk_syn_ext(SyntaxExtensionKind::LegacyBang(expander)); | |
| 549 | let dummy_syn_ext = |guar| (mk_bang_ext(Arc::new(DummyExpander(guar))), None, 0); | |
| 392 | 550 | |
| 393 | 551 | let macro_rules = macro_def.macro_rules; |
| 394 | 552 | let exp_sep = if macro_rules { exp!(Semi) } else { exp!(Comma) }; |
| ... | ... | @@ -401,9 +559,30 @@ pub fn compile_declarative_macro( |
| 401 | 559 | let mut guar = None; |
| 402 | 560 | let mut check_emission = |ret: Result<(), ErrorGuaranteed>| guar = guar.or(ret.err()); |
| 403 | 561 | |
| 562 | let mut has_attr_rules = false; | |
| 404 | 563 | let mut rules = Vec::new(); |
| 405 | 564 | |
| 406 | 565 | while p.token != token::Eof { |
| 566 | let args = if p.eat_keyword_noexpect(sym::attr) { | |
| 567 | has_attr_rules = true; | |
| 568 | if !features.macro_attr() { | |
| 569 | feature_err(sess, sym::macro_attr, span, "`macro_rules!` attributes are unstable") | |
| 570 | .emit(); | |
| 571 | } | |
| 572 | if let Some(guar) = check_no_eof(sess, &p, "expected macro attr args") { | |
| 573 | return dummy_syn_ext(guar); | |
| 574 | } | |
| 575 | let args = p.parse_token_tree(); | |
| 576 | check_args_parens(sess, &args); | |
| 577 | let args = parse_one_tt(args, RulePart::Pattern, sess, node_id, features, edition); | |
| 578 | check_emission(check_lhs(sess, node_id, &args)); | |
| 579 | if let Some(guar) = check_no_eof(sess, &p, "expected macro attr body") { | |
| 580 | return dummy_syn_ext(guar); | |
| 581 | } | |
| 582 | Some(args) | |
| 583 | } else { | |
| 584 | None | |
| 585 | }; | |
| 407 | 586 | let lhs_tt = p.parse_token_tree(); |
| 408 | 587 | let lhs_tt = parse_one_tt(lhs_tt, RulePart::Pattern, sess, node_id, features, edition); |
| 409 | 588 | check_emission(check_lhs(sess, node_id, &lhs_tt)); |
| ... | ... | @@ -416,7 +595,7 @@ pub fn compile_declarative_macro( |
| 416 | 595 | let rhs_tt = p.parse_token_tree(); |
| 417 | 596 | let rhs_tt = parse_one_tt(rhs_tt, RulePart::Body, sess, node_id, features, edition); |
| 418 | 597 | check_emission(check_rhs(sess, &rhs_tt)); |
| 419 | check_emission(macro_check::check_meta_variables(&sess.psess, node_id, &lhs_tt, &rhs_tt)); | |
| 598 | check_emission(check_meta_variables(&sess.psess, node_id, args.as_ref(), &lhs_tt, &rhs_tt)); | |
| 420 | 599 | let lhs_span = lhs_tt.span(); |
| 421 | 600 | // Convert the lhs into `MatcherLoc` form, which is better for doing the |
| 422 | 601 | // actual matching. |
| ... | ... | @@ -425,7 +604,17 @@ pub fn compile_declarative_macro( |
| 425 | 604 | } else { |
| 426 | 605 | return dummy_syn_ext(guar.unwrap()); |
| 427 | 606 | }; |
| 428 | rules.push(MacroRule { lhs, lhs_span, rhs: rhs_tt }); | |
| 607 | if let Some(args) = args { | |
| 608 | let args_span = args.span(); | |
| 609 | let mbe::TokenTree::Delimited(.., delimited) = args else { | |
| 610 | return dummy_syn_ext(guar.unwrap()); | |
| 611 | }; | |
| 612 | let args = mbe::macro_parser::compute_locs(&delimited.tts); | |
| 613 | let body_span = lhs_span; | |
| 614 | rules.push(MacroRule::Attr { args, args_span, body: lhs, body_span, rhs: rhs_tt }); | |
| 615 | } else { | |
| 616 | rules.push(MacroRule::Func { lhs, lhs_span, rhs: rhs_tt }); | |
| 617 | } | |
| 429 | 618 | if p.token == token::Eof { |
| 430 | 619 | break; |
| 431 | 620 | } |
| ... | ... | @@ -451,9 +640,12 @@ pub fn compile_declarative_macro( |
| 451 | 640 | // Return the number of rules for unused rule linting, if this is a local macro. |
| 452 | 641 | let nrules = if is_defined_in_current_crate(node_id) { rules.len() } else { 0 }; |
| 453 | 642 | |
| 454 | let expander = | |
| 455 | Arc::new(MacroRulesMacroExpander { name: ident, span, node_id, transparency, rules }); | |
| 456 | (mk_syn_ext(expander), nrules) | |
| 643 | let exp = Arc::new(MacroRulesMacroExpander { name: ident, span, node_id, transparency, rules }); | |
| 644 | let opt_attr_ext = has_attr_rules.then(|| { | |
| 645 | let exp = Arc::clone(&exp); | |
| 646 | Arc::new(mk_syn_ext(SyntaxExtensionKind::Attr(exp))) | |
| 647 | }); | |
| 648 | (mk_bang_ext(exp), opt_attr_ext, nrules) | |
| 457 | 649 | } |
| 458 | 650 | |
| 459 | 651 | fn check_no_eof(sess: &Session, p: &Parser<'_>, msg: &'static str) -> Option<ErrorGuaranteed> { |
| ... | ... | @@ -469,6 +661,18 @@ fn check_no_eof(sess: &Session, p: &Parser<'_>, msg: &'static str) -> Option<Err |
| 469 | 661 | None |
| 470 | 662 | } |
| 471 | 663 | |
| 664 | fn check_args_parens(sess: &Session, args: &tokenstream::TokenTree) { | |
| 665 | // This does not handle the non-delimited case; that gets handled separately by `check_lhs`. | |
| 666 | if let tokenstream::TokenTree::Delimited(dspan, _, delim, _) = args | |
| 667 | && *delim != Delimiter::Parenthesis | |
| 668 | { | |
| 669 | sess.dcx().emit_err(errors::MacroArgsBadDelim { | |
| 670 | span: dspan.entire(), | |
| 671 | sugg: errors::MacroArgsBadDelimSugg { open: dspan.open, close: dspan.close }, | |
| 672 | }); | |
| 673 | } | |
| 674 | } | |
| 675 | ||
| 472 | 676 | fn check_lhs(sess: &Session, node_id: NodeId, lhs: &mbe::TokenTree) -> Result<(), ErrorGuaranteed> { |
| 473 | 677 | let e1 = check_lhs_nt_follows(sess, node_id, lhs); |
| 474 | 678 | let e2 = check_lhs_no_empty_seq(sess, slice::from_ref(lhs)); |
compiler/rustc_feature/src/unstable.rs+2| ... | ... | @@ -554,6 +554,8 @@ declare_features! ( |
| 554 | 554 | (unstable, link_arg_attribute, "1.76.0", Some(99427)), |
| 555 | 555 | /// Allows fused `loop`/`match` for direct intraprocedural jumps. |
| 556 | 556 | (incomplete, loop_match, "1.90.0", Some(132306)), |
| 557 | /// Allow `macro_rules!` attribute rules | |
| 558 | (unstable, macro_attr, "CURRENT_RUSTC_VERSION", Some(83527)), | |
| 557 | 559 | /// Give access to additional metadata about declarative macro meta-variables. |
| 558 | 560 | (unstable, macro_metavar_expr, "1.61.0", Some(83527)), |
| 559 | 561 | /// Provides a way to concatenate identifiers using metavariable expressions. |
compiler/rustc_hir_analysis/src/check/intrinsic.rs+6-6| ... | ... | @@ -652,16 +652,16 @@ pub(crate) fn check_intrinsic_type( |
| 652 | 652 | sym::atomic_store => (1, 1, vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], tcx.types.unit), |
| 653 | 653 | |
| 654 | 654 | sym::atomic_xchg |
| 655 | | sym::atomic_xadd | |
| 656 | | sym::atomic_xsub | |
| 657 | | sym::atomic_and | |
| 658 | | sym::atomic_nand | |
| 659 | | sym::atomic_or | |
| 660 | | sym::atomic_xor | |
| 661 | 655 | | sym::atomic_max |
| 662 | 656 | | sym::atomic_min |
| 663 | 657 | | sym::atomic_umax |
| 664 | 658 | | sym::atomic_umin => (1, 1, vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], param(0)), |
| 659 | sym::atomic_xadd | |
| 660 | | sym::atomic_xsub | |
| 661 | | sym::atomic_and | |
| 662 | | sym::atomic_nand | |
| 663 | | sym::atomic_or | |
| 664 | | sym::atomic_xor => (2, 1, vec![Ty::new_mut_ptr(tcx, param(0)), param(1)], param(0)), | |
| 665 | 665 | sym::atomic_fence | sym::atomic_singlethreadfence => (0, 1, Vec::new(), tcx.types.unit), |
| 666 | 666 | |
| 667 | 667 | other => { |
compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs+3-2| ... | ... | @@ -1135,9 +1135,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { |
| 1135 | 1135 | ); |
| 1136 | 1136 | } |
| 1137 | 1137 | } else { |
| 1138 | let trait_ = | |
| 1139 | tcx.short_string(bound.print_only_trait_path(), err.long_ty_path()); | |
| 1138 | 1140 | err.note(format!( |
| 1139 | "associated {assoc_kind_str} `{assoc_ident}` could derive from `{}`", | |
| 1140 | bound.print_only_trait_path(), | |
| 1141 | "associated {assoc_kind_str} `{assoc_ident}` could derive from `{trait_}`", | |
| 1141 | 1142 | )); |
| 1142 | 1143 | } |
| 1143 | 1144 | } |
compiler/rustc_hir_typeck/messages.ftl+2-2| ... | ... | @@ -159,7 +159,7 @@ hir_typeck_lossy_provenance_ptr2int = |
| 159 | 159 | .suggestion = use `.addr()` to obtain the address of a pointer |
| 160 | 160 | .help = if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_provenance()` instead |
| 161 | 161 | |
| 162 | hir_typeck_missing_parentheses_in_range = can't call method `{$method_name}` on type `{$ty_str}` | |
| 162 | hir_typeck_missing_parentheses_in_range = can't call method `{$method_name}` on type `{$ty}` | |
| 163 | 163 | |
| 164 | 164 | hir_typeck_naked_asm_outside_naked_fn = |
| 165 | 165 | the `naked_asm!` macro can only be used in functions marked with `#[unsafe(naked)]` |
| ... | ... | @@ -184,7 +184,7 @@ hir_typeck_never_type_fallback_flowing_into_unsafe_path = never type fallback af |
| 184 | 184 | hir_typeck_never_type_fallback_flowing_into_unsafe_union_field = never type fallback affects this union access |
| 185 | 185 | .help = specify the type explicitly |
| 186 | 186 | |
| 187 | hir_typeck_no_associated_item = no {$item_kind} named `{$item_ident}` found for {$ty_prefix} `{$ty_str}`{$trait_missing_method -> | |
| 187 | hir_typeck_no_associated_item = no {$item_kind} named `{$item_ident}` found for {$ty_prefix} `{$ty}`{$trait_missing_method -> | |
| 188 | 188 | [true] {""} |
| 189 | 189 | *[other] {" "}in the current scope |
| 190 | 190 | } |
compiler/rustc_hir_typeck/src/errors.rs+4-4| ... | ... | @@ -200,11 +200,11 @@ pub(crate) enum ExplicitDestructorCallSugg { |
| 200 | 200 | |
| 201 | 201 | #[derive(Diagnostic)] |
| 202 | 202 | #[diag(hir_typeck_missing_parentheses_in_range, code = E0689)] |
| 203 | pub(crate) struct MissingParenthesesInRange { | |
| 203 | pub(crate) struct MissingParenthesesInRange<'tcx> { | |
| 204 | 204 | #[primary_span] |
| 205 | 205 | #[label(hir_typeck_missing_parentheses_in_range)] |
| 206 | 206 | pub span: Span, |
| 207 | pub ty_str: String, | |
| 207 | pub ty: Ty<'tcx>, | |
| 208 | 208 | pub method_name: String, |
| 209 | 209 | #[subdiagnostic] |
| 210 | 210 | pub add_missing_parentheses: Option<AddMissingParenthesesInRange>, |
| ... | ... | @@ -828,13 +828,13 @@ pub(crate) struct UnlabeledCfInWhileCondition<'a> { |
| 828 | 828 | |
| 829 | 829 | #[derive(Diagnostic)] |
| 830 | 830 | #[diag(hir_typeck_no_associated_item, code = E0599)] |
| 831 | pub(crate) struct NoAssociatedItem { | |
| 831 | pub(crate) struct NoAssociatedItem<'tcx> { | |
| 832 | 832 | #[primary_span] |
| 833 | 833 | pub span: Span, |
| 834 | 834 | pub item_kind: &'static str, |
| 835 | 835 | pub item_ident: Ident, |
| 836 | 836 | pub ty_prefix: Cow<'static, str>, |
| 837 | pub ty_str: String, | |
| 837 | pub ty: Ty<'tcx>, | |
| 838 | 838 | pub trait_missing_method: bool, |
| 839 | 839 | } |
| 840 | 840 |
compiler/rustc_hir_typeck/src/expr.rs+54-45| ... | ... | @@ -2745,6 +2745,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 2745 | 2745 | let available_field_names = self.available_field_names(variant, expr, skip_fields); |
| 2746 | 2746 | if let Some(field_name) = |
| 2747 | 2747 | find_best_match_for_name(&available_field_names, field.ident.name, None) |
| 2748 | && !(field.ident.name.as_str().parse::<usize>().is_ok() | |
| 2749 | && field_name.as_str().parse::<usize>().is_ok()) | |
| 2748 | 2750 | { |
| 2749 | 2751 | err.span_label(field.ident.span, "unknown field"); |
| 2750 | 2752 | err.span_suggestion_verbose( |
| ... | ... | @@ -3321,18 +3323,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 3321 | 3323 | } else { |
| 3322 | 3324 | (base_ty, "") |
| 3323 | 3325 | }; |
| 3324 | for (found_fields, args) in | |
| 3326 | for found_fields in | |
| 3325 | 3327 | self.get_field_candidates_considering_privacy_for_diag(span, ty, mod_id, expr.hir_id) |
| 3326 | 3328 | { |
| 3327 | let field_names = found_fields.iter().map(|field| field.name).collect::<Vec<_>>(); | |
| 3329 | let field_names = found_fields.iter().map(|field| field.0.name).collect::<Vec<_>>(); | |
| 3328 | 3330 | let mut candidate_fields: Vec<_> = found_fields |
| 3329 | 3331 | .into_iter() |
| 3330 | 3332 | .filter_map(|candidate_field| { |
| 3331 | 3333 | self.check_for_nested_field_satisfying_condition_for_diag( |
| 3332 | 3334 | span, |
| 3333 | &|candidate_field, _| candidate_field.ident(self.tcx()) == field, | |
| 3335 | &|candidate_field, _| candidate_field == field, | |
| 3334 | 3336 | candidate_field, |
| 3335 | args, | |
| 3336 | 3337 | vec![], |
| 3337 | 3338 | mod_id, |
| 3338 | 3339 | expr.hir_id, |
| ... | ... | @@ -3361,6 +3362,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 3361 | 3362 | ); |
| 3362 | 3363 | } else if let Some(field_name) = |
| 3363 | 3364 | find_best_match_for_name(&field_names, field.name, None) |
| 3365 | && !(field.name.as_str().parse::<usize>().is_ok() | |
| 3366 | && field_name.as_str().parse::<usize>().is_ok()) | |
| 3364 | 3367 | { |
| 3365 | 3368 | err.span_suggestion_verbose( |
| 3366 | 3369 | field.span, |
| ... | ... | @@ -3396,7 +3399,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 3396 | 3399 | base_ty: Ty<'tcx>, |
| 3397 | 3400 | mod_id: DefId, |
| 3398 | 3401 | hir_id: HirId, |
| 3399 | ) -> Vec<(Vec<&'tcx ty::FieldDef>, GenericArgsRef<'tcx>)> { | |
| 3402 | ) -> Vec<Vec<(Ident, Ty<'tcx>)>> { | |
| 3400 | 3403 | debug!("get_field_candidates(span: {:?}, base_t: {:?}", span, base_ty); |
| 3401 | 3404 | |
| 3402 | 3405 | let mut autoderef = self.autoderef(span, base_ty).silence_errors(); |
| ... | ... | @@ -3422,7 +3425,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 3422 | 3425 | if fields.iter().all(|field| !field.vis.is_accessible_from(mod_id, tcx)) { |
| 3423 | 3426 | return None; |
| 3424 | 3427 | } |
| 3425 | return Some(( | |
| 3428 | return Some( | |
| 3426 | 3429 | fields |
| 3427 | 3430 | .iter() |
| 3428 | 3431 | .filter(move |field| { |
| ... | ... | @@ -3431,9 +3434,25 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 3431 | 3434 | }) |
| 3432 | 3435 | // For compile-time reasons put a limit on number of fields we search |
| 3433 | 3436 | .take(100) |
| 3437 | .map(|field_def| { | |
| 3438 | ( | |
| 3439 | field_def.ident(self.tcx).normalize_to_macros_2_0(), | |
| 3440 | field_def.ty(self.tcx, args), | |
| 3441 | ) | |
| 3442 | }) | |
| 3443 | .collect::<Vec<_>>(), | |
| 3444 | ); | |
| 3445 | } | |
| 3446 | ty::Tuple(types) => { | |
| 3447 | return Some( | |
| 3448 | types | |
| 3449 | .iter() | |
| 3450 | .enumerate() | |
| 3451 | // For compile-time reasons put a limit on number of fields we search | |
| 3452 | .take(100) | |
| 3453 | .map(|(i, ty)| (Ident::from_str(&i.to_string()), ty)) | |
| 3434 | 3454 | .collect::<Vec<_>>(), |
| 3435 | *args, | |
| 3436 | )); | |
| 3455 | ); | |
| 3437 | 3456 | } |
| 3438 | 3457 | _ => None, |
| 3439 | 3458 | } |
| ... | ... | @@ -3443,56 +3462,46 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 3443 | 3462 | |
| 3444 | 3463 | /// This method is called after we have encountered a missing field error to recursively |
| 3445 | 3464 | /// search for the field |
| 3465 | #[instrument(skip(self, matches, mod_id, hir_id), level = "debug")] | |
| 3446 | 3466 | pub(crate) fn check_for_nested_field_satisfying_condition_for_diag( |
| 3447 | 3467 | &self, |
| 3448 | 3468 | span: Span, |
| 3449 | matches: &impl Fn(&ty::FieldDef, Ty<'tcx>) -> bool, | |
| 3450 | candidate_field: &ty::FieldDef, | |
| 3451 | subst: GenericArgsRef<'tcx>, | |
| 3469 | matches: &impl Fn(Ident, Ty<'tcx>) -> bool, | |
| 3470 | (candidate_name, candidate_ty): (Ident, Ty<'tcx>), | |
| 3452 | 3471 | mut field_path: Vec<Ident>, |
| 3453 | 3472 | mod_id: DefId, |
| 3454 | 3473 | hir_id: HirId, |
| 3455 | 3474 | ) -> Option<Vec<Ident>> { |
| 3456 | debug!( | |
| 3457 | "check_for_nested_field_satisfying(span: {:?}, candidate_field: {:?}, field_path: {:?}", | |
| 3458 | span, candidate_field, field_path | |
| 3459 | ); | |
| 3460 | ||
| 3461 | 3475 | if field_path.len() > 3 { |
| 3462 | 3476 | // For compile-time reasons and to avoid infinite recursion we only check for fields |
| 3463 | 3477 | // up to a depth of three |
| 3464 | None | |
| 3465 | } else { | |
| 3466 | field_path.push(candidate_field.ident(self.tcx).normalize_to_macros_2_0()); | |
| 3467 | let field_ty = candidate_field.ty(self.tcx, subst); | |
| 3468 | if matches(candidate_field, field_ty) { | |
| 3469 | return Some(field_path); | |
| 3470 | } else { | |
| 3471 | for (nested_fields, subst) in self | |
| 3472 | .get_field_candidates_considering_privacy_for_diag( | |
| 3473 | span, field_ty, mod_id, hir_id, | |
| 3474 | ) | |
| 3475 | { | |
| 3476 | // recursively search fields of `candidate_field` if it's a ty::Adt | |
| 3477 | for field in nested_fields { | |
| 3478 | if let Some(field_path) = self | |
| 3479 | .check_for_nested_field_satisfying_condition_for_diag( | |
| 3480 | span, | |
| 3481 | matches, | |
| 3482 | field, | |
| 3483 | subst, | |
| 3484 | field_path.clone(), | |
| 3485 | mod_id, | |
| 3486 | hir_id, | |
| 3487 | ) | |
| 3488 | { | |
| 3489 | return Some(field_path); | |
| 3490 | } | |
| 3491 | } | |
| 3478 | return None; | |
| 3479 | } | |
| 3480 | field_path.push(candidate_name); | |
| 3481 | if matches(candidate_name, candidate_ty) { | |
| 3482 | return Some(field_path); | |
| 3483 | } | |
| 3484 | for nested_fields in self.get_field_candidates_considering_privacy_for_diag( | |
| 3485 | span, | |
| 3486 | candidate_ty, | |
| 3487 | mod_id, | |
| 3488 | hir_id, | |
| 3489 | ) { | |
| 3490 | // recursively search fields of `candidate_field` if it's a ty::Adt | |
| 3491 | for field in nested_fields { | |
| 3492 | if let Some(field_path) = self.check_for_nested_field_satisfying_condition_for_diag( | |
| 3493 | span, | |
| 3494 | matches, | |
| 3495 | field, | |
| 3496 | field_path.clone(), | |
| 3497 | mod_id, | |
| 3498 | hir_id, | |
| 3499 | ) { | |
| 3500 | return Some(field_path); | |
| 3492 | 3501 | } |
| 3493 | 3502 | } |
| 3494 | None | |
| 3495 | 3503 | } |
| 3504 | None | |
| 3496 | 3505 | } |
| 3497 | 3506 | |
| 3498 | 3507 | fn check_expr_index( |
compiler/rustc_hir_typeck/src/method/suggest.rs+62-77| ... | ... | @@ -376,16 +376,20 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 376 | 376 | } |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | fn suggest_missing_writer(&self, rcvr_ty: Ty<'tcx>, rcvr_expr: &hir::Expr<'tcx>) -> Diag<'_> { | |
| 380 | let mut file = None; | |
| 379 | fn suggest_missing_writer( | |
| 380 | &self, | |
| 381 | rcvr_ty: Ty<'tcx>, | |
| 382 | rcvr_expr: &hir::Expr<'tcx>, | |
| 383 | mut long_ty_path: Option<PathBuf>, | |
| 384 | ) -> Diag<'_> { | |
| 381 | 385 | let mut err = struct_span_code_err!( |
| 382 | 386 | self.dcx(), |
| 383 | 387 | rcvr_expr.span, |
| 384 | 388 | E0599, |
| 385 | 389 | "cannot write into `{}`", |
| 386 | self.tcx.short_string(rcvr_ty, &mut file), | |
| 390 | self.tcx.short_string(rcvr_ty, &mut long_ty_path), | |
| 387 | 391 | ); |
| 388 | *err.long_ty_path() = file; | |
| 392 | *err.long_ty_path() = long_ty_path; | |
| 389 | 393 | err.span_note( |
| 390 | 394 | rcvr_expr.span, |
| 391 | 395 | "must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method", |
| ... | ... | @@ -403,7 +407,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 403 | 407 | &self, |
| 404 | 408 | self_source: SelfSource<'tcx>, |
| 405 | 409 | method_name: Ident, |
| 406 | ty_str_reported: &str, | |
| 410 | ty: Ty<'tcx>, | |
| 407 | 411 | err: &mut Diag<'_>, |
| 408 | 412 | ) { |
| 409 | 413 | #[derive(Debug)] |
| ... | ... | @@ -478,7 +482,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 478 | 482 | } |
| 479 | 483 | |
| 480 | 484 | // If the shadowed binding has an itializer expression, |
| 481 | // use the initializer expression'ty to try to find the method again. | |
| 485 | // use the initializer expression's ty to try to find the method again. | |
| 482 | 486 | // For example like: `let mut x = Vec::new();`, |
| 483 | 487 | // `Vec::new()` is the itializer expression. |
| 484 | 488 | if let Some(self_ty) = self.fcx.node_ty_opt(binding.init_hir_id) |
| ... | ... | @@ -566,17 +570,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 566 | 570 | let mut span = MultiSpan::from_span(sugg_let.span); |
| 567 | 571 | span.push_span_label(sugg_let.span, |
| 568 | 572 | format!("`{rcvr_name}` of type `{self_ty}` that has method `{method_name}` defined earlier here")); |
| 573 | ||
| 574 | let ty = self.tcx.short_string(ty, err.long_ty_path()); | |
| 569 | 575 | span.push_span_label( |
| 570 | 576 | self.tcx.hir_span(recv_id), |
| 571 | format!( | |
| 572 | "earlier `{rcvr_name}` shadowed here with type `{ty_str_reported}`" | |
| 573 | ), | |
| 577 | format!("earlier `{rcvr_name}` shadowed here with type `{ty}`"), | |
| 574 | 578 | ); |
| 575 | 579 | err.span_note( |
| 576 | 580 | span, |
| 577 | 581 | format!( |
| 578 | 582 | "there's an earlier shadowed binding `{rcvr_name}` of type `{self_ty}` \ |
| 579 | that has method `{method_name}` available" | |
| 583 | that has method `{method_name}` available" | |
| 580 | 584 | ), |
| 581 | 585 | ); |
| 582 | 586 | } |
| ... | ... | @@ -602,15 +606,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 602 | 606 | let tcx = self.tcx; |
| 603 | 607 | let rcvr_ty = self.resolve_vars_if_possible(rcvr_ty); |
| 604 | 608 | let mut ty_file = None; |
| 605 | let (ty_str, short_ty_str) = | |
| 606 | if trait_missing_method && let ty::Dynamic(predicates, _, _) = rcvr_ty.kind() { | |
| 607 | (predicates.to_string(), with_forced_trimmed_paths!(predicates.to_string())) | |
| 608 | } else { | |
| 609 | ( | |
| 610 | tcx.short_string(rcvr_ty, &mut ty_file), | |
| 611 | with_forced_trimmed_paths!(rcvr_ty.to_string()), | |
| 612 | ) | |
| 613 | }; | |
| 614 | 609 | let is_method = mode == Mode::MethodCall; |
| 615 | 610 | let unsatisfied_predicates = &no_match_data.unsatisfied_predicates; |
| 616 | 611 | let similar_candidate = no_match_data.similar_candidate; |
| ... | ... | @@ -629,15 +624,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 629 | 624 | |
| 630 | 625 | // We could pass the file for long types into these two, but it isn't strictly necessary |
| 631 | 626 | // given how targeted they are. |
| 632 | if let Err(guar) = self.report_failed_method_call_on_range_end( | |
| 633 | tcx, | |
| 634 | rcvr_ty, | |
| 635 | source, | |
| 636 | span, | |
| 637 | item_ident, | |
| 638 | &short_ty_str, | |
| 639 | &mut ty_file, | |
| 640 | ) { | |
| 627 | if let Err(guar) = | |
| 628 | self.report_failed_method_call_on_range_end(tcx, rcvr_ty, source, span, item_ident) | |
| 629 | { | |
| 641 | 630 | return guar; |
| 642 | 631 | } |
| 643 | 632 | if let Err(guar) = self.report_failed_method_call_on_numerical_infer_var( |
| ... | ... | @@ -647,44 +636,42 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 647 | 636 | span, |
| 648 | 637 | item_kind, |
| 649 | 638 | item_ident, |
| 650 | &short_ty_str, | |
| 651 | 639 | &mut ty_file, |
| 652 | 640 | ) { |
| 653 | 641 | return guar; |
| 654 | 642 | } |
| 655 | 643 | span = item_ident.span; |
| 656 | 644 | |
| 657 | // Don't show generic arguments when the method can't be found in any implementation (#81576). | |
| 658 | let mut ty_str_reported = ty_str.clone(); | |
| 659 | if let ty::Adt(_, generics) = rcvr_ty.kind() { | |
| 660 | if generics.len() > 0 { | |
| 661 | let mut autoderef = self.autoderef(span, rcvr_ty).silence_errors(); | |
| 662 | let candidate_found = autoderef.any(|(ty, _)| { | |
| 663 | if let ty::Adt(adt_def, _) = ty.kind() { | |
| 664 | self.tcx | |
| 665 | .inherent_impls(adt_def.did()) | |
| 666 | .into_iter() | |
| 667 | .any(|def_id| self.associated_value(*def_id, item_ident).is_some()) | |
| 668 | } else { | |
| 669 | false | |
| 670 | } | |
| 671 | }); | |
| 672 | let has_deref = autoderef.step_count() > 0; | |
| 673 | if !candidate_found && !has_deref && unsatisfied_predicates.is_empty() { | |
| 674 | if let Some((path_string, _)) = ty_str.split_once('<') { | |
| 675 | ty_str_reported = path_string.to_string(); | |
| 676 | } | |
| 677 | } | |
| 678 | } | |
| 679 | } | |
| 680 | ||
| 681 | 645 | let is_write = sugg_span.ctxt().outer_expn_data().macro_def_id.is_some_and(|def_id| { |
| 682 | 646 | tcx.is_diagnostic_item(sym::write_macro, def_id) |
| 683 | 647 | || tcx.is_diagnostic_item(sym::writeln_macro, def_id) |
| 684 | 648 | }) && item_ident.name == sym::write_fmt; |
| 685 | 649 | let mut err = if is_write && let SelfSource::MethodCall(rcvr_expr) = source { |
| 686 | self.suggest_missing_writer(rcvr_ty, rcvr_expr) | |
| 650 | self.suggest_missing_writer(rcvr_ty, rcvr_expr, ty_file) | |
| 687 | 651 | } else { |
| 652 | // Don't show expanded generic arguments when the method can't be found in any | |
| 653 | // implementation (#81576). | |
| 654 | let mut ty = rcvr_ty; | |
| 655 | if let ty::Adt(def, generics) = rcvr_ty.kind() { | |
| 656 | if generics.len() > 0 { | |
| 657 | let mut autoderef = self.autoderef(span, rcvr_ty).silence_errors(); | |
| 658 | let candidate_found = autoderef.any(|(ty, _)| { | |
| 659 | if let ty::Adt(adt_def, _) = ty.kind() { | |
| 660 | self.tcx | |
| 661 | .inherent_impls(adt_def.did()) | |
| 662 | .into_iter() | |
| 663 | .any(|def_id| self.associated_value(*def_id, item_ident).is_some()) | |
| 664 | } else { | |
| 665 | false | |
| 666 | } | |
| 667 | }); | |
| 668 | let has_deref = autoderef.step_count() > 0; | |
| 669 | if !candidate_found && !has_deref && unsatisfied_predicates.is_empty() { | |
| 670 | ty = self.tcx.at(span).type_of(def.did()).instantiate_identity(); | |
| 671 | } | |
| 672 | } | |
| 673 | } | |
| 674 | ||
| 688 | 675 | let mut err = self.dcx().create_err(NoAssociatedItem { |
| 689 | 676 | span, |
| 690 | 677 | item_kind, |
| ... | ... | @@ -695,16 +682,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 695 | 682 | } else { |
| 696 | 683 | rcvr_ty.prefix_string(self.tcx) |
| 697 | 684 | }, |
| 698 | ty_str: ty_str_reported.clone(), | |
| 685 | ty, | |
| 699 | 686 | trait_missing_method, |
| 700 | 687 | }); |
| 701 | 688 | |
| 702 | 689 | if is_method { |
| 703 | 690 | self.suggest_use_shadowed_binding_with_method( |
| 704 | source, | |
| 705 | item_ident, | |
| 706 | &ty_str_reported, | |
| 707 | &mut err, | |
| 691 | source, item_ident, rcvr_ty, &mut err, | |
| 708 | 692 | ); |
| 709 | 693 | } |
| 710 | 694 | |
| ... | ... | @@ -734,6 +718,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 734 | 718 | |
| 735 | 719 | err |
| 736 | 720 | }; |
| 721 | ||
| 737 | 722 | if tcx.sess.source_map().is_multiline(sugg_span) { |
| 738 | 723 | err.span_label(sugg_span.with_hi(span.lo()), ""); |
| 739 | 724 | } |
| ... | ... | @@ -750,6 +735,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 750 | 735 | } |
| 751 | 736 | |
| 752 | 737 | if tcx.ty_is_opaque_future(rcvr_ty) && item_ident.name == sym::poll { |
| 738 | let ty_str = self.tcx.short_string(rcvr_ty, err.long_ty_path()); | |
| 753 | 739 | err.help(format!( |
| 754 | 740 | "method `poll` found on `Pin<&mut {ty_str}>`, \ |
| 755 | 741 | see documentation for `std::pin::Pin`" |
| ... | ... | @@ -1339,7 +1325,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 1339 | 1325 | } |
| 1340 | 1326 | let OnUnimplementedNote { message, label, notes, .. } = self |
| 1341 | 1327 | .err_ctxt() |
| 1342 | .on_unimplemented_note(trait_ref, &obligation, &mut ty_file); | |
| 1328 | .on_unimplemented_note(trait_ref, &obligation, err.long_ty_path()); | |
| 1343 | 1329 | (message, label, notes) |
| 1344 | 1330 | }) |
| 1345 | 1331 | .unwrap() |
| ... | ... | @@ -1347,6 +1333,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 1347 | 1333 | (None, None, Vec::new()) |
| 1348 | 1334 | }; |
| 1349 | 1335 | let primary_message = primary_message.unwrap_or_else(|| { |
| 1336 | let ty_str = self.tcx.short_string(rcvr_ty, err.long_ty_path()); | |
| 1350 | 1337 | format!( |
| 1351 | 1338 | "the {item_kind} `{item_ident}` exists for {actual_prefix} `{ty_str}`, \ |
| 1352 | 1339 | but its trait bounds were not satisfied" |
| ... | ... | @@ -1409,6 +1396,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 1409 | 1396 | let mut find_candidate_for_method = false; |
| 1410 | 1397 | |
| 1411 | 1398 | let mut label_span_not_found = |err: &mut Diag<'_>| { |
| 1399 | let ty_str = self.tcx.short_string(rcvr_ty, err.long_ty_path()); | |
| 1412 | 1400 | if unsatisfied_predicates.is_empty() { |
| 1413 | 1401 | err.span_label(span, format!("{item_kind} not found in `{ty_str}`")); |
| 1414 | 1402 | let is_string_or_ref_str = match rcvr_ty.kind() { |
| ... | ... | @@ -2520,8 +2508,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 2520 | 2508 | source: SelfSource<'tcx>, |
| 2521 | 2509 | span: Span, |
| 2522 | 2510 | item_name: Ident, |
| 2523 | ty_str: &str, | |
| 2524 | long_ty_path: &mut Option<PathBuf>, | |
| 2525 | 2511 | ) -> Result<(), ErrorGuaranteed> { |
| 2526 | 2512 | if let SelfSource::MethodCall(expr) = source { |
| 2527 | 2513 | for (_, parent) in tcx.hir_parent_iter(expr.hir_id).take(5) { |
| ... | ... | @@ -2583,18 +2569,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 2583 | 2569 | ); |
| 2584 | 2570 | if pick.is_ok() { |
| 2585 | 2571 | let range_span = parent_expr.span.with_hi(expr.span.hi()); |
| 2586 | let mut err = self.dcx().create_err(errors::MissingParenthesesInRange { | |
| 2572 | return Err(self.dcx().emit_err(errors::MissingParenthesesInRange { | |
| 2587 | 2573 | span, |
| 2588 | ty_str: ty_str.to_string(), | |
| 2574 | ty: actual, | |
| 2589 | 2575 | method_name: item_name.as_str().to_string(), |
| 2590 | 2576 | add_missing_parentheses: Some(errors::AddMissingParenthesesInRange { |
| 2591 | 2577 | func_name: item_name.name.as_str().to_string(), |
| 2592 | 2578 | left: range_span.shrink_to_lo(), |
| 2593 | 2579 | right: range_span.shrink_to_hi(), |
| 2594 | 2580 | }), |
| 2595 | }); | |
| 2596 | *err.long_ty_path() = long_ty_path.take(); | |
| 2597 | return Err(err.emit()); | |
| 2581 | })); | |
| 2598 | 2582 | } |
| 2599 | 2583 | } |
| 2600 | 2584 | } |
| ... | ... | @@ -2610,7 +2594,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 2610 | 2594 | span: Span, |
| 2611 | 2595 | item_kind: &str, |
| 2612 | 2596 | item_name: Ident, |
| 2613 | ty_str: &str, | |
| 2614 | 2597 | long_ty_path: &mut Option<PathBuf>, |
| 2615 | 2598 | ) -> Result<(), ErrorGuaranteed> { |
| 2616 | 2599 | let found_candidate = all_traits(self.tcx) |
| ... | ... | @@ -2643,14 +2626,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 2643 | 2626 | && !actual.has_concrete_skeleton() |
| 2644 | 2627 | && let SelfSource::MethodCall(expr) = source |
| 2645 | 2628 | { |
| 2629 | let ty_str = self.tcx.short_string(actual, long_ty_path); | |
| 2646 | 2630 | let mut err = struct_span_code_err!( |
| 2647 | 2631 | self.dcx(), |
| 2648 | 2632 | span, |
| 2649 | 2633 | E0689, |
| 2650 | "can't call {} `{}` on ambiguous numeric type `{}`", | |
| 2651 | item_kind, | |
| 2652 | item_name, | |
| 2653 | ty_str | |
| 2634 | "can't call {item_kind} `{item_name}` on ambiguous numeric type `{ty_str}`" | |
| 2654 | 2635 | ); |
| 2655 | 2636 | *err.long_ty_path() = long_ty_path.take(); |
| 2656 | 2637 | let concrete_type = if actual.is_integral() { "i32" } else { "f32" }; |
| ... | ... | @@ -2792,7 +2773,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 2792 | 2773 | ) { |
| 2793 | 2774 | if let SelfSource::MethodCall(expr) = source { |
| 2794 | 2775 | let mod_id = self.tcx.parent_module(expr.hir_id).to_def_id(); |
| 2795 | for (fields, args) in self.get_field_candidates_considering_privacy_for_diag( | |
| 2776 | for fields in self.get_field_candidates_considering_privacy_for_diag( | |
| 2796 | 2777 | span, |
| 2797 | 2778 | actual, |
| 2798 | 2779 | mod_id, |
| ... | ... | @@ -2831,7 +2812,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 2831 | 2812 | }) |
| 2832 | 2813 | }, |
| 2833 | 2814 | candidate_field, |
| 2834 | args, | |
| 2835 | 2815 | vec![], |
| 2836 | 2816 | mod_id, |
| 2837 | 2817 | expr.hir_id, |
| ... | ... | @@ -3671,7 +3651,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 3671 | 3651 | ) |
| 3672 | 3652 | { |
| 3673 | 3653 | debug!("try_alt_rcvr: pick candidate {:?}", pick); |
| 3674 | let did = Some(pick.item.container_id(self.tcx)); | |
| 3654 | let did = pick.item.trait_container(self.tcx); | |
| 3675 | 3655 | // We don't want to suggest a container type when the missing |
| 3676 | 3656 | // method is `.clone()` or `.deref()` otherwise we'd suggest |
| 3677 | 3657 | // `Arc::new(foo).clone()`, which is far from what the user wants. |
| ... | ... | @@ -3720,8 +3700,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 3720 | 3700 | && !alt_rcvr_sugg |
| 3721 | 3701 | // `T: !Unpin` |
| 3722 | 3702 | && !unpin |
| 3723 | // The method isn't `as_ref`, as it would provide a wrong suggestion for `Pin`. | |
| 3724 | && sym::as_ref != item_name.name | |
| 3725 | 3703 | // Either `Pin::as_ref` or `Pin::as_mut`. |
| 3726 | 3704 | && let Some(pin_call) = pin_call |
| 3727 | 3705 | // Search for `item_name` as a method accessible on `Pin<T>`. |
| ... | ... | @@ -3735,6 +3713,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 3735 | 3713 | // We skip some common traits that we don't want to consider because autoderefs |
| 3736 | 3714 | // would take care of them. |
| 3737 | 3715 | && !skippable.contains(&Some(pick.item.container_id(self.tcx))) |
| 3716 | // Do not suggest pinning when the method is directly on `Pin`. | |
| 3717 | && pick.item.impl_container(self.tcx).map_or(true, |did| { | |
| 3718 | match self.tcx.type_of(did).skip_binder().kind() { | |
| 3719 | ty::Adt(def, _) => Some(def.did()) != self.tcx.lang_items().pin_type(), | |
| 3720 | _ => true, | |
| 3721 | } | |
| 3722 | }) | |
| 3738 | 3723 | // We don't want to go through derefs. |
| 3739 | 3724 | && pick.autoderefs == 0 |
| 3740 | 3725 | // Check that the method of the same name that was found on the new `Pin<T>` |
compiler/rustc_metadata/src/native_libs.rs+1-1| ... | ... | @@ -83,7 +83,7 @@ pub fn walk_native_lib_search_dirs<R>( |
| 83 | 83 | // Mac Catalyst uses the macOS SDK, but to link to iOS-specific frameworks |
| 84 | 84 | // we must have the support library stubs in the library search path (#121430). |
| 85 | 85 | if let Some(sdk_root) = apple_sdk_root |
| 86 | && sess.target.llvm_target.contains("macabi") | |
| 86 | && sess.target.env == "macabi" | |
| 87 | 87 | { |
| 88 | 88 | f(&sdk_root.join("System/iOSSupport/usr/lib"), false)?; |
| 89 | 89 | f(&sdk_root.join("System/iOSSupport/System/Library/Frameworks"), true)?; |
compiler/rustc_middle/src/ty/generic_args.rs+12-5| ... | ... | @@ -527,21 +527,28 @@ impl<'tcx> GenericArgs<'tcx> { |
| 527 | 527 | #[inline] |
| 528 | 528 | #[track_caller] |
| 529 | 529 | pub fn type_at(&self, i: usize) -> Ty<'tcx> { |
| 530 | self[i].as_type().unwrap_or_else(|| bug!("expected type for param #{} in {:?}", i, self)) | |
| 530 | self[i].as_type().unwrap_or_else( | |
| 531 | #[track_caller] | |
| 532 | || bug!("expected type for param #{} in {:?}", i, self), | |
| 533 | ) | |
| 531 | 534 | } |
| 532 | 535 | |
| 533 | 536 | #[inline] |
| 534 | 537 | #[track_caller] |
| 535 | 538 | pub fn region_at(&self, i: usize) -> ty::Region<'tcx> { |
| 536 | self[i] | |
| 537 | .as_region() | |
| 538 | .unwrap_or_else(|| bug!("expected region for param #{} in {:?}", i, self)) | |
| 539 | self[i].as_region().unwrap_or_else( | |
| 540 | #[track_caller] | |
| 541 | || bug!("expected region for param #{} in {:?}", i, self), | |
| 542 | ) | |
| 539 | 543 | } |
| 540 | 544 | |
| 541 | 545 | #[inline] |
| 542 | 546 | #[track_caller] |
| 543 | 547 | pub fn const_at(&self, i: usize) -> ty::Const<'tcx> { |
| 544 | self[i].as_const().unwrap_or_else(|| bug!("expected const for param #{} in {:?}", i, self)) | |
| 548 | self[i].as_const().unwrap_or_else( | |
| 549 | #[track_caller] | |
| 550 | || bug!("expected const for param #{} in {:?}", i, self), | |
| 551 | ) | |
| 545 | 552 | } |
| 546 | 553 | |
| 547 | 554 | #[inline] |
compiler/rustc_middle/src/ty/print/pretty.rs+1-1| ... | ... | @@ -2987,7 +2987,7 @@ impl<'tcx> ty::Binder<'tcx, ty::TraitRef<'tcx>> { |
| 2987 | 2987 | } |
| 2988 | 2988 | } |
| 2989 | 2989 | |
| 2990 | #[derive(Copy, Clone, TypeFoldable, TypeVisitable, Lift)] | |
| 2990 | #[derive(Copy, Clone, TypeFoldable, TypeVisitable, Lift, Hash)] | |
| 2991 | 2991 | pub struct TraitPredPrintModifiersAndPath<'tcx>(ty::TraitPredicate<'tcx>); |
| 2992 | 2992 | |
| 2993 | 2993 | impl<'tcx> fmt::Debug for TraitPredPrintModifiersAndPath<'tcx> { |
compiler/rustc_pattern_analysis/src/constructor.rs+5-5| ... | ... | @@ -1130,16 +1130,16 @@ impl<Cx: PatCx> ConstructorSet<Cx> { |
| 1130 | 1130 | seen_false = true; |
| 1131 | 1131 | } |
| 1132 | 1132 | } |
| 1133 | if seen_false { | |
| 1134 | present.push(Bool(false)); | |
| 1135 | } else { | |
| 1136 | missing.push(Bool(false)); | |
| 1137 | } | |
| 1138 | 1133 | if seen_true { |
| 1139 | 1134 | present.push(Bool(true)); |
| 1140 | 1135 | } else { |
| 1141 | 1136 | missing.push(Bool(true)); |
| 1142 | 1137 | } |
| 1138 | if seen_false { | |
| 1139 | present.push(Bool(false)); | |
| 1140 | } else { | |
| 1141 | missing.push(Bool(false)); | |
| 1142 | } | |
| 1143 | 1143 | } |
| 1144 | 1144 | ConstructorSet::Integers { range_1, range_2 } => { |
| 1145 | 1145 | let seen_ranges: Vec<_> = |
compiler/rustc_pattern_analysis/tests/exhaustiveness.rs+3| ... | ... | @@ -176,6 +176,9 @@ fn test_witnesses() { |
| 176 | 176 | ), |
| 177 | 177 | vec!["Enum::Variant1(_)", "Enum::Variant2(_)", "_"], |
| 178 | 178 | ); |
| 179 | ||
| 180 | // Assert we put `true` before `false`. | |
| 181 | assert_witnesses(AllOfThem, Ty::Bool, Vec::new(), vec!["true", "false"]); | |
| 179 | 182 | } |
| 180 | 183 | |
| 181 | 184 | #[test] |
compiler/rustc_resolve/messages.ftl+1-1| ... | ... | @@ -243,7 +243,7 @@ resolve_lowercase_self = |
| 243 | 243 | .suggestion = try using `Self` |
| 244 | 244 | |
| 245 | 245 | resolve_macro_cannot_use_as_attr = |
| 246 | `{$ident}` exists, but a declarative macro cannot be used as an attribute macro | |
| 246 | `{$ident}` exists, but has no `attr` rules | |
| 247 | 247 | |
| 248 | 248 | resolve_macro_cannot_use_as_derive = |
| 249 | 249 | `{$ident}` exists, but a declarative macro cannot be used as a derive macro |
compiler/rustc_resolve/src/ident.rs+16-4| ... | ... | @@ -631,9 +631,21 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 631 | 631 | }; |
| 632 | 632 | |
| 633 | 633 | match result { |
| 634 | Ok((binding, flags)) | |
| 635 | if sub_namespace_match(binding.macro_kind(), macro_kind) => | |
| 636 | { | |
| 634 | Ok((binding, flags)) => { | |
| 635 | let binding_macro_kind = binding.macro_kind(); | |
| 636 | // If we're looking for an attribute, that might be supported by a | |
| 637 | // `macro_rules!` macro. | |
| 638 | // FIXME: Replace this with tracking multiple macro kinds for one Def. | |
| 639 | if !(sub_namespace_match(binding_macro_kind, macro_kind) | |
| 640 | || (binding_macro_kind == Some(MacroKind::Bang) | |
| 641 | && macro_kind == Some(MacroKind::Attr) | |
| 642 | && this | |
| 643 | .get_macro(binding.res()) | |
| 644 | .is_some_and(|macro_data| macro_data.attr_ext.is_some()))) | |
| 645 | { | |
| 646 | return None; | |
| 647 | } | |
| 648 | ||
| 637 | 649 | if finalize.is_none() || matches!(scope_set, ScopeSet::Late(..)) { |
| 638 | 650 | return Some(Ok(binding)); |
| 639 | 651 | } |
| ... | ... | @@ -710,7 +722,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 710 | 722 | innermost_result = Some((binding, flags)); |
| 711 | 723 | } |
| 712 | 724 | } |
| 713 | Ok(..) | Err(Determinacy::Determined) => {} | |
| 725 | Err(Determinacy::Determined) => {} | |
| 714 | 726 | Err(Determinacy::Undetermined) => determinacy = Determinacy::Undetermined, |
| 715 | 727 | } |
| 716 | 728 |
compiler/rustc_resolve/src/lib.rs+2-1| ... | ... | @@ -1029,13 +1029,14 @@ struct DeriveData { |
| 1029 | 1029 | |
| 1030 | 1030 | struct MacroData { |
| 1031 | 1031 | ext: Arc<SyntaxExtension>, |
| 1032 | attr_ext: Option<Arc<SyntaxExtension>>, | |
| 1032 | 1033 | nrules: usize, |
| 1033 | 1034 | macro_rules: bool, |
| 1034 | 1035 | } |
| 1035 | 1036 | |
| 1036 | 1037 | impl MacroData { |
| 1037 | 1038 | fn new(ext: Arc<SyntaxExtension>) -> MacroData { |
| 1038 | MacroData { ext, nrules: 0, macro_rules: false } | |
| 1039 | MacroData { ext, attr_ext: None, nrules: 0, macro_rules: false } | |
| 1039 | 1040 | } |
| 1040 | 1041 | } |
| 1041 | 1042 |
compiler/rustc_resolve/src/macros.rs+7-3| ... | ... | @@ -842,7 +842,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 842 | 842 | } |
| 843 | 843 | _ => None, |
| 844 | 844 | }, |
| 845 | None => self.get_macro(res).map(|macro_data| Arc::clone(&macro_data.ext)), | |
| 845 | None => self.get_macro(res).map(|macro_data| match kind { | |
| 846 | Some(MacroKind::Attr) if let Some(ref ext) = macro_data.attr_ext => Arc::clone(ext), | |
| 847 | _ => Arc::clone(&macro_data.ext), | |
| 848 | }), | |
| 846 | 849 | }; |
| 847 | 850 | Ok((ext, res)) |
| 848 | 851 | } |
| ... | ... | @@ -1178,7 +1181,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 1178 | 1181 | node_id: NodeId, |
| 1179 | 1182 | edition: Edition, |
| 1180 | 1183 | ) -> MacroData { |
| 1181 | let (mut ext, mut nrules) = compile_declarative_macro( | |
| 1184 | let (mut ext, mut attr_ext, mut nrules) = compile_declarative_macro( | |
| 1182 | 1185 | self.tcx.sess, |
| 1183 | 1186 | self.tcx.features(), |
| 1184 | 1187 | macro_def, |
| ... | ... | @@ -1195,13 +1198,14 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 1195 | 1198 | // The macro is a built-in, replace its expander function |
| 1196 | 1199 | // while still taking everything else from the source code. |
| 1197 | 1200 | ext.kind = builtin_ext_kind.clone(); |
| 1201 | attr_ext = None; | |
| 1198 | 1202 | nrules = 0; |
| 1199 | 1203 | } else { |
| 1200 | 1204 | self.dcx().emit_err(errors::CannotFindBuiltinMacroWithName { span, ident }); |
| 1201 | 1205 | } |
| 1202 | 1206 | } |
| 1203 | 1207 | |
| 1204 | MacroData { ext: Arc::new(ext), nrules, macro_rules: macro_def.macro_rules } | |
| 1208 | MacroData { ext: Arc::new(ext), attr_ext, nrules, macro_rules: macro_def.macro_rules } | |
| 1205 | 1209 | } |
| 1206 | 1210 | |
| 1207 | 1211 | fn path_accessible( |
compiler/rustc_span/src/symbol.rs+1| ... | ... | @@ -1311,6 +1311,7 @@ symbols! { |
| 1311 | 1311 | lt, |
| 1312 | 1312 | m68k_target_feature, |
| 1313 | 1313 | macro_at_most_once_rep, |
| 1314 | macro_attr, | |
| 1314 | 1315 | macro_attributes_in_derive_output, |
| 1315 | 1316 | macro_concat, |
| 1316 | 1317 | macro_escape, |
compiler/rustc_target/src/spec/base/apple/mod.rs+25-18| ... | ... | @@ -51,14 +51,14 @@ impl Arch { |
| 51 | 51 | }) |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | fn target_cpu(self, abi: TargetAbi) -> &'static str { | |
| 54 | fn target_cpu(self, env: TargetEnv) -> &'static str { | |
| 55 | 55 | match self { |
| 56 | 56 | Armv7k => "cortex-a8", |
| 57 | 57 | Armv7s => "swift", // iOS 10 is only supported on iPhone 5 or higher. |
| 58 | Arm64 => match abi { | |
| 59 | TargetAbi::Normal => "apple-a7", | |
| 60 | TargetAbi::Simulator => "apple-a12", | |
| 61 | TargetAbi::MacCatalyst => "apple-a12", | |
| 58 | Arm64 => match env { | |
| 59 | TargetEnv::Normal => "apple-a7", | |
| 60 | TargetEnv::Simulator => "apple-a12", | |
| 61 | TargetEnv::MacCatalyst => "apple-a12", | |
| 62 | 62 | }, |
| 63 | 63 | Arm64e => "apple-a12", |
| 64 | 64 | Arm64_32 => "apple-s4", |
| ... | ... | @@ -83,14 +83,14 @@ impl Arch { |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | #[derive(Copy, Clone, PartialEq)] |
| 86 | pub(crate) enum TargetAbi { | |
| 86 | pub(crate) enum TargetEnv { | |
| 87 | 87 | Normal, |
| 88 | 88 | Simulator, |
| 89 | 89 | MacCatalyst, |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | impl TargetAbi { | |
| 93 | fn target_abi(self) -> &'static str { | |
| 92 | impl TargetEnv { | |
| 93 | fn target_env(self) -> &'static str { | |
| 94 | 94 | match self { |
| 95 | 95 | Self::Normal => "", |
| 96 | 96 | Self::MacCatalyst => "macabi", |
| ... | ... | @@ -104,13 +104,20 @@ impl TargetAbi { |
| 104 | 104 | pub(crate) fn base( |
| 105 | 105 | os: &'static str, |
| 106 | 106 | arch: Arch, |
| 107 | abi: TargetAbi, | |
| 107 | env: TargetEnv, | |
| 108 | 108 | ) -> (TargetOptions, StaticCow<str>, StaticCow<str>) { |
| 109 | 109 | let mut opts = TargetOptions { |
| 110 | abi: abi.target_abi().into(), | |
| 111 | 110 | llvm_floatabi: Some(FloatAbi::Hard), |
| 112 | 111 | os: os.into(), |
| 113 | cpu: arch.target_cpu(abi).into(), | |
| 112 | env: env.target_env().into(), | |
| 113 | // NOTE: We originally set `cfg(target_abi = "macabi")` / `cfg(target_abi = "sim")`, | |
| 114 | // before it was discovered that those are actually environments: | |
| 115 | // https://github.com/rust-lang/rust/issues/133331 | |
| 116 | // | |
| 117 | // But let's continue setting them for backwards compatibility. | |
| 118 | // FIXME(madsmtm): Warn about using these in the future. | |
| 119 | abi: env.target_env().into(), | |
| 120 | cpu: arch.target_cpu(env).into(), | |
| 114 | 121 | link_env_remove: link_env_remove(os), |
| 115 | 122 | vendor: "apple".into(), |
| 116 | 123 | linker_flavor: LinkerFlavor::Darwin(Cc::Yes, Lld::No), |
| ... | ... | @@ -168,14 +175,14 @@ pub(crate) fn base( |
| 168 | 175 | // All Apple x86-32 targets have SSE2. |
| 169 | 176 | opts.rustc_abi = Some(RustcAbi::X86Sse2); |
| 170 | 177 | } |
| 171 | (opts, unversioned_llvm_target(os, arch, abi), arch.target_arch()) | |
| 178 | (opts, unversioned_llvm_target(os, arch, env), arch.target_arch()) | |
| 172 | 179 | } |
| 173 | 180 | |
| 174 | 181 | /// Generate part of the LLVM target triple. |
| 175 | 182 | /// |
| 176 | 183 | /// See `rustc_codegen_ssa::back::versioned_llvm_target` for the full triple passed to LLVM and |
| 177 | 184 | /// Clang. |
| 178 | fn unversioned_llvm_target(os: &str, arch: Arch, abi: TargetAbi) -> StaticCow<str> { | |
| 185 | fn unversioned_llvm_target(os: &str, arch: Arch, env: TargetEnv) -> StaticCow<str> { | |
| 179 | 186 | let arch = arch.target_name(); |
| 180 | 187 | // Convert to the "canonical" OS name used by LLVM: |
| 181 | 188 | // https://github.com/llvm/llvm-project/blob/llvmorg-18.1.8/llvm/lib/TargetParser/Triple.cpp#L236-L282 |
| ... | ... | @@ -187,10 +194,10 @@ fn unversioned_llvm_target(os: &str, arch: Arch, abi: TargetAbi) -> StaticCow<st |
| 187 | 194 | "visionos" => "xros", |
| 188 | 195 | _ => unreachable!("tried to get LLVM target OS for non-Apple platform"), |
| 189 | 196 | }; |
| 190 | let environment = match abi { | |
| 191 | TargetAbi::Normal => "", | |
| 192 | TargetAbi::MacCatalyst => "-macabi", | |
| 193 | TargetAbi::Simulator => "-simulator", | |
| 197 | let environment = match env { | |
| 198 | TargetEnv::Normal => "", | |
| 199 | TargetEnv::MacCatalyst => "-macabi", | |
| 200 | TargetEnv::Simulator => "-simulator", | |
| 194 | 201 | }; |
| 195 | 202 | format!("{arch}-apple-{os}{environment}").into() |
| 196 | 203 | } |
| ... | ... | @@ -309,7 +316,7 @@ impl OSVersion { |
| 309 | 316 | /// This matches what LLVM does, see in part: |
| 310 | 317 | /// <https://github.com/llvm/llvm-project/blob/llvmorg-18.1.8/llvm/lib/TargetParser/Triple.cpp#L1900-L1932> |
| 311 | 318 | pub fn minimum_deployment_target(target: &Target) -> Self { |
| 312 | let (major, minor, patch) = match (&*target.os, &*target.arch, &*target.abi) { | |
| 319 | let (major, minor, patch) = match (&*target.os, &*target.arch, &*target.env) { | |
| 313 | 320 | ("macos", "aarch64", _) => (11, 0, 0), |
| 314 | 321 | ("ios", "aarch64", "macabi") => (14, 0, 0), |
| 315 | 322 | ("ios", "aarch64", "sim") => (14, 0, 0), |
compiler/rustc_target/src/spec/base/apple/tests.rs+4-2| ... | ... | @@ -6,7 +6,7 @@ use crate::spec::targets::{ |
| 6 | 6 | }; |
| 7 | 7 | |
| 8 | 8 | #[test] |
| 9 | fn simulator_targets_set_abi() { | |
| 9 | fn simulator_targets_set_env() { | |
| 10 | 10 | let all_sim_targets = [ |
| 11 | 11 | x86_64_apple_ios::target(), |
| 12 | 12 | x86_64_apple_tvos::target(), |
| ... | ... | @@ -18,7 +18,9 @@ fn simulator_targets_set_abi() { |
| 18 | 18 | ]; |
| 19 | 19 | |
| 20 | 20 | for target in &all_sim_targets { |
| 21 | assert_eq!(target.abi, "sim") | |
| 21 | assert_eq!(target.env, "sim"); | |
| 22 | // Ensure backwards compat | |
| 23 | assert_eq!(target.abi, "sim"); | |
| 22 | 24 | } |
| 23 | 25 | } |
| 24 | 26 |
compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (opts, llvm_target, arch) = base("macos", Arch::Arm64, TargetAbi::Normal); | |
| 5 | let (opts, llvm_target, arch) = base("macos", Arch::Arm64, TargetEnv::Normal); | |
| 6 | 6 | Target { |
| 7 | 7 | llvm_target, |
| 8 | 8 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (opts, llvm_target, arch) = base("ios", Arch::Arm64, TargetAbi::Normal); | |
| 5 | let (opts, llvm_target, arch) = base("ios", Arch::Arm64, TargetEnv::Normal); | |
| 6 | 6 | Target { |
| 7 | 7 | llvm_target, |
| 8 | 8 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (opts, llvm_target, arch) = base("ios", Arch::Arm64, TargetAbi::MacCatalyst); | |
| 5 | let (opts, llvm_target, arch) = base("ios", Arch::Arm64, TargetEnv::MacCatalyst); | |
| 6 | 6 | Target { |
| 7 | 7 | llvm_target, |
| 8 | 8 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (opts, llvm_target, arch) = base("ios", Arch::Arm64, TargetAbi::Simulator); | |
| 5 | let (opts, llvm_target, arch) = base("ios", Arch::Arm64, TargetEnv::Simulator); | |
| 6 | 6 | Target { |
| 7 | 7 | llvm_target, |
| 8 | 8 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (opts, llvm_target, arch) = base("tvos", Arch::Arm64, TargetAbi::Normal); | |
| 5 | let (opts, llvm_target, arch) = base("tvos", Arch::Arm64, TargetEnv::Normal); | |
| 6 | 6 | Target { |
| 7 | 7 | llvm_target, |
| 8 | 8 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (opts, llvm_target, arch) = base("tvos", Arch::Arm64, TargetAbi::Simulator); | |
| 5 | let (opts, llvm_target, arch) = base("tvos", Arch::Arm64, TargetEnv::Simulator); | |
| 6 | 6 | Target { |
| 7 | 7 | llvm_target, |
| 8 | 8 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/aarch64_apple_visionos.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (opts, llvm_target, arch) = base("visionos", Arch::Arm64, TargetAbi::Normal); | |
| 5 | let (opts, llvm_target, arch) = base("visionos", Arch::Arm64, TargetEnv::Normal); | |
| 6 | 6 | Target { |
| 7 | 7 | llvm_target, |
| 8 | 8 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/aarch64_apple_visionos_sim.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (opts, llvm_target, arch) = base("visionos", Arch::Arm64, TargetAbi::Simulator); | |
| 5 | let (opts, llvm_target, arch) = base("visionos", Arch::Arm64, TargetEnv::Simulator); | |
| 6 | 6 | Target { |
| 7 | 7 | llvm_target, |
| 8 | 8 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (opts, llvm_target, arch) = base("watchos", Arch::Arm64, TargetAbi::Normal); | |
| 5 | let (opts, llvm_target, arch) = base("watchos", Arch::Arm64, TargetEnv::Normal); | |
| 6 | 6 | Target { |
| 7 | 7 | llvm_target, |
| 8 | 8 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (opts, llvm_target, arch) = base("watchos", Arch::Arm64, TargetAbi::Simulator); | |
| 5 | let (opts, llvm_target, arch) = base("watchos", Arch::Arm64, TargetEnv::Simulator); | |
| 6 | 6 | Target { |
| 7 | 7 | llvm_target, |
| 8 | 8 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (opts, llvm_target, arch) = base("watchos", Arch::Arm64_32, TargetAbi::Normal); | |
| 5 | let (opts, llvm_target, arch) = base("watchos", Arch::Arm64_32, TargetEnv::Normal); | |
| 6 | 6 | Target { |
| 7 | 7 | llvm_target, |
| 8 | 8 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (opts, llvm_target, arch) = base("macos", Arch::Arm64e, TargetAbi::Normal); | |
| 5 | let (opts, llvm_target, arch) = base("macos", Arch::Arm64e, TargetEnv::Normal); | |
| 6 | 6 | Target { |
| 7 | 7 | llvm_target, |
| 8 | 8 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (opts, llvm_target, arch) = base("ios", Arch::Arm64e, TargetAbi::Normal); | |
| 5 | let (opts, llvm_target, arch) = base("ios", Arch::Arm64e, TargetEnv::Normal); | |
| 6 | 6 | Target { |
| 7 | 7 | llvm_target, |
| 8 | 8 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/arm64e_apple_tvos.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (opts, llvm_target, arch) = base("tvos", Arch::Arm64e, TargetAbi::Normal); | |
| 5 | let (opts, llvm_target, arch) = base("tvos", Arch::Arm64e, TargetEnv::Normal); | |
| 6 | 6 | Target { |
| 7 | 7 | llvm_target, |
| 8 | 8 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (opts, llvm_target, arch) = base("watchos", Arch::Armv7k, TargetAbi::Normal); | |
| 5 | let (opts, llvm_target, arch) = base("watchos", Arch::Armv7k, TargetEnv::Normal); | |
| 6 | 6 | Target { |
| 7 | 7 | llvm_target, |
| 8 | 8 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (opts, llvm_target, arch) = base("ios", Arch::Armv7s, TargetAbi::Normal); | |
| 5 | let (opts, llvm_target, arch) = base("ios", Arch::Armv7s, TargetEnv::Normal); | |
| 6 | 6 | Target { |
| 7 | 7 | llvm_target, |
| 8 | 8 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/i386_apple_ios.rs+2-2| ... | ... | @@ -1,10 +1,10 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | 5 | // i386-apple-ios is a simulator target, even though it isn't declared |
| 6 | 6 | // that way in the target name like the other ones... |
| 7 | let (opts, llvm_target, arch) = base("ios", Arch::I386, TargetAbi::Simulator); | |
| 7 | let (opts, llvm_target, arch) = base("ios", Arch::I386, TargetEnv::Simulator); | |
| 8 | 8 | Target { |
| 9 | 9 | llvm_target, |
| 10 | 10 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (opts, llvm_target, arch) = base("macos", Arch::I686, TargetAbi::Normal); | |
| 5 | let (opts, llvm_target, arch) = base("macos", Arch::I686, TargetEnv::Normal); | |
| 6 | 6 | Target { |
| 7 | 7 | llvm_target, |
| 8 | 8 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (opts, llvm_target, arch) = base("macos", Arch::X86_64, TargetAbi::Normal); | |
| 5 | let (opts, llvm_target, arch) = base("macos", Arch::X86_64, TargetEnv::Normal); | |
| 6 | 6 | Target { |
| 7 | 7 | llvm_target, |
| 8 | 8 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs+2-2| ... | ... | @@ -1,10 +1,10 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | 5 | // x86_64-apple-ios is a simulator target, even though it isn't declared |
| 6 | 6 | // that way in the target name like the other ones... |
| 7 | let (opts, llvm_target, arch) = base("ios", Arch::X86_64, TargetAbi::Simulator); | |
| 7 | let (opts, llvm_target, arch) = base("ios", Arch::X86_64, TargetEnv::Simulator); | |
| 8 | 8 | Target { |
| 9 | 9 | llvm_target, |
| 10 | 10 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (opts, llvm_target, arch) = base("ios", Arch::X86_64, TargetAbi::MacCatalyst); | |
| 5 | let (opts, llvm_target, arch) = base("ios", Arch::X86_64, TargetEnv::MacCatalyst); | |
| 6 | 6 | Target { |
| 7 | 7 | llvm_target, |
| 8 | 8 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs+2-2| ... | ... | @@ -1,10 +1,10 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | 5 | // x86_64-apple-tvos is a simulator target, even though it isn't declared |
| 6 | 6 | // that way in the target name like the other ones... |
| 7 | let (opts, llvm_target, arch) = base("tvos", Arch::X86_64, TargetAbi::Simulator); | |
| 7 | let (opts, llvm_target, arch) = base("tvos", Arch::X86_64, TargetEnv::Simulator); | |
| 8 | 8 | Target { |
| 9 | 9 | llvm_target, |
| 10 | 10 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (opts, llvm_target, arch) = base("watchos", Arch::X86_64, TargetAbi::Simulator); | |
| 5 | let (opts, llvm_target, arch) = base("watchos", Arch::X86_64, TargetEnv::Simulator); | |
| 6 | 6 | Target { |
| 7 | 7 | llvm_target, |
| 8 | 8 | metadata: TargetMetadata { |
compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::base::apple::{Arch, TargetAbi, base}; | |
| 1 | use crate::spec::base::apple::{Arch, TargetEnv, base}; | |
| 2 | 2 | use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let (mut opts, llvm_target, arch) = base("macos", Arch::X86_64h, TargetAbi::Normal); | |
| 5 | let (mut opts, llvm_target, arch) = base("macos", Arch::X86_64h, TargetEnv::Normal); | |
| 6 | 6 | opts.max_atomic_width = Some(128); |
| 7 | 7 | opts.supported_sanitizers = |
| 8 | 8 | SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK | SanitizerSet::THREAD; |
compiler/rustc_trait_selection/messages.ftl-2| ... | ... | @@ -171,8 +171,6 @@ trait_selection_fps_remove_ref = consider removing the reference |
| 171 | 171 | trait_selection_fps_use_ref = consider using a reference |
| 172 | 172 | trait_selection_fulfill_req_lifetime = the type `{$ty}` does not fulfill the required lifetime |
| 173 | 173 | |
| 174 | trait_selection_full_type_written = the full type name has been written to '{$path}' | |
| 175 | ||
| 176 | 174 | trait_selection_ignored_diagnostic_option = `{$option_name}` is ignored due to previous definition of `{$option_name}` |
| 177 | 175 | .other_label = `{$option_name}` is first declared here |
| 178 | 176 | .label = `{$option_name}` is already declared here |
compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs+8-7| ... | ... | @@ -1930,7 +1930,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 1930 | 1930 | &self, |
| 1931 | 1931 | trace: &TypeTrace<'tcx>, |
| 1932 | 1932 | terr: TypeError<'tcx>, |
| 1933 | path: &mut Option<PathBuf>, | |
| 1933 | long_ty_path: &mut Option<PathBuf>, | |
| 1934 | 1934 | ) -> Vec<TypeErrorAdditionalDiags> { |
| 1935 | 1935 | let mut suggestions = Vec::new(); |
| 1936 | 1936 | let span = trace.cause.span; |
| ... | ... | @@ -2009,7 +2009,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 2009 | 2009 | }) |
| 2010 | 2010 | | ObligationCauseCode::BlockTailExpression(.., source)) = code |
| 2011 | 2011 | && let hir::MatchSource::TryDesugar(_) = source |
| 2012 | && let Some((expected_ty, found_ty)) = self.values_str(trace.values, &trace.cause, path) | |
| 2012 | && let Some((expected_ty, found_ty)) = | |
| 2013 | self.values_str(trace.values, &trace.cause, long_ty_path) | |
| 2013 | 2014 | { |
| 2014 | 2015 | suggestions.push(TypeErrorAdditionalDiags::TryCannotConvert { |
| 2015 | 2016 | found: found_ty.content(), |
| ... | ... | @@ -2139,11 +2140,11 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 2139 | 2140 | &self, |
| 2140 | 2141 | values: ValuePairs<'tcx>, |
| 2141 | 2142 | cause: &ObligationCause<'tcx>, |
| 2142 | file: &mut Option<PathBuf>, | |
| 2143 | long_ty_path: &mut Option<PathBuf>, | |
| 2143 | 2144 | ) -> Option<(DiagStyledString, DiagStyledString)> { |
| 2144 | 2145 | match values { |
| 2145 | 2146 | ValuePairs::Regions(exp_found) => self.expected_found_str(exp_found), |
| 2146 | ValuePairs::Terms(exp_found) => self.expected_found_str_term(exp_found, file), | |
| 2147 | ValuePairs::Terms(exp_found) => self.expected_found_str_term(exp_found, long_ty_path), | |
| 2147 | 2148 | ValuePairs::Aliases(exp_found) => self.expected_found_str(exp_found), |
| 2148 | 2149 | ValuePairs::ExistentialTraitRef(exp_found) => self.expected_found_str(exp_found), |
| 2149 | 2150 | ValuePairs::ExistentialProjection(exp_found) => self.expected_found_str(exp_found), |
| ... | ... | @@ -2183,7 +2184,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 2183 | 2184 | fn expected_found_str_term( |
| 2184 | 2185 | &self, |
| 2185 | 2186 | exp_found: ty::error::ExpectedFound<ty::Term<'tcx>>, |
| 2186 | path: &mut Option<PathBuf>, | |
| 2187 | long_ty_path: &mut Option<PathBuf>, | |
| 2187 | 2188 | ) -> Option<(DiagStyledString, DiagStyledString)> { |
| 2188 | 2189 | let exp_found = self.resolve_vars_if_possible(exp_found); |
| 2189 | 2190 | if exp_found.references_error() { |
| ... | ... | @@ -2200,11 +2201,11 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 2200 | 2201 | let exp_s = exp.content(); |
| 2201 | 2202 | let fnd_s = fnd.content(); |
| 2202 | 2203 | if exp_s.len() > len { |
| 2203 | let exp_s = self.tcx.short_string(expected, path); | |
| 2204 | let exp_s = self.tcx.short_string(expected, long_ty_path); | |
| 2204 | 2205 | exp = DiagStyledString::highlighted(exp_s); |
| 2205 | 2206 | } |
| 2206 | 2207 | if fnd_s.len() > len { |
| 2207 | let fnd_s = self.tcx.short_string(found, path); | |
| 2208 | let fnd_s = self.tcx.short_string(found, long_ty_path); | |
| 2208 | 2209 | fnd = DiagStyledString::highlighted(fnd_s); |
| 2209 | 2210 | } |
| 2210 | 2211 | (exp, fnd) |
compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs+12-20| ... | ... | @@ -436,8 +436,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 436 | 436 | infer_subdiags, |
| 437 | 437 | multi_suggestions, |
| 438 | 438 | bad_label, |
| 439 | was_written: false, | |
| 440 | path: Default::default(), | |
| 441 | 439 | }), |
| 442 | 440 | TypeAnnotationNeeded::E0283 => self.dcx().create_err(AmbiguousImpl { |
| 443 | 441 | span, |
| ... | ... | @@ -447,8 +445,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 447 | 445 | infer_subdiags, |
| 448 | 446 | multi_suggestions, |
| 449 | 447 | bad_label, |
| 450 | was_written: false, | |
| 451 | path: Default::default(), | |
| 452 | 448 | }), |
| 453 | 449 | TypeAnnotationNeeded::E0284 => self.dcx().create_err(AmbiguousReturn { |
| 454 | 450 | span, |
| ... | ... | @@ -458,8 +454,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 458 | 454 | infer_subdiags, |
| 459 | 455 | multi_suggestions, |
| 460 | 456 | bad_label, |
| 461 | was_written: false, | |
| 462 | path: Default::default(), | |
| 463 | 457 | }), |
| 464 | 458 | } |
| 465 | 459 | } |
| ... | ... | @@ -496,7 +490,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 496 | 490 | return self.bad_inference_failure_err(failure_span, arg_data, error_code); |
| 497 | 491 | }; |
| 498 | 492 | |
| 499 | let (source_kind, name, path) = kind.ty_localized_msg(self); | |
| 493 | let (source_kind, name, long_ty_path) = kind.ty_localized_msg(self); | |
| 500 | 494 | let failure_span = if should_label_span && !failure_span.overlaps(span) { |
| 501 | 495 | Some(failure_span) |
| 502 | 496 | } else { |
| ... | ... | @@ -628,7 +622,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 628 | 622 | } |
| 629 | 623 | } |
| 630 | 624 | } |
| 631 | match error_code { | |
| 625 | let mut err = match error_code { | |
| 632 | 626 | TypeAnnotationNeeded::E0282 => self.dcx().create_err(AnnotationRequired { |
| 633 | 627 | span, |
| 634 | 628 | source_kind, |
| ... | ... | @@ -637,8 +631,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 637 | 631 | infer_subdiags, |
| 638 | 632 | multi_suggestions, |
| 639 | 633 | bad_label: None, |
| 640 | was_written: path.is_some(), | |
| 641 | path: path.unwrap_or_default(), | |
| 642 | 634 | }), |
| 643 | 635 | TypeAnnotationNeeded::E0283 => self.dcx().create_err(AmbiguousImpl { |
| 644 | 636 | span, |
| ... | ... | @@ -648,8 +640,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 648 | 640 | infer_subdiags, |
| 649 | 641 | multi_suggestions, |
| 650 | 642 | bad_label: None, |
| 651 | was_written: path.is_some(), | |
| 652 | path: path.unwrap_or_default(), | |
| 653 | 643 | }), |
| 654 | 644 | TypeAnnotationNeeded::E0284 => self.dcx().create_err(AmbiguousReturn { |
| 655 | 645 | span, |
| ... | ... | @@ -659,10 +649,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 659 | 649 | infer_subdiags, |
| 660 | 650 | multi_suggestions, |
| 661 | 651 | bad_label: None, |
| 662 | was_written: path.is_some(), | |
| 663 | path: path.unwrap_or_default(), | |
| 664 | 652 | }), |
| 665 | } | |
| 653 | }; | |
| 654 | *err.long_ty_path() = long_ty_path; | |
| 655 | err | |
| 666 | 656 | } |
| 667 | 657 | } |
| 668 | 658 | |
| ... | ... | @@ -726,22 +716,24 @@ impl<'tcx> InferSource<'tcx> { |
| 726 | 716 | |
| 727 | 717 | impl<'tcx> InferSourceKind<'tcx> { |
| 728 | 718 | fn ty_localized_msg(&self, infcx: &InferCtxt<'tcx>) -> (&'static str, String, Option<PathBuf>) { |
| 729 | let mut path = None; | |
| 719 | let mut long_ty_path = None; | |
| 730 | 720 | match *self { |
| 731 | 721 | InferSourceKind::LetBinding { ty, .. } |
| 732 | 722 | | InferSourceKind::ClosureArg { ty, .. } |
| 733 | 723 | | InferSourceKind::ClosureReturn { ty, .. } => { |
| 734 | 724 | if ty.is_closure() { |
| 735 | ("closure", closure_as_fn_str(infcx, ty), path) | |
| 725 | ("closure", closure_as_fn_str(infcx, ty), long_ty_path) | |
| 736 | 726 | } else if !ty.is_ty_or_numeric_infer() { |
| 737 | ("normal", infcx.tcx.short_string(ty, &mut path), path) | |
| 727 | ("normal", infcx.tcx.short_string(ty, &mut long_ty_path), long_ty_path) | |
| 738 | 728 | } else { |
| 739 | ("other", String::new(), path) | |
| 729 | ("other", String::new(), long_ty_path) | |
| 740 | 730 | } |
| 741 | 731 | } |
| 742 | 732 | // FIXME: We should be able to add some additional info here. |
| 743 | 733 | InferSourceKind::GenericArg { .. } |
| 744 | | InferSourceKind::FullyQualifiedMethodCall { .. } => ("other", String::new(), path), | |
| 734 | | InferSourceKind::FullyQualifiedMethodCall { .. } => { | |
| 735 | ("other", String::new(), long_ty_path) | |
| 736 | } | |
| 745 | 737 | } |
| 746 | 738 | } |
| 747 | 739 | } |
compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs+29-28| ... | ... | @@ -169,7 +169,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 169 | 169 | |
| 170 | 170 | let predicate = self.resolve_vars_if_possible(obligation.predicate); |
| 171 | 171 | let span = obligation.cause.span; |
| 172 | let mut file = None; | |
| 172 | let mut long_ty_path = None; | |
| 173 | 173 | |
| 174 | 174 | debug!(?predicate, obligation.cause.code = ?obligation.cause.code()); |
| 175 | 175 | |
| ... | ... | @@ -211,19 +211,18 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 211 | 211 | self.tcx.as_lang_item(trait_pred.def_id()), |
| 212 | 212 | Some(LangItem::Sized | LangItem::MetaSized) |
| 213 | 213 | ) { |
| 214 | match self.tainted_by_errors() { | |
| 215 | None => { | |
| 216 | let err = self.emit_inference_failure_err( | |
| 214 | return match self.tainted_by_errors() { | |
| 215 | None => self | |
| 216 | .emit_inference_failure_err( | |
| 217 | 217 | obligation.cause.body_id, |
| 218 | 218 | span, |
| 219 | 219 | trait_pred.self_ty().skip_binder().into(), |
| 220 | 220 | TypeAnnotationNeeded::E0282, |
| 221 | 221 | false, |
| 222 | ); | |
| 223 | return err.emit(); | |
| 224 | } | |
| 225 | Some(e) => return e, | |
| 226 | } | |
| 222 | ) | |
| 223 | .emit(), | |
| 224 | Some(e) => e, | |
| 225 | }; | |
| 227 | 226 | } |
| 228 | 227 | |
| 229 | 228 | // Typically, this ambiguity should only happen if |
| ... | ... | @@ -260,8 +259,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 260 | 259 | span, |
| 261 | 260 | E0283, |
| 262 | 261 | "type annotations needed: cannot satisfy `{}`", |
| 263 | self.tcx.short_string(predicate, &mut file), | |
| 262 | self.tcx.short_string(predicate, &mut long_ty_path), | |
| 264 | 263 | ) |
| 264 | .with_long_ty_path(long_ty_path) | |
| 265 | 265 | }; |
| 266 | 266 | |
| 267 | 267 | let mut ambiguities = compute_applicable_impls_for_diagnostics( |
| ... | ... | @@ -307,7 +307,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 307 | 307 | err.cancel(); |
| 308 | 308 | return e; |
| 309 | 309 | } |
| 310 | let pred = self.tcx.short_string(predicate, &mut file); | |
| 310 | let pred = self.tcx.short_string(predicate, &mut err.long_ty_path()); | |
| 311 | 311 | err.note(format!("cannot satisfy `{pred}`")); |
| 312 | 312 | let impl_candidates = |
| 313 | 313 | self.find_similar_impl_candidates(predicate.as_trait_clause().unwrap()); |
| ... | ... | @@ -512,6 +512,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 512 | 512 | true, |
| 513 | 513 | ) |
| 514 | 514 | } |
| 515 | ||
| 515 | 516 | ty::PredicateKind::Clause(ty::ClauseKind::Projection(data)) => { |
| 516 | 517 | if let Err(e) = predicate.error_reported() { |
| 517 | 518 | return e; |
| ... | ... | @@ -536,7 +537,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 536 | 537 | .filter_map(ty::GenericArg::as_term) |
| 537 | 538 | .chain([data.term]) |
| 538 | 539 | .find(|g| g.has_non_region_infer()); |
| 539 | let predicate = self.tcx.short_string(predicate, &mut file); | |
| 540 | let predicate = self.tcx.short_string(predicate, &mut long_ty_path); | |
| 540 | 541 | if let Some(term) = term { |
| 541 | 542 | self.emit_inference_failure_err( |
| 542 | 543 | obligation.cause.body_id, |
| ... | ... | @@ -546,6 +547,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 546 | 547 | true, |
| 547 | 548 | ) |
| 548 | 549 | .with_note(format!("cannot satisfy `{predicate}`")) |
| 550 | .with_long_ty_path(long_ty_path) | |
| 549 | 551 | } else { |
| 550 | 552 | // If we can't find a generic parameter, just print a generic error |
| 551 | 553 | struct_span_code_err!( |
| ... | ... | @@ -555,6 +557,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 555 | 557 | "type annotations needed: cannot satisfy `{predicate}`", |
| 556 | 558 | ) |
| 557 | 559 | .with_span_label(span, format!("cannot satisfy `{predicate}`")) |
| 560 | .with_long_ty_path(long_ty_path) | |
| 558 | 561 | } |
| 559 | 562 | } |
| 560 | 563 | |
| ... | ... | @@ -568,17 +571,16 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 568 | 571 | let term = |
| 569 | 572 | data.walk().filter_map(ty::GenericArg::as_term).find(|term| term.is_infer()); |
| 570 | 573 | if let Some(term) = term { |
| 571 | let err = self.emit_inference_failure_err( | |
| 574 | self.emit_inference_failure_err( | |
| 572 | 575 | obligation.cause.body_id, |
| 573 | 576 | span, |
| 574 | 577 | term, |
| 575 | 578 | TypeAnnotationNeeded::E0284, |
| 576 | 579 | true, |
| 577 | ); | |
| 578 | err | |
| 580 | ) | |
| 579 | 581 | } else { |
| 580 | 582 | // If we can't find a generic parameter, just print a generic error |
| 581 | let predicate = self.tcx.short_string(predicate, &mut file); | |
| 583 | let predicate = self.tcx.short_string(predicate, &mut long_ty_path); | |
| 582 | 584 | struct_span_code_err!( |
| 583 | 585 | self.dcx(), |
| 584 | 586 | span, |
| ... | ... | @@ -586,6 +588,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 586 | 588 | "type annotations needed: cannot satisfy `{predicate}`", |
| 587 | 589 | ) |
| 588 | 590 | .with_span_label(span, format!("cannot satisfy `{predicate}`")) |
| 591 | .with_long_ty_path(long_ty_path) | |
| 589 | 592 | } |
| 590 | 593 | } |
| 591 | 594 | |
| ... | ... | @@ -597,13 +600,14 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 597 | 600 | TypeAnnotationNeeded::E0284, |
| 598 | 601 | true, |
| 599 | 602 | ), |
| 603 | ||
| 600 | 604 | ty::PredicateKind::NormalizesTo(ty::NormalizesTo { alias, term }) |
| 601 | 605 | if term.is_infer() => |
| 602 | 606 | { |
| 603 | 607 | if let Some(e) = self.tainted_by_errors() { |
| 604 | 608 | return e; |
| 605 | 609 | } |
| 606 | let alias = self.tcx.short_string(alias, &mut file); | |
| 610 | let alias = self.tcx.short_string(alias, &mut long_ty_path); | |
| 607 | 611 | struct_span_code_err!( |
| 608 | 612 | self.dcx(), |
| 609 | 613 | span, |
| ... | ... | @@ -611,37 +615,34 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 611 | 615 | "type annotations needed: cannot normalize `{alias}`", |
| 612 | 616 | ) |
| 613 | 617 | .with_span_label(span, format!("cannot normalize `{alias}`")) |
| 618 | .with_long_ty_path(long_ty_path) | |
| 614 | 619 | } |
| 620 | ||
| 615 | 621 | ty::PredicateKind::Clause(ty::ClauseKind::UnstableFeature(sym)) => { |
| 616 | 622 | if let Some(e) = self.tainted_by_errors() { |
| 617 | 623 | return e; |
| 618 | 624 | } |
| 619 | 625 | |
| 620 | let mut err; | |
| 621 | ||
| 622 | 626 | if self.tcx.features().staged_api() { |
| 623 | err = self.dcx().struct_span_err( | |
| 627 | self.dcx().struct_span_err( | |
| 624 | 628 | span, |
| 625 | 629 | format!("unstable feature `{sym}` is used without being enabled."), |
| 626 | ); | |
| 627 | ||
| 628 | err.help(format!("The feature can be enabled by marking the current item with `#[unstable_feature_bound({sym})]`")); | |
| 630 | ).with_help(format!("The feature can be enabled by marking the current item with `#[unstable_feature_bound({sym})]`")) | |
| 629 | 631 | } else { |
| 630 | err = feature_err_unstable_feature_bound( | |
| 632 | feature_err_unstable_feature_bound( | |
| 631 | 633 | &self.tcx.sess, |
| 632 | 634 | sym, |
| 633 | 635 | span, |
| 634 | 636 | format!("use of unstable library feature `{sym}`"), |
| 635 | ); | |
| 637 | ) | |
| 636 | 638 | } |
| 637 | err | |
| 638 | 639 | } |
| 639 | 640 | |
| 640 | 641 | _ => { |
| 641 | 642 | if let Some(e) = self.tainted_by_errors() { |
| 642 | 643 | return e; |
| 643 | 644 | } |
| 644 | let predicate = self.tcx.short_string(predicate, &mut file); | |
| 645 | let predicate = self.tcx.short_string(predicate, &mut long_ty_path); | |
| 645 | 646 | struct_span_code_err!( |
| 646 | 647 | self.dcx(), |
| 647 | 648 | span, |
| ... | ... | @@ -649,9 +650,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 649 | 650 | "type annotations needed: cannot satisfy `{predicate}`", |
| 650 | 651 | ) |
| 651 | 652 | .with_span_label(span, format!("cannot satisfy `{predicate}`")) |
| 653 | .with_long_ty_path(long_ty_path) | |
| 652 | 654 | } |
| 653 | 655 | }; |
| 654 | *err.long_ty_path() = file; | |
| 655 | 656 | self.note_obligation_cause(&mut err, obligation); |
| 656 | 657 | err.emit() |
| 657 | 658 | } |
compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs+78-41| ... | ... | @@ -208,16 +208,19 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 208 | 208 | performs a conversion on the error value \ |
| 209 | 209 | using the `From` trait"; |
| 210 | 210 | let (message, notes, append_const_msg) = if is_try_conversion { |
| 211 | let ty = self.tcx.short_string( | |
| 212 | main_trait_predicate.skip_binder().self_ty(), | |
| 213 | &mut long_ty_file, | |
| 214 | ); | |
| 211 | 215 | // We have a `-> Result<_, E1>` and `gives_E2()?`. |
| 212 | 216 | ( |
| 213 | Some(format!( | |
| 214 | "`?` couldn't convert the error to `{}`", | |
| 215 | main_trait_predicate.skip_binder().self_ty(), | |
| 216 | )), | |
| 217 | Some(format!("`?` couldn't convert the error to `{ty}`")), | |
| 217 | 218 | vec![question_mark_message.to_owned()], |
| 218 | 219 | Some(AppendConstMessage::Default), |
| 219 | 220 | ) |
| 220 | 221 | } else if is_question_mark { |
| 222 | let main_trait_predicate = | |
| 223 | self.tcx.short_string(main_trait_predicate, &mut long_ty_file); | |
| 221 | 224 | // Similar to the case above, but in this case the conversion is for a |
| 222 | 225 | // trait object: `-> Result<_, Box<dyn Error>` and `gives_E()?` when |
| 223 | 226 | // `E: Error` isn't met. |
| ... | ... | @@ -233,7 +236,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 233 | 236 | (message, notes, append_const_msg) |
| 234 | 237 | }; |
| 235 | 238 | |
| 236 | let err_msg = self.get_standard_error_message( | |
| 239 | let default_err_msg = || self.get_standard_error_message( | |
| 237 | 240 | main_trait_predicate, |
| 238 | 241 | message, |
| 239 | 242 | None, |
| ... | ... | @@ -258,7 +261,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 258 | 261 | ); |
| 259 | 262 | } |
| 260 | 263 | GetSafeTransmuteErrorAndReason::Default => { |
| 261 | (err_msg, None) | |
| 264 | (default_err_msg(), None) | |
| 262 | 265 | } |
| 263 | 266 | GetSafeTransmuteErrorAndReason::Error { |
| 264 | 267 | err_msg, |
| ... | ... | @@ -266,7 +269,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 266 | 269 | } => (err_msg, safe_transmute_explanation), |
| 267 | 270 | } |
| 268 | 271 | } else { |
| 269 | (err_msg, None) | |
| 272 | (default_err_msg(), None) | |
| 270 | 273 | }; |
| 271 | 274 | |
| 272 | 275 | let mut err = struct_span_code_err!(self.dcx(), span, E0277, "{}", err_msg); |
| ... | ... | @@ -279,15 +282,21 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 279 | 282 | |
| 280 | 283 | if let Some(ret_span) = self.return_type_span(&obligation) { |
| 281 | 284 | if is_try_conversion { |
| 285 | let ty = self.tcx.short_string( | |
| 286 | main_trait_predicate.skip_binder().self_ty(), | |
| 287 | err.long_ty_path(), | |
| 288 | ); | |
| 282 | 289 | err.span_label( |
| 283 | 290 | ret_span, |
| 284 | format!( | |
| 285 | "expected `{}` because of this", | |
| 286 | main_trait_predicate.skip_binder().self_ty() | |
| 287 | ), | |
| 291 | format!("expected `{ty}` because of this"), | |
| 288 | 292 | ); |
| 289 | 293 | } else if is_question_mark { |
| 290 | err.span_label(ret_span, format!("required `{main_trait_predicate}` because of this")); | |
| 294 | let main_trait_predicate = | |
| 295 | self.tcx.short_string(main_trait_predicate, err.long_ty_path()); | |
| 296 | err.span_label( | |
| 297 | ret_span, | |
| 298 | format!("required `{main_trait_predicate}` because of this"), | |
| 299 | ); | |
| 291 | 300 | } |
| 292 | 301 | } |
| 293 | 302 | |
| ... | ... | @@ -303,6 +312,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 303 | 312 | &obligation, |
| 304 | 313 | leaf_trait_predicate, |
| 305 | 314 | pre_message, |
| 315 | err.long_ty_path(), | |
| 306 | 316 | ); |
| 307 | 317 | |
| 308 | 318 | self.check_for_binding_assigned_block_without_tail_expression( |
| ... | ... | @@ -414,11 +424,12 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 414 | 424 | } else { |
| 415 | 425 | vec![(span.shrink_to_hi(), format!(" as {}", cand.self_ty()))] |
| 416 | 426 | }; |
| 427 | let trait_ = self.tcx.short_string(cand.print_trait_sugared(), err.long_ty_path()); | |
| 428 | let ty = self.tcx.short_string(cand.self_ty(), err.long_ty_path()); | |
| 417 | 429 | err.multipart_suggestion( |
| 418 | 430 | format!( |
| 419 | "the trait `{}` is implemented for fn pointer `{}`, try casting using `as`", | |
| 420 | cand.print_trait_sugared(), | |
| 421 | cand.self_ty(), | |
| 431 | "the trait `{trait_}` is implemented for fn pointer \ | |
| 432 | `{ty}`, try casting using `as`", | |
| 422 | 433 | ), |
| 423 | 434 | suggestion, |
| 424 | 435 | Applicability::MaybeIncorrect, |
| ... | ... | @@ -522,7 +533,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 522 | 533 | <https://github.com/rust-lang/rust/issues/48950> \ |
| 523 | 534 | for more information)", |
| 524 | 535 | ); |
| 525 | err.help("did you intend to use the type `()` here instead?"); | |
| 536 | err.help("you might have intended to use the type `()` here instead"); | |
| 526 | 537 | } |
| 527 | 538 | } |
| 528 | 539 | |
| ... | ... | @@ -722,10 +733,13 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 722 | 733 | } |
| 723 | 734 | |
| 724 | 735 | SelectionError::ConstArgHasWrongType { ct, ct_ty, expected_ty } => { |
| 736 | let expected_ty_str = self.tcx.short_string(expected_ty, &mut long_ty_file); | |
| 737 | let ct_str = self.tcx.short_string(ct, &mut long_ty_file); | |
| 725 | 738 | let mut diag = self.dcx().struct_span_err( |
| 726 | 739 | span, |
| 727 | format!("the constant `{ct}` is not of type `{expected_ty}`"), | |
| 740 | format!("the constant `{ct_str}` is not of type `{expected_ty_str}`"), | |
| 728 | 741 | ); |
| 742 | diag.long_ty_path = long_ty_file; | |
| 729 | 743 | |
| 730 | 744 | self.note_type_err( |
| 731 | 745 | &mut diag, |
| ... | ... | @@ -1118,9 +1132,11 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 1118 | 1132 | .must_apply_modulo_regions() |
| 1119 | 1133 | { |
| 1120 | 1134 | if !suggested { |
| 1135 | let err_ty = self.tcx.short_string(err_ty, err.long_ty_path()); | |
| 1121 | 1136 | err.span_label(span, format!("this has type `Result<_, {err_ty}>`")); |
| 1122 | 1137 | } |
| 1123 | 1138 | } else { |
| 1139 | let err_ty = self.tcx.short_string(err_ty, err.long_ty_path()); | |
| 1124 | 1140 | err.span_label( |
| 1125 | 1141 | span, |
| 1126 | 1142 | format!( |
| ... | ... | @@ -1156,12 +1172,13 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 1156 | 1172 | ); |
| 1157 | 1173 | } |
| 1158 | 1174 | (ty::Adt(def, _), None) if def.did().is_local() => { |
| 1175 | let trait_path = self.tcx.short_string( | |
| 1176 | trait_pred.skip_binder().trait_ref.print_only_trait_path(), | |
| 1177 | err.long_ty_path(), | |
| 1178 | ); | |
| 1159 | 1179 | err.span_note( |
| 1160 | 1180 | self.tcx.def_span(def.did()), |
| 1161 | format!( | |
| 1162 | "`{self_ty}` needs to implement `{}`", | |
| 1163 | trait_pred.skip_binder().trait_ref.print_only_trait_path(), | |
| 1164 | ), | |
| 1181 | format!("`{self_ty}` needs to implement `{trait_path}`"), | |
| 1165 | 1182 | ); |
| 1166 | 1183 | } |
| 1167 | 1184 | (ty::Adt(def, _), Some(ty)) if def.did().is_local() => { |
| ... | ... | @@ -1195,13 +1212,15 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 1195 | 1212 | bug!() |
| 1196 | 1213 | }; |
| 1197 | 1214 | |
| 1215 | let mut file = None; | |
| 1216 | let ty_str = self.tcx.short_string(ty, &mut file); | |
| 1198 | 1217 | let mut diag = match ty.kind() { |
| 1199 | 1218 | ty::Float(_) => { |
| 1200 | 1219 | struct_span_code_err!( |
| 1201 | 1220 | self.dcx(), |
| 1202 | 1221 | span, |
| 1203 | 1222 | E0741, |
| 1204 | "`{ty}` is forbidden as the type of a const generic parameter", | |
| 1223 | "`{ty_str}` is forbidden as the type of a const generic parameter", | |
| 1205 | 1224 | ) |
| 1206 | 1225 | } |
| 1207 | 1226 | ty::FnPtr(..) => { |
| ... | ... | @@ -1226,7 +1245,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 1226 | 1245 | self.dcx(), |
| 1227 | 1246 | span, |
| 1228 | 1247 | E0741, |
| 1229 | "`{ty}` must implement `ConstParamTy` to be used as the type of a const generic parameter", | |
| 1248 | "`{ty_str}` must implement `ConstParamTy` to be used as the type of a const generic parameter", | |
| 1230 | 1249 | ); |
| 1231 | 1250 | // Only suggest derive if this isn't a derived obligation, |
| 1232 | 1251 | // and the struct is local. |
| ... | ... | @@ -1258,21 +1277,22 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 1258 | 1277 | self.dcx(), |
| 1259 | 1278 | span, |
| 1260 | 1279 | E0741, |
| 1261 | "`{ty}` can't be used as a const parameter type", | |
| 1280 | "`{ty_str}` can't be used as a const parameter type", | |
| 1262 | 1281 | ) |
| 1263 | 1282 | } |
| 1264 | 1283 | }; |
| 1284 | diag.long_ty_path = file; | |
| 1265 | 1285 | |
| 1266 | 1286 | let mut code = obligation.cause.code(); |
| 1267 | 1287 | let mut pred = obligation.predicate.as_trait_clause(); |
| 1268 | 1288 | while let Some((next_code, next_pred)) = code.parent_with_predicate() { |
| 1269 | 1289 | if let Some(pred) = pred { |
| 1270 | 1290 | self.enter_forall(pred, |pred| { |
| 1271 | diag.note(format!( | |
| 1272 | "`{}` must implement `{}`, but it does not", | |
| 1273 | pred.self_ty(), | |
| 1274 | pred.print_modifiers_and_trait_path() | |
| 1275 | )); | |
| 1291 | let ty = self.tcx.short_string(pred.self_ty(), diag.long_ty_path()); | |
| 1292 | let trait_path = self | |
| 1293 | .tcx | |
| 1294 | .short_string(pred.print_modifiers_and_trait_path(), diag.long_ty_path()); | |
| 1295 | diag.note(format!("`{ty}` must implement `{trait_path}`, but it does not")); | |
| 1276 | 1296 | }) |
| 1277 | 1297 | } |
| 1278 | 1298 | code = next_code; |
| ... | ... | @@ -1584,7 +1604,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 1584 | 1604 | projection_term: ty::AliasTerm<'tcx>, |
| 1585 | 1605 | normalized_ty: ty::Term<'tcx>, |
| 1586 | 1606 | expected_ty: ty::Term<'tcx>, |
| 1587 | file: &mut Option<PathBuf>, | |
| 1607 | long_ty_path: &mut Option<PathBuf>, | |
| 1588 | 1608 | ) -> Option<(String, Span, Option<Span>)> { |
| 1589 | 1609 | let trait_def_id = projection_term.trait_def_id(self.tcx); |
| 1590 | 1610 | let self_ty = projection_term.self_ty(); |
| ... | ... | @@ -1624,17 +1644,25 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 1624 | 1644 | }; |
| 1625 | 1645 | let item = match self_ty.kind() { |
| 1626 | 1646 | ty::FnDef(def, _) => self.tcx.item_name(*def).to_string(), |
| 1627 | _ => self.tcx.short_string(self_ty, file), | |
| 1647 | _ => self.tcx.short_string(self_ty, long_ty_path), | |
| 1628 | 1648 | }; |
| 1649 | let expected_ty = self.tcx.short_string(expected_ty, long_ty_path); | |
| 1650 | let normalized_ty = self.tcx.short_string(normalized_ty, long_ty_path); | |
| 1629 | 1651 | Some((format!( |
| 1630 | 1652 | "expected `{item}` to return `{expected_ty}`, but it returns `{normalized_ty}`", |
| 1631 | 1653 | ), span, closure_span)) |
| 1632 | 1654 | } else if self.tcx.is_lang_item(trait_def_id, LangItem::Future) { |
| 1655 | let self_ty = self.tcx.short_string(self_ty, long_ty_path); | |
| 1656 | let expected_ty = self.tcx.short_string(expected_ty, long_ty_path); | |
| 1657 | let normalized_ty = self.tcx.short_string(normalized_ty, long_ty_path); | |
| 1633 | 1658 | Some((format!( |
| 1634 | 1659 | "expected `{self_ty}` to be a future that resolves to `{expected_ty}`, but it \ |
| 1635 | 1660 | resolves to `{normalized_ty}`" |
| 1636 | 1661 | ), span, None)) |
| 1637 | 1662 | } else if Some(trait_def_id) == self.tcx.get_diagnostic_item(sym::Iterator) { |
| 1663 | let self_ty = self.tcx.short_string(self_ty, long_ty_path); | |
| 1664 | let expected_ty = self.tcx.short_string(expected_ty, long_ty_path); | |
| 1665 | let normalized_ty = self.tcx.short_string(normalized_ty, long_ty_path); | |
| 1638 | 1666 | Some((format!( |
| 1639 | 1667 | "expected `{self_ty}` to be an iterator that yields `{expected_ty}`, but it \ |
| 1640 | 1668 | yields `{normalized_ty}`" |
| ... | ... | @@ -2097,12 +2125,15 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 2097 | 2125 | |
| 2098 | 2126 | if let [TypeError::Sorts(exp_found)] = &terrs[..] { |
| 2099 | 2127 | let exp_found = self.resolve_vars_if_possible(*exp_found); |
| 2128 | let expected = | |
| 2129 | self.tcx.short_string(exp_found.expected, err.long_ty_path()); | |
| 2130 | let found = self.tcx.short_string(exp_found.found, err.long_ty_path()); | |
| 2100 | 2131 | err.highlighted_help(vec![ |
| 2101 | 2132 | StringPart::normal("for that trait implementation, "), |
| 2102 | 2133 | StringPart::normal("expected `"), |
| 2103 | StringPart::highlighted(exp_found.expected.to_string()), | |
| 2134 | StringPart::highlighted(expected), | |
| 2104 | 2135 | StringPart::normal("`, found `"), |
| 2105 | StringPart::highlighted(exp_found.found.to_string()), | |
| 2136 | StringPart::highlighted(found), | |
| 2106 | 2137 | StringPart::normal("`"), |
| 2107 | 2138 | ]); |
| 2108 | 2139 | self.suggest_function_pointers_impl(None, &exp_found, err); |
| ... | ... | @@ -2135,11 +2166,13 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 2135 | 2166 | (ty::FnPtr(..), _) => (" implemented for fn pointer `", ""), |
| 2136 | 2167 | _ => (" implemented for `", ""), |
| 2137 | 2168 | }; |
| 2169 | let trait_ = self.tcx.short_string(cand.print_trait_sugared(), err.long_ty_path()); | |
| 2170 | let self_ty = self.tcx.short_string(cand.self_ty(), err.long_ty_path()); | |
| 2138 | 2171 | err.highlighted_help(vec![ |
| 2139 | StringPart::normal(format!("the trait `{}` ", cand.print_trait_sugared())), | |
| 2172 | StringPart::normal(format!("the trait `{trait_}` ",)), | |
| 2140 | 2173 | StringPart::highlighted("is"), |
| 2141 | 2174 | StringPart::normal(desc), |
| 2142 | StringPart::highlighted(cand.self_ty().to_string()), | |
| 2175 | StringPart::highlighted(self_ty), | |
| 2143 | 2176 | StringPart::normal("`"), |
| 2144 | 2177 | StringPart::normal(mention_castable), |
| 2145 | 2178 | ]); |
| ... | ... | @@ -2159,9 +2192,13 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 2159 | 2192 | .into_iter() |
| 2160 | 2193 | .map(|c| { |
| 2161 | 2194 | if all_traits_equal { |
| 2162 | format!("\n {}", c.self_ty()) | |
| 2195 | format!("\n {}", self.tcx.short_string(c.self_ty(), err.long_ty_path())) | |
| 2163 | 2196 | } else { |
| 2164 | format!("\n `{}` implements `{}`", c.self_ty(), c.print_only_trait_path()) | |
| 2197 | format!( | |
| 2198 | "\n `{}` implements `{}`", | |
| 2199 | self.tcx.short_string(c.self_ty(), err.long_ty_path()), | |
| 2200 | self.tcx.short_string(c.print_only_trait_path(), err.long_ty_path()), | |
| 2201 | ) | |
| 2165 | 2202 | } |
| 2166 | 2203 | }) |
| 2167 | 2204 | .collect(); |
| ... | ... | @@ -2477,7 +2514,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 2477 | 2514 | predicate_constness: Option<ty::BoundConstness>, |
| 2478 | 2515 | append_const_msg: Option<AppendConstMessage>, |
| 2479 | 2516 | post_message: String, |
| 2480 | long_ty_file: &mut Option<PathBuf>, | |
| 2517 | long_ty_path: &mut Option<PathBuf>, | |
| 2481 | 2518 | ) -> String { |
| 2482 | 2519 | message |
| 2483 | 2520 | .and_then(|cannot_do_this| { |
| ... | ... | @@ -2503,7 +2540,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 2503 | 2540 | "the trait bound `{}` is not satisfied{post_message}", |
| 2504 | 2541 | self.tcx.short_string( |
| 2505 | 2542 | trait_predicate.print_with_bound_constness(predicate_constness), |
| 2506 | long_ty_file, | |
| 2543 | long_ty_path, | |
| 2507 | 2544 | ), |
| 2508 | 2545 | ) |
| 2509 | 2546 | }) |
| ... | ... | @@ -2608,8 +2645,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 2608 | 2645 | dst_min_align, |
| 2609 | 2646 | } => { |
| 2610 | 2647 | format!( |
| 2611 | "the minimum alignment of `{src}` ({src_min_align}) should \ | |
| 2612 | be greater than that of `{dst}` ({dst_min_align})" | |
| 2648 | "the minimum alignment of `{src}` ({src_min_align}) should be \ | |
| 2649 | greater than that of `{dst}` ({dst_min_align})" | |
| 2613 | 2650 | ) |
| 2614 | 2651 | } |
| 2615 | 2652 | rustc_transmute::Reason::DstIsMoreUnique => { |
compiler/rustc_trait_selection/src/error_reporting/traits/on_unimplemented.rs+2-2| ... | ... | @@ -99,7 +99,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { |
| 99 | 99 | &self, |
| 100 | 100 | trait_pred: ty::PolyTraitPredicate<'tcx>, |
| 101 | 101 | obligation: &PredicateObligation<'tcx>, |
| 102 | long_ty_file: &mut Option<PathBuf>, | |
| 102 | long_ty_path: &mut Option<PathBuf>, | |
| 103 | 103 | ) -> OnUnimplementedNote { |
| 104 | 104 | if trait_pred.polarity() != ty::PredicatePolarity::Positive { |
| 105 | 105 | return OnUnimplementedNote::default(); |
| ... | ... | @@ -281,7 +281,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { |
| 281 | 281 | GenericParamDefKind::Type { .. } | GenericParamDefKind::Const { .. } => { |
| 282 | 282 | if let Some(ty) = trait_pred.trait_ref.args[param.index as usize].as_type() |
| 283 | 283 | { |
| 284 | self.tcx.short_string(ty, long_ty_file) | |
| 284 | self.tcx.short_string(ty, long_ty_path) | |
| 285 | 285 | } else { |
| 286 | 286 | trait_pred.trait_ref.args[param.index as usize].to_string() |
| 287 | 287 | } |
compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs+43-24| ... | ... | @@ -3,6 +3,7 @@ |
| 3 | 3 | use std::assert_matches::debug_assert_matches; |
| 4 | 4 | use std::borrow::Cow; |
| 5 | 5 | use std::iter; |
| 6 | use std::path::PathBuf; | |
| 6 | 7 | |
| 7 | 8 | use itertools::{EitherOrBoth, Itertools}; |
| 8 | 9 | use rustc_abi::ExternAbi; |
| ... | ... | @@ -1369,6 +1370,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 1369 | 1370 | ); |
| 1370 | 1371 | let self_ty_str = |
| 1371 | 1372 | self.tcx.short_string(old_pred.self_ty().skip_binder(), err.long_ty_path()); |
| 1373 | let trait_path = self | |
| 1374 | .tcx | |
| 1375 | .short_string(old_pred.print_modifiers_and_trait_path(), err.long_ty_path()); | |
| 1376 | ||
| 1372 | 1377 | if has_custom_message { |
| 1373 | 1378 | err.note(msg); |
| 1374 | 1379 | } else { |
| ... | ... | @@ -1376,10 +1381,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 1376 | 1381 | } |
| 1377 | 1382 | err.span_label( |
| 1378 | 1383 | span, |
| 1379 | format!( | |
| 1380 | "the trait `{}` is not implemented for `{self_ty_str}`", | |
| 1381 | old_pred.print_modifiers_and_trait_path() | |
| 1382 | ), | |
| 1384 | format!("the trait `{trait_path}` is not implemented for `{self_ty_str}`"), | |
| 1383 | 1385 | ); |
| 1384 | 1386 | }; |
| 1385 | 1387 | |
| ... | ... | @@ -3333,17 +3335,22 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 3333 | 3335 | tcx.async_fn_trait_kind_from_def_id(data.parent_trait_pred.def_id()).is_some(); |
| 3334 | 3336 | |
| 3335 | 3337 | if !is_upvar_tys_infer_tuple && !is_builtin_async_fn_trait { |
| 3336 | let ty_str = tcx.short_string(ty, err.long_ty_path()); | |
| 3337 | let msg = format!("required because it appears within the type `{ty_str}`"); | |
| 3338 | let mut msg = || { | |
| 3339 | let ty_str = tcx.short_string(ty, err.long_ty_path()); | |
| 3340 | format!("required because it appears within the type `{ty_str}`") | |
| 3341 | }; | |
| 3338 | 3342 | match ty.kind() { |
| 3339 | ty::Adt(def, _) => match tcx.opt_item_ident(def.did()) { | |
| 3340 | Some(ident) => { | |
| 3341 | err.span_note(ident.span, msg); | |
| 3342 | } | |
| 3343 | None => { | |
| 3344 | err.note(msg); | |
| 3343 | ty::Adt(def, _) => { | |
| 3344 | let msg = msg(); | |
| 3345 | match tcx.opt_item_ident(def.did()) { | |
| 3346 | Some(ident) => { | |
| 3347 | err.span_note(ident.span, msg); | |
| 3348 | } | |
| 3349 | None => { | |
| 3350 | err.note(msg); | |
| 3351 | } | |
| 3345 | 3352 | } |
| 3346 | }, | |
| 3353 | } | |
| 3347 | 3354 | ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }) => { |
| 3348 | 3355 | // If the previous type is async fn, this is the future generated by the body of an async function. |
| 3349 | 3356 | // Avoid printing it twice (it was already printed in the `ty::Coroutine` arm below). |
| ... | ... | @@ -3363,6 +3370,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 3363 | 3370 | { |
| 3364 | 3371 | // See comment above; skip printing twice. |
| 3365 | 3372 | } else { |
| 3373 | let msg = msg(); | |
| 3366 | 3374 | err.span_note(tcx.def_span(def_id), msg); |
| 3367 | 3375 | } |
| 3368 | 3376 | } |
| ... | ... | @@ -3392,6 +3400,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 3392 | 3400 | err.note("`str` is considered to contain a `[u8]` slice for auto trait purposes"); |
| 3393 | 3401 | } |
| 3394 | 3402 | _ => { |
| 3403 | let msg = msg(); | |
| 3395 | 3404 | err.note(msg); |
| 3396 | 3405 | } |
| 3397 | 3406 | }; |
| ... | ... | @@ -3441,7 +3450,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 3441 | 3450 | } |
| 3442 | 3451 | let self_ty_str = |
| 3443 | 3452 | tcx.short_string(parent_trait_pred.skip_binder().self_ty(), err.long_ty_path()); |
| 3444 | let trait_name = parent_trait_pred.print_modifiers_and_trait_path().to_string(); | |
| 3453 | let trait_name = tcx.short_string( | |
| 3454 | parent_trait_pred.print_modifiers_and_trait_path(), | |
| 3455 | err.long_ty_path(), | |
| 3456 | ); | |
| 3445 | 3457 | let msg = format!("required for `{self_ty_str}` to implement `{trait_name}`"); |
| 3446 | 3458 | let mut is_auto_trait = false; |
| 3447 | 3459 | match tcx.hir_get_if_local(data.impl_or_alias_def_id) { |
| ... | ... | @@ -3539,10 +3551,11 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 3539 | 3551 | parent_trait_pred.skip_binder().self_ty(), |
| 3540 | 3552 | err.long_ty_path(), |
| 3541 | 3553 | ); |
| 3542 | err.note(format!( | |
| 3543 | "required for `{self_ty}` to implement `{}`", | |
| 3544 | parent_trait_pred.print_modifiers_and_trait_path() | |
| 3545 | )); | |
| 3554 | let trait_path = tcx.short_string( | |
| 3555 | parent_trait_pred.print_modifiers_and_trait_path(), | |
| 3556 | err.long_ty_path(), | |
| 3557 | ); | |
| 3558 | err.note(format!("required for `{self_ty}` to implement `{trait_path}`")); | |
| 3546 | 3559 | } |
| 3547 | 3560 | // #74711: avoid a stack overflow |
| 3548 | 3561 | ensure_sufficient_stack(|| { |
| ... | ... | @@ -3558,15 +3571,20 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 3558 | 3571 | }); |
| 3559 | 3572 | } |
| 3560 | 3573 | ObligationCauseCode::ImplDerivedHost(ref data) => { |
| 3561 | let self_ty = | |
| 3562 | self.resolve_vars_if_possible(data.derived.parent_host_pred.self_ty()); | |
| 3563 | let msg = format!( | |
| 3564 | "required for `{self_ty}` to implement `{} {}`", | |
| 3565 | data.derived.parent_host_pred.skip_binder().constness, | |
| 3574 | let self_ty = tcx.short_string( | |
| 3575 | self.resolve_vars_if_possible(data.derived.parent_host_pred.self_ty()), | |
| 3576 | err.long_ty_path(), | |
| 3577 | ); | |
| 3578 | let trait_path = tcx.short_string( | |
| 3566 | 3579 | data.derived |
| 3567 | 3580 | .parent_host_pred |
| 3568 | 3581 | .map_bound(|pred| pred.trait_ref) |
| 3569 | 3582 | .print_only_trait_path(), |
| 3583 | err.long_ty_path(), | |
| 3584 | ); | |
| 3585 | let msg = format!( | |
| 3586 | "required for `{self_ty}` to implement `{} {trait_path}`", | |
| 3587 | data.derived.parent_host_pred.skip_binder().constness, | |
| 3570 | 3588 | ); |
| 3571 | 3589 | match tcx.hir_get_if_local(data.impl_def_id) { |
| 3572 | 3590 | Some(Node::Item(hir::Item { |
| ... | ... | @@ -5351,6 +5369,7 @@ pub(super) fn get_explanation_based_on_obligation<'tcx>( |
| 5351 | 5369 | obligation: &PredicateObligation<'tcx>, |
| 5352 | 5370 | trait_predicate: ty::PolyTraitPredicate<'tcx>, |
| 5353 | 5371 | pre_message: String, |
| 5372 | long_ty_path: &mut Option<PathBuf>, | |
| 5354 | 5373 | ) -> String { |
| 5355 | 5374 | if let ObligationCauseCode::MainFunctionType = obligation.cause.code() { |
| 5356 | 5375 | "consider using `()`, or a `Result`".to_owned() |
| ... | ... | @@ -5369,7 +5388,7 @@ pub(super) fn get_explanation_based_on_obligation<'tcx>( |
| 5369 | 5388 | format!( |
| 5370 | 5389 | "{pre_message}the trait `{}` is not implemented for{desc} `{}`", |
| 5371 | 5390 | trait_predicate.print_modifiers_and_trait_path(), |
| 5372 | tcx.short_string(trait_predicate.self_ty().skip_binder(), &mut None), | |
| 5391 | tcx.short_string(trait_predicate.self_ty().skip_binder(), long_ty_path), | |
| 5373 | 5392 | ) |
| 5374 | 5393 | } else { |
| 5375 | 5394 | // "the trait bound `T: !Send` is not satisfied" reads better than "`!Send` is |
compiler/rustc_trait_selection/src/errors.rs-11| ... | ... | @@ -1,5 +1,3 @@ |
| 1 | use std::path::PathBuf; | |
| 2 | ||
| 3 | 1 | use rustc_ast::Path; |
| 4 | 2 | use rustc_data_structures::fx::{FxHashSet, FxIndexSet}; |
| 5 | 3 | use rustc_errors::codes::*; |
| ... | ... | @@ -224,9 +222,6 @@ pub struct AnnotationRequired<'a> { |
| 224 | 222 | pub infer_subdiags: Vec<SourceKindSubdiag<'a>>, |
| 225 | 223 | #[subdiagnostic] |
| 226 | 224 | pub multi_suggestions: Vec<SourceKindMultiSuggestion<'a>>, |
| 227 | #[note(trait_selection_full_type_written)] | |
| 228 | pub was_written: bool, | |
| 229 | pub path: PathBuf, | |
| 230 | 225 | } |
| 231 | 226 | |
| 232 | 227 | // Copy of `AnnotationRequired` for E0283 |
| ... | ... | @@ -245,9 +240,6 @@ pub struct AmbiguousImpl<'a> { |
| 245 | 240 | pub infer_subdiags: Vec<SourceKindSubdiag<'a>>, |
| 246 | 241 | #[subdiagnostic] |
| 247 | 242 | pub multi_suggestions: Vec<SourceKindMultiSuggestion<'a>>, |
| 248 | #[note(trait_selection_full_type_written)] | |
| 249 | pub was_written: bool, | |
| 250 | pub path: PathBuf, | |
| 251 | 243 | } |
| 252 | 244 | |
| 253 | 245 | // Copy of `AnnotationRequired` for E0284 |
| ... | ... | @@ -266,9 +258,6 @@ pub struct AmbiguousReturn<'a> { |
| 266 | 258 | pub infer_subdiags: Vec<SourceKindSubdiag<'a>>, |
| 267 | 259 | #[subdiagnostic] |
| 268 | 260 | pub multi_suggestions: Vec<SourceKindMultiSuggestion<'a>>, |
| 269 | #[note(trait_selection_full_type_written)] | |
| 270 | pub was_written: bool, | |
| 271 | pub path: PathBuf, | |
| 272 | 261 | } |
| 273 | 262 | |
| 274 | 263 | // Used when a better one isn't available |
compiler/rustc_type_ir/src/binder.rs+30-30| ... | ... | @@ -15,13 +15,12 @@ use crate::lift::Lift; |
| 15 | 15 | use crate::visit::{Flags, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor}; |
| 16 | 16 | use crate::{self as ty, Interner}; |
| 17 | 17 | |
| 18 | /// Binder is a binder for higher-ranked lifetimes or types. It is part of the | |
| 18 | /// `Binder` is a binder for higher-ranked lifetimes or types. It is part of the | |
| 19 | 19 | /// compiler's representation for things like `for<'a> Fn(&'a isize)` |
| 20 | /// (which would be represented by the type `PolyTraitRef == | |
| 21 | /// Binder<I, TraitRef>`). Note that when we instantiate, | |
| 22 | /// erase, or otherwise "discharge" these bound vars, we change the | |
| 23 | /// type from `Binder<I, T>` to just `T` (see | |
| 24 | /// e.g., `liberate_late_bound_regions`). | |
| 20 | /// (which would be represented by the type `PolyTraitRef == Binder<I, TraitRef>`). | |
| 21 | /// | |
| 22 | /// See <https://rustc-dev-guide.rust-lang.org/ty_module/instantiating_binders.html> | |
| 23 | /// for more details. | |
| 25 | 24 | /// |
| 26 | 25 | /// `Decodable` and `Encodable` are implemented for `Binder<T>` using the `impl_binder_encode_decode!` macro. |
| 27 | 26 | #[derive_where(Clone; I: Interner, T: Clone)] |
| ... | ... | @@ -154,22 +153,19 @@ impl<I: Interner, T: TypeVisitable<I>> TypeSuperVisitable<I> for Binder<I, T> { |
| 154 | 153 | } |
| 155 | 154 | |
| 156 | 155 | impl<I: Interner, T> Binder<I, T> { |
| 157 | /// Skips the binder and returns the "bound" value. This is a | |
| 158 | /// risky thing to do because it's easy to get confused about | |
| 159 | /// De Bruijn indices and the like. It is usually better to | |
| 160 | /// discharge the binder using `no_bound_vars` or | |
| 161 | /// `instantiate_bound_regions` or something like | |
| 162 | /// that. `skip_binder` is only valid when you are either | |
| 163 | /// extracting data that has nothing to do with bound vars, you | |
| 164 | /// are doing some sort of test that does not involve bound | |
| 165 | /// regions, or you are being very careful about your depth | |
| 166 | /// accounting. | |
| 156 | /// Returns the value contained inside of this `for<'a>`. Accessing generic args | |
| 157 | /// in the returned value is generally incorrect. | |
| 158 | /// | |
| 159 | /// Please read <https://rustc-dev-guide.rust-lang.org/ty_module/instantiating_binders.html> | |
| 160 | /// before using this function. It is usually better to discharge the binder using | |
| 161 | /// `no_bound_vars` or `instantiate_bound_regions` or something like that. | |
| 167 | 162 | /// |
| 168 | /// Some examples where `skip_binder` is reasonable: | |
| 163 | /// `skip_binder` is only valid when you are either extracting data that does not reference | |
| 164 | /// any generic arguments, e.g. a `DefId`, or when you're making sure you only pass the | |
| 165 | /// value to things which can handle escaping bound vars. | |
| 169 | 166 | /// |
| 170 | /// - extracting the `DefId` from a PolyTraitRef; | |
| 171 | /// - comparing the self type of a PolyTraitRef to see if it is equal to | |
| 172 | /// a type parameter `X`, since the type `X` does not reference any regions | |
| 167 | /// See existing uses of `.skip_binder()` in `rustc_trait_selection::traits::select` | |
| 168 | /// or `rustc_next_trait_solver` for examples. | |
| 173 | 169 | pub fn skip_binder(self) -> T { |
| 174 | 170 | self.value |
| 175 | 171 | } |
| ... | ... | @@ -355,12 +351,11 @@ impl<I: Interner> TypeVisitor<I> for ValidateBoundVars<I> { |
| 355 | 351 | } |
| 356 | 352 | } |
| 357 | 353 | |
| 358 | /// Similar to [`super::Binder`] except that it tracks early bound generics, i.e. `struct Foo<T>(T)` | |
| 354 | /// Similar to [`Binder`] except that it tracks early bound generics, i.e. `struct Foo<T>(T)` | |
| 359 | 355 | /// needs `T` instantiated immediately. This type primarily exists to avoid forgetting to call |
| 360 | 356 | /// `instantiate`. |
| 361 | 357 | /// |
| 362 | /// If you don't have anything to `instantiate`, you may be looking for | |
| 363 | /// [`instantiate_identity`](EarlyBinder::instantiate_identity) or [`skip_binder`](EarlyBinder::skip_binder). | |
| 358 | /// See <https://rustc-dev-guide.rust-lang.org/ty_module/early_binder.html> for more details. | |
| 364 | 359 | #[derive_where(Clone; I: Interner, T: Clone)] |
| 365 | 360 | #[derive_where(Copy; I: Interner, T: Copy)] |
| 366 | 361 | #[derive_where(PartialEq; I: Interner, T: PartialEq)] |
| ... | ... | @@ -423,17 +418,22 @@ impl<I: Interner, T> EarlyBinder<I, T> { |
| 423 | 418 | EarlyBinder { value, _tcx: PhantomData } |
| 424 | 419 | } |
| 425 | 420 | |
| 426 | /// Skips the binder and returns the "bound" value. | |
| 427 | /// This can be used to extract data that does not depend on generic parameters | |
| 428 | /// (e.g., getting the `DefId` of the inner value or getting the number of | |
| 429 | /// arguments of an `FnSig`). Otherwise, consider using | |
| 430 | /// [`instantiate_identity`](EarlyBinder::instantiate_identity). | |
| 421 | /// Skips the binder and returns the "bound" value. Accessing generic args | |
| 422 | /// in the returned value is generally incorrect. | |
| 423 | /// | |
| 424 | /// Please read <https://rustc-dev-guide.rust-lang.org/ty_module/early_binder.html> | |
| 425 | /// before using this function. | |
| 426 | /// | |
| 427 | /// Only use this to extract data that does not depend on generic parameters, e.g. | |
| 428 | /// to get the `DefId` of the inner value or the number of arguments ofan `FnSig`, | |
| 429 | /// or while making sure to only pass the value to functions which are explicitly | |
| 430 | /// set up to handle these uninstantiated generic parameters. | |
| 431 | 431 | /// |
| 432 | 432 | /// To skip the binder on `x: &EarlyBinder<I, T>` to obtain `&T`, leverage |
| 433 | 433 | /// [`EarlyBinder::as_ref`](EarlyBinder::as_ref): `x.as_ref().skip_binder()`. |
| 434 | 434 | /// |
| 435 | /// See also [`Binder::skip_binder`](super::Binder::skip_binder), which is | |
| 436 | /// the analogous operation on [`super::Binder`]. | |
| 435 | /// See also [`Binder::skip_binder`](Binder::skip_binder), which is | |
| 436 | /// the analogous operation on [`Binder`]. | |
| 437 | 437 | pub fn skip_binder(self) -> T { |
| 438 | 438 | self.value |
| 439 | 439 | } |
library/core/src/intrinsics/mod.rs+12-18| ... | ... | @@ -150,69 +150,63 @@ pub unsafe fn atomic_xchg<T: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: |
| 150 | 150 | |
| 151 | 151 | /// Adds to the current value, returning the previous value. |
| 152 | 152 | /// `T` must be an integer or pointer type. |
| 153 | /// If `T` is a pointer type, the provenance of `src` is ignored: both the return value and the new | |
| 154 | /// value stored at `*dst` will have the provenance of the old value stored there. | |
| 153 | /// `U` must be the same as `T` if that is an integer type, or `usize` if `T` is a pointer type. | |
| 155 | 154 | /// |
| 156 | 155 | /// The stabilized version of this intrinsic is available on the |
| 157 | 156 | /// [`atomic`] types via the `fetch_add` method. For example, [`AtomicIsize::fetch_add`]. |
| 158 | 157 | #[rustc_intrinsic] |
| 159 | 158 | #[rustc_nounwind] |
| 160 | pub unsafe fn atomic_xadd<T: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: T) -> T; | |
| 159 | pub unsafe fn atomic_xadd<T: Copy, U: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: U) -> T; | |
| 161 | 160 | |
| 162 | 161 | /// Subtract from the current value, returning the previous value. |
| 163 | 162 | /// `T` must be an integer or pointer type. |
| 164 | /// If `T` is a pointer type, the provenance of `src` is ignored: both the return value and the new | |
| 165 | /// value stored at `*dst` will have the provenance of the old value stored there. | |
| 163 | /// `U` must be the same as `T` if that is an integer type, or `usize` if `T` is a pointer type. | |
| 166 | 164 | /// |
| 167 | 165 | /// The stabilized version of this intrinsic is available on the |
| 168 | 166 | /// [`atomic`] types via the `fetch_sub` method. For example, [`AtomicIsize::fetch_sub`]. |
| 169 | 167 | #[rustc_intrinsic] |
| 170 | 168 | #[rustc_nounwind] |
| 171 | pub unsafe fn atomic_xsub<T: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: T) -> T; | |
| 169 | pub unsafe fn atomic_xsub<T: Copy, U: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: U) -> T; | |
| 172 | 170 | |
| 173 | 171 | /// Bitwise and with the current value, returning the previous value. |
| 174 | 172 | /// `T` must be an integer or pointer type. |
| 175 | /// If `T` is a pointer type, the provenance of `src` is ignored: both the return value and the new | |
| 176 | /// value stored at `*dst` will have the provenance of the old value stored there. | |
| 173 | /// `U` must be the same as `T` if that is an integer type, or `usize` if `T` is a pointer type. | |
| 177 | 174 | /// |
| 178 | 175 | /// The stabilized version of this intrinsic is available on the |
| 179 | 176 | /// [`atomic`] types via the `fetch_and` method. For example, [`AtomicBool::fetch_and`]. |
| 180 | 177 | #[rustc_intrinsic] |
| 181 | 178 | #[rustc_nounwind] |
| 182 | pub unsafe fn atomic_and<T: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: T) -> T; | |
| 179 | pub unsafe fn atomic_and<T: Copy, U: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: U) -> T; | |
| 183 | 180 | |
| 184 | 181 | /// Bitwise nand with the current value, returning the previous value. |
| 185 | 182 | /// `T` must be an integer or pointer type. |
| 186 | /// If `T` is a pointer type, the provenance of `src` is ignored: both the return value and the new | |
| 187 | /// value stored at `*dst` will have the provenance of the old value stored there. | |
| 183 | /// `U` must be the same as `T` if that is an integer type, or `usize` if `T` is a pointer type. | |
| 188 | 184 | /// |
| 189 | 185 | /// The stabilized version of this intrinsic is available on the |
| 190 | 186 | /// [`AtomicBool`] type via the `fetch_nand` method. For example, [`AtomicBool::fetch_nand`]. |
| 191 | 187 | #[rustc_intrinsic] |
| 192 | 188 | #[rustc_nounwind] |
| 193 | pub unsafe fn atomic_nand<T: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: T) -> T; | |
| 189 | pub unsafe fn atomic_nand<T: Copy, U: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: U) -> T; | |
| 194 | 190 | |
| 195 | 191 | /// Bitwise or with the current value, returning the previous value. |
| 196 | 192 | /// `T` must be an integer or pointer type. |
| 197 | /// If `T` is a pointer type, the provenance of `src` is ignored: both the return value and the new | |
| 198 | /// value stored at `*dst` will have the provenance of the old value stored there. | |
| 193 | /// `U` must be the same as `T` if that is an integer type, or `usize` if `T` is a pointer type. | |
| 199 | 194 | /// |
| 200 | 195 | /// The stabilized version of this intrinsic is available on the |
| 201 | 196 | /// [`atomic`] types via the `fetch_or` method. For example, [`AtomicBool::fetch_or`]. |
| 202 | 197 | #[rustc_intrinsic] |
| 203 | 198 | #[rustc_nounwind] |
| 204 | pub unsafe fn atomic_or<T: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: T) -> T; | |
| 199 | pub unsafe fn atomic_or<T: Copy, U: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: U) -> T; | |
| 205 | 200 | |
| 206 | 201 | /// Bitwise xor with the current value, returning the previous value. |
| 207 | 202 | /// `T` must be an integer or pointer type. |
| 208 | /// If `T` is a pointer type, the provenance of `src` is ignored: both the return value and the new | |
| 209 | /// value stored at `*dst` will have the provenance of the old value stored there. | |
| 203 | /// `U` must be the same as `T` if that is an integer type, or `usize` if `T` is a pointer type. | |
| 210 | 204 | /// |
| 211 | 205 | /// The stabilized version of this intrinsic is available on the |
| 212 | 206 | /// [`atomic`] types via the `fetch_xor` method. For example, [`AtomicBool::fetch_xor`]. |
| 213 | 207 | #[rustc_intrinsic] |
| 214 | 208 | #[rustc_nounwind] |
| 215 | pub unsafe fn atomic_xor<T: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: T) -> T; | |
| 209 | pub unsafe fn atomic_xor<T: Copy, U: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: U) -> T; | |
| 216 | 210 | |
| 217 | 211 | /// Maximum with the current value using a signed comparison. |
| 218 | 212 | /// `T` must be a signed integer type. |
library/core/src/sync/atomic.rs+45-44| ... | ... | @@ -2293,7 +2293,7 @@ impl<T> AtomicPtr<T> { |
| 2293 | 2293 | #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces |
| 2294 | 2294 | pub fn fetch_byte_add(&self, val: usize, order: Ordering) -> *mut T { |
| 2295 | 2295 | // SAFETY: data races are prevented by atomic intrinsics. |
| 2296 | unsafe { atomic_add(self.p.get(), core::ptr::without_provenance_mut(val), order).cast() } | |
| 2296 | unsafe { atomic_add(self.p.get(), val, order).cast() } | |
| 2297 | 2297 | } |
| 2298 | 2298 | |
| 2299 | 2299 | /// Offsets the pointer's address by subtracting `val` *bytes*, returning the |
| ... | ... | @@ -2318,9 +2318,10 @@ impl<T> AtomicPtr<T> { |
| 2318 | 2318 | /// #![feature(strict_provenance_atomic_ptr)] |
| 2319 | 2319 | /// use core::sync::atomic::{AtomicPtr, Ordering}; |
| 2320 | 2320 | /// |
| 2321 | /// let atom = AtomicPtr::<i64>::new(core::ptr::without_provenance_mut(1)); | |
| 2322 | /// assert_eq!(atom.fetch_byte_sub(1, Ordering::Relaxed).addr(), 1); | |
| 2323 | /// assert_eq!(atom.load(Ordering::Relaxed).addr(), 0); | |
| 2321 | /// let mut arr = [0i64, 1]; | |
| 2322 | /// let atom = AtomicPtr::<i64>::new(&raw mut arr[1]); | |
| 2323 | /// assert_eq!(atom.fetch_byte_sub(8, Ordering::Relaxed).addr(), (&raw const arr[1]).addr()); | |
| 2324 | /// assert_eq!(atom.load(Ordering::Relaxed).addr(), (&raw const arr[0]).addr()); | |
| 2324 | 2325 | /// ``` |
| 2325 | 2326 | #[inline] |
| 2326 | 2327 | #[cfg(target_has_atomic = "ptr")] |
| ... | ... | @@ -2328,7 +2329,7 @@ impl<T> AtomicPtr<T> { |
| 2328 | 2329 | #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces |
| 2329 | 2330 | pub fn fetch_byte_sub(&self, val: usize, order: Ordering) -> *mut T { |
| 2330 | 2331 | // SAFETY: data races are prevented by atomic intrinsics. |
| 2331 | unsafe { atomic_sub(self.p.get(), core::ptr::without_provenance_mut(val), order).cast() } | |
| 2332 | unsafe { atomic_sub(self.p.get(), val, order).cast() } | |
| 2332 | 2333 | } |
| 2333 | 2334 | |
| 2334 | 2335 | /// Performs a bitwise "or" operation on the address of the current pointer, |
| ... | ... | @@ -2379,7 +2380,7 @@ impl<T> AtomicPtr<T> { |
| 2379 | 2380 | #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces |
| 2380 | 2381 | pub fn fetch_or(&self, val: usize, order: Ordering) -> *mut T { |
| 2381 | 2382 | // SAFETY: data races are prevented by atomic intrinsics. |
| 2382 | unsafe { atomic_or(self.p.get(), core::ptr::without_provenance_mut(val), order).cast() } | |
| 2383 | unsafe { atomic_or(self.p.get(), val, order).cast() } | |
| 2383 | 2384 | } |
| 2384 | 2385 | |
| 2385 | 2386 | /// Performs a bitwise "and" operation on the address of the current |
| ... | ... | @@ -2429,7 +2430,7 @@ impl<T> AtomicPtr<T> { |
| 2429 | 2430 | #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces |
| 2430 | 2431 | pub fn fetch_and(&self, val: usize, order: Ordering) -> *mut T { |
| 2431 | 2432 | // SAFETY: data races are prevented by atomic intrinsics. |
| 2432 | unsafe { atomic_and(self.p.get(), core::ptr::without_provenance_mut(val), order).cast() } | |
| 2433 | unsafe { atomic_and(self.p.get(), val, order).cast() } | |
| 2433 | 2434 | } |
| 2434 | 2435 | |
| 2435 | 2436 | /// Performs a bitwise "xor" operation on the address of the current |
| ... | ... | @@ -2477,7 +2478,7 @@ impl<T> AtomicPtr<T> { |
| 2477 | 2478 | #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces |
| 2478 | 2479 | pub fn fetch_xor(&self, val: usize, order: Ordering) -> *mut T { |
| 2479 | 2480 | // SAFETY: data races are prevented by atomic intrinsics. |
| 2480 | unsafe { atomic_xor(self.p.get(), core::ptr::without_provenance_mut(val), order).cast() } | |
| 2481 | unsafe { atomic_xor(self.p.get(), val, order).cast() } | |
| 2481 | 2482 | } |
| 2482 | 2483 | |
| 2483 | 2484 | /// Returns a mutable pointer to the underlying pointer. |
| ... | ... | @@ -3981,15 +3982,15 @@ unsafe fn atomic_swap<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T { |
| 3981 | 3982 | #[inline] |
| 3982 | 3983 | #[cfg(target_has_atomic)] |
| 3983 | 3984 | #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces |
| 3984 | unsafe fn atomic_add<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T { | |
| 3985 | unsafe fn atomic_add<T: Copy, U: Copy>(dst: *mut T, val: U, order: Ordering) -> T { | |
| 3985 | 3986 | // SAFETY: the caller must uphold the safety contract for `atomic_add`. |
| 3986 | 3987 | unsafe { |
| 3987 | 3988 | match order { |
| 3988 | Relaxed => intrinsics::atomic_xadd::<T, { AO::Relaxed }>(dst, val), | |
| 3989 | Acquire => intrinsics::atomic_xadd::<T, { AO::Acquire }>(dst, val), | |
| 3990 | Release => intrinsics::atomic_xadd::<T, { AO::Release }>(dst, val), | |
| 3991 | AcqRel => intrinsics::atomic_xadd::<T, { AO::AcqRel }>(dst, val), | |
| 3992 | SeqCst => intrinsics::atomic_xadd::<T, { AO::SeqCst }>(dst, val), | |
| 3989 | Relaxed => intrinsics::atomic_xadd::<T, U, { AO::Relaxed }>(dst, val), | |
| 3990 | Acquire => intrinsics::atomic_xadd::<T, U, { AO::Acquire }>(dst, val), | |
| 3991 | Release => intrinsics::atomic_xadd::<T, U, { AO::Release }>(dst, val), | |
| 3992 | AcqRel => intrinsics::atomic_xadd::<T, U, { AO::AcqRel }>(dst, val), | |
| 3993 | SeqCst => intrinsics::atomic_xadd::<T, U, { AO::SeqCst }>(dst, val), | |
| 3993 | 3994 | } |
| 3994 | 3995 | } |
| 3995 | 3996 | } |
| ... | ... | @@ -3998,15 +3999,15 @@ unsafe fn atomic_add<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T { |
| 3998 | 3999 | #[inline] |
| 3999 | 4000 | #[cfg(target_has_atomic)] |
| 4000 | 4001 | #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces |
| 4001 | unsafe fn atomic_sub<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T { | |
| 4002 | unsafe fn atomic_sub<T: Copy, U: Copy>(dst: *mut T, val: U, order: Ordering) -> T { | |
| 4002 | 4003 | // SAFETY: the caller must uphold the safety contract for `atomic_sub`. |
| 4003 | 4004 | unsafe { |
| 4004 | 4005 | match order { |
| 4005 | Relaxed => intrinsics::atomic_xsub::<T, { AO::Relaxed }>(dst, val), | |
| 4006 | Acquire => intrinsics::atomic_xsub::<T, { AO::Acquire }>(dst, val), | |
| 4007 | Release => intrinsics::atomic_xsub::<T, { AO::Release }>(dst, val), | |
| 4008 | AcqRel => intrinsics::atomic_xsub::<T, { AO::AcqRel }>(dst, val), | |
| 4009 | SeqCst => intrinsics::atomic_xsub::<T, { AO::SeqCst }>(dst, val), | |
| 4006 | Relaxed => intrinsics::atomic_xsub::<T, U, { AO::Relaxed }>(dst, val), | |
| 4007 | Acquire => intrinsics::atomic_xsub::<T, U, { AO::Acquire }>(dst, val), | |
| 4008 | Release => intrinsics::atomic_xsub::<T, U, { AO::Release }>(dst, val), | |
| 4009 | AcqRel => intrinsics::atomic_xsub::<T, U, { AO::AcqRel }>(dst, val), | |
| 4010 | SeqCst => intrinsics::atomic_xsub::<T, U, { AO::SeqCst }>(dst, val), | |
| 4010 | 4011 | } |
| 4011 | 4012 | } |
| 4012 | 4013 | } |
| ... | ... | @@ -4147,15 +4148,15 @@ unsafe fn atomic_compare_exchange_weak<T: Copy>( |
| 4147 | 4148 | #[inline] |
| 4148 | 4149 | #[cfg(target_has_atomic)] |
| 4149 | 4150 | #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces |
| 4150 | unsafe fn atomic_and<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T { | |
| 4151 | unsafe fn atomic_and<T: Copy, U: Copy>(dst: *mut T, val: U, order: Ordering) -> T { | |
| 4151 | 4152 | // SAFETY: the caller must uphold the safety contract for `atomic_and` |
| 4152 | 4153 | unsafe { |
| 4153 | 4154 | match order { |
| 4154 | Relaxed => intrinsics::atomic_and::<T, { AO::Relaxed }>(dst, val), | |
| 4155 | Acquire => intrinsics::atomic_and::<T, { AO::Acquire }>(dst, val), | |
| 4156 | Release => intrinsics::atomic_and::<T, { AO::Release }>(dst, val), | |
| 4157 | AcqRel => intrinsics::atomic_and::<T, { AO::AcqRel }>(dst, val), | |
| 4158 | SeqCst => intrinsics::atomic_and::<T, { AO::SeqCst }>(dst, val), | |
| 4155 | Relaxed => intrinsics::atomic_and::<T, U, { AO::Relaxed }>(dst, val), | |
| 4156 | Acquire => intrinsics::atomic_and::<T, U, { AO::Acquire }>(dst, val), | |
| 4157 | Release => intrinsics::atomic_and::<T, U, { AO::Release }>(dst, val), | |
| 4158 | AcqRel => intrinsics::atomic_and::<T, U, { AO::AcqRel }>(dst, val), | |
| 4159 | SeqCst => intrinsics::atomic_and::<T, U, { AO::SeqCst }>(dst, val), | |
| 4159 | 4160 | } |
| 4160 | 4161 | } |
| 4161 | 4162 | } |
| ... | ... | @@ -4163,15 +4164,15 @@ unsafe fn atomic_and<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T { |
| 4163 | 4164 | #[inline] |
| 4164 | 4165 | #[cfg(target_has_atomic)] |
| 4165 | 4166 | #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces |
| 4166 | unsafe fn atomic_nand<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T { | |
| 4167 | unsafe fn atomic_nand<T: Copy, U: Copy>(dst: *mut T, val: U, order: Ordering) -> T { | |
| 4167 | 4168 | // SAFETY: the caller must uphold the safety contract for `atomic_nand` |
| 4168 | 4169 | unsafe { |
| 4169 | 4170 | match order { |
| 4170 | Relaxed => intrinsics::atomic_nand::<T, { AO::Relaxed }>(dst, val), | |
| 4171 | Acquire => intrinsics::atomic_nand::<T, { AO::Acquire }>(dst, val), | |
| 4172 | Release => intrinsics::atomic_nand::<T, { AO::Release }>(dst, val), | |
| 4173 | AcqRel => intrinsics::atomic_nand::<T, { AO::AcqRel }>(dst, val), | |
| 4174 | SeqCst => intrinsics::atomic_nand::<T, { AO::SeqCst }>(dst, val), | |
| 4171 | Relaxed => intrinsics::atomic_nand::<T, U, { AO::Relaxed }>(dst, val), | |
| 4172 | Acquire => intrinsics::atomic_nand::<T, U, { AO::Acquire }>(dst, val), | |
| 4173 | Release => intrinsics::atomic_nand::<T, U, { AO::Release }>(dst, val), | |
| 4174 | AcqRel => intrinsics::atomic_nand::<T, U, { AO::AcqRel }>(dst, val), | |
| 4175 | SeqCst => intrinsics::atomic_nand::<T, U, { AO::SeqCst }>(dst, val), | |
| 4175 | 4176 | } |
| 4176 | 4177 | } |
| 4177 | 4178 | } |
| ... | ... | @@ -4179,15 +4180,15 @@ unsafe fn atomic_nand<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T { |
| 4179 | 4180 | #[inline] |
| 4180 | 4181 | #[cfg(target_has_atomic)] |
| 4181 | 4182 | #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces |
| 4182 | unsafe fn atomic_or<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T { | |
| 4183 | unsafe fn atomic_or<T: Copy, U: Copy>(dst: *mut T, val: U, order: Ordering) -> T { | |
| 4183 | 4184 | // SAFETY: the caller must uphold the safety contract for `atomic_or` |
| 4184 | 4185 | unsafe { |
| 4185 | 4186 | match order { |
| 4186 | SeqCst => intrinsics::atomic_or::<T, { AO::SeqCst }>(dst, val), | |
| 4187 | Acquire => intrinsics::atomic_or::<T, { AO::Acquire }>(dst, val), | |
| 4188 | Release => intrinsics::atomic_or::<T, { AO::Release }>(dst, val), | |
| 4189 | AcqRel => intrinsics::atomic_or::<T, { AO::AcqRel }>(dst, val), | |
| 4190 | Relaxed => intrinsics::atomic_or::<T, { AO::Relaxed }>(dst, val), | |
| 4187 | SeqCst => intrinsics::atomic_or::<T, U, { AO::SeqCst }>(dst, val), | |
| 4188 | Acquire => intrinsics::atomic_or::<T, U, { AO::Acquire }>(dst, val), | |
| 4189 | Release => intrinsics::atomic_or::<T, U, { AO::Release }>(dst, val), | |
| 4190 | AcqRel => intrinsics::atomic_or::<T, U, { AO::AcqRel }>(dst, val), | |
| 4191 | Relaxed => intrinsics::atomic_or::<T, U, { AO::Relaxed }>(dst, val), | |
| 4191 | 4192 | } |
| 4192 | 4193 | } |
| 4193 | 4194 | } |
| ... | ... | @@ -4195,15 +4196,15 @@ unsafe fn atomic_or<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T { |
| 4195 | 4196 | #[inline] |
| 4196 | 4197 | #[cfg(target_has_atomic)] |
| 4197 | 4198 | #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces |
| 4198 | unsafe fn atomic_xor<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T { | |
| 4199 | unsafe fn atomic_xor<T: Copy, U: Copy>(dst: *mut T, val: U, order: Ordering) -> T { | |
| 4199 | 4200 | // SAFETY: the caller must uphold the safety contract for `atomic_xor` |
| 4200 | 4201 | unsafe { |
| 4201 | 4202 | match order { |
| 4202 | SeqCst => intrinsics::atomic_xor::<T, { AO::SeqCst }>(dst, val), | |
| 4203 | Acquire => intrinsics::atomic_xor::<T, { AO::Acquire }>(dst, val), | |
| 4204 | Release => intrinsics::atomic_xor::<T, { AO::Release }>(dst, val), | |
| 4205 | AcqRel => intrinsics::atomic_xor::<T, { AO::AcqRel }>(dst, val), | |
| 4206 | Relaxed => intrinsics::atomic_xor::<T, { AO::Relaxed }>(dst, val), | |
| 4203 | SeqCst => intrinsics::atomic_xor::<T, U, { AO::SeqCst }>(dst, val), | |
| 4204 | Acquire => intrinsics::atomic_xor::<T, U, { AO::Acquire }>(dst, val), | |
| 4205 | Release => intrinsics::atomic_xor::<T, U, { AO::Release }>(dst, val), | |
| 4206 | AcqRel => intrinsics::atomic_xor::<T, U, { AO::AcqRel }>(dst, val), | |
| 4207 | Relaxed => intrinsics::atomic_xor::<T, U, { AO::Relaxed }>(dst, val), | |
| 4207 | 4208 | } |
| 4208 | 4209 | } |
| 4209 | 4210 | } |
src/doc/rustc/src/platform-support/apple-ios-macabi.md+11| ... | ... | @@ -56,6 +56,17 @@ Rust programs can be built for these targets by specifying `--target`, if |
| 56 | 56 | $ rustc --target aarch64-apple-ios-macabi your-code.rs |
| 57 | 57 | ``` |
| 58 | 58 | |
| 59 | The target can be differentiated from the iOS targets with the | |
| 60 | `target_env = "macabi"` cfg (or `target_abi = "macabi"` before Rust CURRENT_RUSTC_VERSION). | |
| 61 | ||
| 62 | ```rust | |
| 63 | if cfg!(target_env = "macabi") { | |
| 64 | // Do something only on Mac Catalyst. | |
| 65 | } | |
| 66 | ``` | |
| 67 | ||
| 68 | This is similar to the `TARGET_OS_MACCATALYST` define in C code. | |
| 69 | ||
| 59 | 70 | ## Testing |
| 60 | 71 | |
| 61 | 72 | Mac Catalyst binaries can be run directly on macOS 10.15 Catalina or newer. |
src/doc/rustc/src/platform-support/apple-ios.md+14| ... | ... | @@ -66,6 +66,20 @@ Rust programs can be built for these targets by specifying `--target`, if |
| 66 | 66 | $ rustc --target aarch64-apple-ios your-code.rs |
| 67 | 67 | ``` |
| 68 | 68 | |
| 69 | The simulator variants can be differentiated from the variants running | |
| 70 | on-device with the `target_env = "sim"` cfg (or `target_abi = "sim"` before | |
| 71 | Rust CURRENT_RUSTC_VERSION). | |
| 72 | ||
| 73 | ```rust | |
| 74 | if cfg!(all(target_vendor = "apple", target_env = "sim")) { | |
| 75 | // Do something on the iOS/tvOS/visionOS/watchOS Simulator. | |
| 76 | } { | |
| 77 | // Everything else, like Windows and non-Simulator iOS. | |
| 78 | } | |
| 79 | ``` | |
| 80 | ||
| 81 | This is similar to the `TARGET_OS_SIMULATOR` define in C code. | |
| 82 | ||
| 69 | 83 | ## Testing |
| 70 | 84 | |
| 71 | 85 | There is no support for running the Rust or standard library testsuite at the |
src/tools/compiletest/src/directives/tests.rs+2-5| ... | ... | @@ -637,6 +637,7 @@ fn matches_env() { |
| 637 | 637 | ("x86_64-unknown-linux-gnu", "gnu"), |
| 638 | 638 | ("x86_64-fortanix-unknown-sgx", "sgx"), |
| 639 | 639 | ("arm-unknown-linux-musleabi", "musl"), |
| 640 | ("aarch64-apple-ios-macabi", "macabi"), | |
| 640 | 641 | ]; |
| 641 | 642 | for (target, env) in envs { |
| 642 | 643 | let config: Config = cfg().target(target).build(); |
| ... | ... | @@ -647,11 +648,7 @@ fn matches_env() { |
| 647 | 648 | |
| 648 | 649 | #[test] |
| 649 | 650 | fn matches_abi() { |
| 650 | let abis = [ | |
| 651 | ("aarch64-apple-ios-macabi", "macabi"), | |
| 652 | ("x86_64-unknown-linux-gnux32", "x32"), | |
| 653 | ("arm-unknown-linux-gnueabi", "eabi"), | |
| 654 | ]; | |
| 651 | let abis = [("x86_64-unknown-linux-gnux32", "x32"), ("arm-unknown-linux-gnueabi", "eabi")]; | |
| 655 | 652 | for (target, abi) in abis { |
| 656 | 653 | let config: Config = cfg().target(target).build(); |
| 657 | 654 | assert!(config.matches_abi(abi), "{target} {abi}"); |
src/tools/miri/src/intrinsics/atomic.rs+9-10| ... | ... | @@ -105,27 +105,27 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | "or" => { |
| 108 | let ord = get_ord_at(1); | |
| 108 | let ord = get_ord_at(2); | |
| 109 | 109 | this.atomic_rmw_op(args, dest, AtomicOp::MirOp(BinOp::BitOr, false), rw_ord(ord))?; |
| 110 | 110 | } |
| 111 | 111 | "xor" => { |
| 112 | let ord = get_ord_at(1); | |
| 112 | let ord = get_ord_at(2); | |
| 113 | 113 | this.atomic_rmw_op(args, dest, AtomicOp::MirOp(BinOp::BitXor, false), rw_ord(ord))?; |
| 114 | 114 | } |
| 115 | 115 | "and" => { |
| 116 | let ord = get_ord_at(1); | |
| 116 | let ord = get_ord_at(2); | |
| 117 | 117 | this.atomic_rmw_op(args, dest, AtomicOp::MirOp(BinOp::BitAnd, false), rw_ord(ord))?; |
| 118 | 118 | } |
| 119 | 119 | "nand" => { |
| 120 | let ord = get_ord_at(1); | |
| 120 | let ord = get_ord_at(2); | |
| 121 | 121 | this.atomic_rmw_op(args, dest, AtomicOp::MirOp(BinOp::BitAnd, true), rw_ord(ord))?; |
| 122 | 122 | } |
| 123 | 123 | "xadd" => { |
| 124 | let ord = get_ord_at(1); | |
| 124 | let ord = get_ord_at(2); | |
| 125 | 125 | this.atomic_rmw_op(args, dest, AtomicOp::MirOp(BinOp::Add, false), rw_ord(ord))?; |
| 126 | 126 | } |
| 127 | 127 | "xsub" => { |
| 128 | let ord = get_ord_at(1); | |
| 128 | let ord = get_ord_at(2); | |
| 129 | 129 | this.atomic_rmw_op(args, dest, AtomicOp::MirOp(BinOp::Sub, false), rw_ord(ord))?; |
| 130 | 130 | } |
| 131 | 131 | "min" => { |
| ... | ... | @@ -231,15 +231,14 @@ trait EvalContextPrivExt<'tcx>: MiriInterpCxExt<'tcx> { |
| 231 | 231 | let place = this.deref_pointer(place)?; |
| 232 | 232 | let rhs = this.read_immediate(rhs)?; |
| 233 | 233 | |
| 234 | if !place.layout.ty.is_integral() && !place.layout.ty.is_raw_ptr() { | |
| 234 | if !(place.layout.ty.is_integral() || place.layout.ty.is_raw_ptr()) | |
| 235 | || !(rhs.layout.ty.is_integral() || rhs.layout.ty.is_raw_ptr()) | |
| 236 | { | |
| 235 | 237 | span_bug!( |
| 236 | 238 | this.cur_span(), |
| 237 | 239 | "atomic arithmetic operations only work on integer and raw pointer types", |
| 238 | 240 | ); |
| 239 | 241 | } |
| 240 | if rhs.layout.ty != place.layout.ty { | |
| 241 | span_bug!(this.cur_span(), "atomic arithmetic operation type mismatch"); | |
| 242 | } | |
| 243 | 242 | |
| 244 | 243 | let old = match atomic_op { |
| 245 | 244 | AtomicOp::Min => |
src/tools/miri/src/operator.rs+2-6| ... | ... | @@ -50,17 +50,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | // Some more operations are possible with atomics. |
| 53 | // The return value always has the provenance of the *left* operand. | |
| 53 | // The RHS must be `usize`. | |
| 54 | 54 | Add | Sub | BitOr | BitAnd | BitXor => { |
| 55 | 55 | assert!(left.layout.ty.is_raw_ptr()); |
| 56 | assert!(right.layout.ty.is_raw_ptr()); | |
| 56 | assert_eq!(right.layout.ty, this.tcx.types.usize); | |
| 57 | 57 | let ptr = left.to_scalar().to_pointer(this)?; |
| 58 | 58 | // We do the actual operation with usize-typed scalars. |
| 59 | 59 | let left = ImmTy::from_uint(ptr.addr().bytes(), this.machine.layouts.usize); |
| 60 | let right = ImmTy::from_uint( | |
| 61 | right.to_scalar().to_target_usize(this)?, | |
| 62 | this.machine.layouts.usize, | |
| 63 | ); | |
| 64 | 60 | let result = this.binary_op(bin_op, &left, &right)?; |
| 65 | 61 | // Construct a new pointer with the provenance of `ptr` (the LHS). |
| 66 | 62 | let result_ptr = Pointer::new( |
src/tools/miri/tests/fail/alloc/alloc_error_handler_custom.stderr+1-1| ... | ... | @@ -11,7 +11,7 @@ note: inside `_::__rg_oom` |
| 11 | 11 | --> tests/fail/alloc/alloc_error_handler_custom.rs:LL:CC |
| 12 | 12 | | |
| 13 | 13 | LL | #[alloc_error_handler] |
| 14 | | ---------------------- in this procedural macro expansion | |
| 14 | | ---------------------- in this attribute macro expansion | |
| 15 | 15 | LL | fn alloc_error_handler(layout: Layout) -> ! { |
| 16 | 16 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 17 | 17 | = note: inside `alloc::alloc::handle_alloc_error::rt_error` at RUSTLIB/alloc/src/alloc.rs:LL:CC |
tests/codegen-llvm/atomicptr.rs+3-3| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | // LLVM does not support some atomic RMW operations on pointers, so inside codegen we lower those |
| 2 | // to integer atomics, surrounded by casts to and from integer type. | |
| 2 | // to integer atomics, followed by an inttoptr cast. | |
| 3 | 3 | // This test ensures that we do the round-trip correctly for AtomicPtr::fetch_byte_add, and also |
| 4 | 4 | // ensures that we do not have such a round-trip for AtomicPtr::swap, because LLVM supports pointer |
| 5 | 5 | // arguments to `atomicrmw xchg`. |
| ... | ... | @@ -20,8 +20,8 @@ pub fn helper(_: usize) {} |
| 20 | 20 | // CHECK-LABEL: @atomicptr_fetch_byte_add |
| 21 | 21 | #[no_mangle] |
| 22 | 22 | pub fn atomicptr_fetch_byte_add(a: &AtomicPtr<u8>, v: usize) -> *mut u8 { |
| 23 | // CHECK: %[[INTPTR:.*]] = ptrtoint ptr %{{.*}} to [[USIZE]] | |
| 24 | // CHECK-NEXT: %[[RET:.*]] = atomicrmw add ptr %{{.*}}, [[USIZE]] %[[INTPTR]] | |
| 23 | // CHECK: llvm.lifetime.start | |
| 24 | // CHECK-NEXT: %[[RET:.*]] = atomicrmw add ptr %{{.*}}, [[USIZE]] %v | |
| 25 | 25 | // CHECK-NEXT: inttoptr [[USIZE]] %[[RET]] to ptr |
| 26 | 26 | a.fetch_byte_add(v, Relaxed) |
| 27 | 27 | } |
tests/run-make/atomic-lock-free/atomic_lock_free.rs+25-14| ... | ... | @@ -14,7 +14,7 @@ pub enum AtomicOrdering { |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | #[rustc_intrinsic] |
| 17 | unsafe fn atomic_xadd<T, const ORD: AtomicOrdering>(dst: *mut T, src: T) -> T; | |
| 17 | unsafe fn atomic_xadd<T, U, const ORD: AtomicOrdering>(dst: *mut T, src: U) -> T; | |
| 18 | 18 | |
| 19 | 19 | #[lang = "pointee_sized"] |
| 20 | 20 | pub trait PointeeSized {} |
| ... | ... | @@ -35,51 +35,62 @@ impl<T: ?Sized> Copy for *mut T {} |
| 35 | 35 | impl ConstParamTy for AtomicOrdering {} |
| 36 | 36 | |
| 37 | 37 | #[cfg(target_has_atomic = "8")] |
| 38 | #[unsafe(no_mangle)] // let's make sure we actually generate a symbol to check | |
| 38 | 39 | pub unsafe fn atomic_u8(x: *mut u8) { |
| 39 | atomic_xadd::<_, { AtomicOrdering::SeqCst }>(x, 1); | |
| 40 | atomic_xadd::<_, { AtomicOrdering::SeqCst }>(x, 1); | |
| 40 | atomic_xadd::<_, _, { AtomicOrdering::SeqCst }>(x, 1u8); | |
| 41 | 41 | } |
| 42 | 42 | #[cfg(target_has_atomic = "8")] |
| 43 | #[unsafe(no_mangle)] | |
| 43 | 44 | pub unsafe fn atomic_i8(x: *mut i8) { |
| 44 | atomic_xadd::<_, { AtomicOrdering::SeqCst }>(x, 1); | |
| 45 | atomic_xadd::<_, _, { AtomicOrdering::SeqCst }>(x, 1i8); | |
| 45 | 46 | } |
| 46 | 47 | #[cfg(target_has_atomic = "16")] |
| 48 | #[unsafe(no_mangle)] | |
| 47 | 49 | pub unsafe fn atomic_u16(x: *mut u16) { |
| 48 | atomic_xadd::<_, { AtomicOrdering::SeqCst }>(x, 1); | |
| 50 | atomic_xadd::<_, _, { AtomicOrdering::SeqCst }>(x, 1u16); | |
| 49 | 51 | } |
| 50 | 52 | #[cfg(target_has_atomic = "16")] |
| 53 | #[unsafe(no_mangle)] | |
| 51 | 54 | pub unsafe fn atomic_i16(x: *mut i16) { |
| 52 | atomic_xadd::<_, { AtomicOrdering::SeqCst }>(x, 1); | |
| 55 | atomic_xadd::<_, _, { AtomicOrdering::SeqCst }>(x, 1i16); | |
| 53 | 56 | } |
| 54 | 57 | #[cfg(target_has_atomic = "32")] |
| 58 | #[unsafe(no_mangle)] | |
| 55 | 59 | pub unsafe fn atomic_u32(x: *mut u32) { |
| 56 | atomic_xadd::<_, { AtomicOrdering::SeqCst }>(x, 1); | |
| 60 | atomic_xadd::<_, _, { AtomicOrdering::SeqCst }>(x, 1u32); | |
| 57 | 61 | } |
| 58 | 62 | #[cfg(target_has_atomic = "32")] |
| 63 | #[unsafe(no_mangle)] | |
| 59 | 64 | pub unsafe fn atomic_i32(x: *mut i32) { |
| 60 | atomic_xadd::<_, { AtomicOrdering::SeqCst }>(x, 1); | |
| 65 | atomic_xadd::<_, _, { AtomicOrdering::SeqCst }>(x, 1i32); | |
| 61 | 66 | } |
| 62 | 67 | #[cfg(target_has_atomic = "64")] |
| 68 | #[unsafe(no_mangle)] | |
| 63 | 69 | pub unsafe fn atomic_u64(x: *mut u64) { |
| 64 | atomic_xadd::<_, { AtomicOrdering::SeqCst }>(x, 1); | |
| 70 | atomic_xadd::<_, _, { AtomicOrdering::SeqCst }>(x, 1u64); | |
| 65 | 71 | } |
| 66 | 72 | #[cfg(target_has_atomic = "64")] |
| 73 | #[unsafe(no_mangle)] | |
| 67 | 74 | pub unsafe fn atomic_i64(x: *mut i64) { |
| 68 | atomic_xadd::<_, { AtomicOrdering::SeqCst }>(x, 1); | |
| 75 | atomic_xadd::<_, _, { AtomicOrdering::SeqCst }>(x, 1i64); | |
| 69 | 76 | } |
| 70 | 77 | #[cfg(target_has_atomic = "128")] |
| 78 | #[unsafe(no_mangle)] | |
| 71 | 79 | pub unsafe fn atomic_u128(x: *mut u128) { |
| 72 | atomic_xadd::<_, { AtomicOrdering::SeqCst }>(x, 1); | |
| 80 | atomic_xadd::<_, _, { AtomicOrdering::SeqCst }>(x, 1u128); | |
| 73 | 81 | } |
| 74 | 82 | #[cfg(target_has_atomic = "128")] |
| 83 | #[unsafe(no_mangle)] | |
| 75 | 84 | pub unsafe fn atomic_i128(x: *mut i128) { |
| 76 | atomic_xadd::<_, { AtomicOrdering::SeqCst }>(x, 1); | |
| 85 | atomic_xadd::<_, _, { AtomicOrdering::SeqCst }>(x, 1i128); | |
| 77 | 86 | } |
| 78 | 87 | #[cfg(target_has_atomic = "ptr")] |
| 88 | #[unsafe(no_mangle)] | |
| 79 | 89 | pub unsafe fn atomic_usize(x: *mut usize) { |
| 80 | atomic_xadd::<_, { AtomicOrdering::SeqCst }>(x, 1); | |
| 90 | atomic_xadd::<_, _, { AtomicOrdering::SeqCst }>(x, 1usize); | |
| 81 | 91 | } |
| 82 | 92 | #[cfg(target_has_atomic = "ptr")] |
| 93 | #[unsafe(no_mangle)] | |
| 83 | 94 | pub unsafe fn atomic_isize(x: *mut isize) { |
| 84 | atomic_xadd::<_, { AtomicOrdering::SeqCst }>(x, 1); | |
| 95 | atomic_xadd::<_, _, { AtomicOrdering::SeqCst }>(x, 1isize); | |
| 85 | 96 | } |
tests/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr+2-2| ... | ... | @@ -2,7 +2,7 @@ error[E0308]: mismatched types |
| 2 | 2 | --> $DIR/alloc-error-handler-bad-signature-1.rs:10:1 |
| 3 | 3 | | |
| 4 | 4 | LL | #[alloc_error_handler] |
| 5 | | ---------------------- in this procedural macro expansion | |
| 5 | | ---------------------- in this attribute macro expansion | |
| 6 | 6 | LL | // fn oom( |
| 7 | 7 | LL | || info: &Layout, |
| 8 | 8 | LL | || ) -> () |
| ... | ... | @@ -23,7 +23,7 @@ error[E0308]: mismatched types |
| 23 | 23 | --> $DIR/alloc-error-handler-bad-signature-1.rs:10:1 |
| 24 | 24 | | |
| 25 | 25 | LL | #[alloc_error_handler] |
| 26 | | ---------------------- in this procedural macro expansion | |
| 26 | | ---------------------- in this attribute macro expansion | |
| 27 | 27 | LL | // fn oom( |
| 28 | 28 | LL | || info: &Layout, |
| 29 | 29 | LL | || ) -> () |
tests/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr+2-2| ... | ... | @@ -2,7 +2,7 @@ error[E0308]: mismatched types |
| 2 | 2 | --> $DIR/alloc-error-handler-bad-signature-2.rs:10:1 |
| 3 | 3 | | |
| 4 | 4 | LL | #[alloc_error_handler] |
| 5 | | ---------------------- in this procedural macro expansion | |
| 5 | | ---------------------- in this attribute macro expansion | |
| 6 | 6 | LL | // fn oom( |
| 7 | 7 | LL | || info: Layout, |
| 8 | 8 | LL | || ) { |
| ... | ... | @@ -31,7 +31,7 @@ error[E0308]: mismatched types |
| 31 | 31 | --> $DIR/alloc-error-handler-bad-signature-2.rs:10:1 |
| 32 | 32 | | |
| 33 | 33 | LL | #[alloc_error_handler] |
| 34 | | ---------------------- in this procedural macro expansion | |
| 34 | | ---------------------- in this attribute macro expansion | |
| 35 | 35 | LL | // fn oom( |
| 36 | 36 | LL | || info: Layout, |
| 37 | 37 | LL | || ) { |
tests/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr+1-1| ... | ... | @@ -2,7 +2,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied |
| 2 | 2 | --> $DIR/alloc-error-handler-bad-signature-3.rs:10:1 |
| 3 | 3 | | |
| 4 | 4 | LL | #[alloc_error_handler] |
| 5 | | ---------------------- in this procedural macro expansion | |
| 5 | | ---------------------- in this attribute macro expansion | |
| 6 | 6 | LL | fn oom() -> ! { |
| 7 | 7 | | _-^^^^^^^^^^^^ |
| 8 | 8 | LL | | loop {} |
tests/ui/allocator/not-an-allocator.stderr+4-4| ... | ... | @@ -2,7 +2,7 @@ error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied |
| 2 | 2 | --> $DIR/not-an-allocator.rs:2:11 |
| 3 | 3 | | |
| 4 | 4 | LL | #[global_allocator] |
| 5 | | ------------------- in this procedural macro expansion | |
| 5 | | ------------------- in this attribute macro expansion | |
| 6 | 6 | LL | static A: usize = 0; |
| 7 | 7 | | ^^^^^ the trait `GlobalAlloc` is not implemented for `usize` |
| 8 | 8 | | |
| ... | ... | @@ -12,7 +12,7 @@ error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied |
| 12 | 12 | --> $DIR/not-an-allocator.rs:2:11 |
| 13 | 13 | | |
| 14 | 14 | LL | #[global_allocator] |
| 15 | | ------------------- in this procedural macro expansion | |
| 15 | | ------------------- in this attribute macro expansion | |
| 16 | 16 | LL | static A: usize = 0; |
| 17 | 17 | | ^^^^^ the trait `GlobalAlloc` is not implemented for `usize` |
| 18 | 18 | | |
| ... | ... | @@ -23,7 +23,7 @@ error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied |
| 23 | 23 | --> $DIR/not-an-allocator.rs:2:11 |
| 24 | 24 | | |
| 25 | 25 | LL | #[global_allocator] |
| 26 | | ------------------- in this procedural macro expansion | |
| 26 | | ------------------- in this attribute macro expansion | |
| 27 | 27 | LL | static A: usize = 0; |
| 28 | 28 | | ^^^^^ the trait `GlobalAlloc` is not implemented for `usize` |
| 29 | 29 | | |
| ... | ... | @@ -34,7 +34,7 @@ error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied |
| 34 | 34 | --> $DIR/not-an-allocator.rs:2:11 |
| 35 | 35 | | |
| 36 | 36 | LL | #[global_allocator] |
| 37 | | ------------------- in this procedural macro expansion | |
| 37 | | ------------------- in this attribute macro expansion | |
| 38 | 38 | LL | static A: usize = 0; |
| 39 | 39 | | ^^^^^ the trait `GlobalAlloc` is not implemented for `usize` |
| 40 | 40 | | |
tests/ui/allocator/two-allocators.stderr+1-1| ... | ... | @@ -4,7 +4,7 @@ error: cannot define multiple global allocators |
| 4 | 4 | LL | static A: System = System; |
| 5 | 5 | | -------------------------- previous global allocator defined here |
| 6 | 6 | LL | #[global_allocator] |
| 7 | | ------------------- in this procedural macro expansion | |
| 7 | | ------------------- in this attribute macro expansion | |
| 8 | 8 | LL | static B: System = System; |
| 9 | 9 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot define a new global allocator |
| 10 | 10 |
tests/ui/attributes/rustc_confusables_std_cases.stderr+3-3| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | error[E0599]: no method named `push` found for struct `BTreeSet` in the current scope | |
| 1 | error[E0599]: no method named `push` found for struct `BTreeSet<T, A>` in the current scope | |
| 2 | 2 | --> $DIR/rustc_confusables_std_cases.rs:6:7 |
| 3 | 3 | | |
| 4 | 4 | LL | x.push(1); |
| ... | ... | @@ -22,7 +22,7 @@ LL - x.push_back(1); |
| 22 | 22 | LL + x.push(1); |
| 23 | 23 | | |
| 24 | 24 | |
| 25 | error[E0599]: no method named `push` found for struct `VecDeque` in the current scope | |
| 25 | error[E0599]: no method named `push` found for struct `VecDeque<T, A>` in the current scope | |
| 26 | 26 | --> $DIR/rustc_confusables_std_cases.rs:12:7 |
| 27 | 27 | | |
| 28 | 28 | LL | x.push(1); |
| ... | ... | @@ -35,7 +35,7 @@ LL | let mut x = Vec::new(); |
| 35 | 35 | | ^^^^^ `x` of type `Vec<_>` that has method `push` defined earlier here |
| 36 | 36 | ... |
| 37 | 37 | LL | let mut x = VecDeque::new(); |
| 38 | | ----- earlier `x` shadowed here with type `VecDeque` | |
| 38 | | ----- earlier `x` shadowed here with type `VecDeque<_>` | |
| 39 | 39 | help: you might have meant to use `push_back` |
| 40 | 40 | | |
| 41 | 41 | LL | x.push_back(1); |
tests/ui/check-cfg/well-known-values.stderr+1-1| ... | ... | @@ -156,7 +156,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 156 | 156 | LL | target_env = "_UNEXPECTED_VALUE", |
| 157 | 157 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 158 | 158 | | |
| 159 | = note: expected values for `target_env` are: ``, `gnu`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `nto71_iosock`, `nto80`, `ohos`, `p1`, `p2`, `relibc`, `sgx`, `uclibc`, and `v5` | |
| 159 | = note: expected values for `target_env` are: ``, `gnu`, `macabi`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `nto71_iosock`, `nto80`, `ohos`, `p1`, `p2`, `relibc`, `sgx`, `sim`, `uclibc`, and `v5` | |
| 160 | 160 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 161 | 161 | |
| 162 | 162 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
tests/ui/codegen/overflow-during-mono.rs+2-1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | //~ ERROR overflow evaluating the requirement `for<'a> {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}: FnMut(&'a _)` | |
| 1 | //~ ERROR overflow evaluating the requirement `for<'a> {closure@$DIR/overflow-during-mono.rs:14:41: 14:44}: FnMut(&'a _)` | |
| 2 | 2 | //@ build-fail |
| 3 | //@ compile-flags: -Zwrite-long-types-to-disk=yes | |
| 3 | 4 | |
| 4 | 5 | #![recursion_limit = "32"] |
| 5 | 6 |
tests/ui/codegen/overflow-during-mono.stderr+6-4| ... | ... | @@ -1,10 +1,12 @@ |
| 1 | error[E0275]: overflow evaluating the requirement `for<'a> {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}: FnMut(&'a _)` | |
| 1 | error[E0275]: overflow evaluating the requirement `for<'a> {closure@$DIR/overflow-during-mono.rs:14:41: 14:44}: FnMut(&'a _)` | |
| 2 | 2 | | |
| 3 | 3 | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "64"]` attribute to your crate (`overflow_during_mono`) |
| 4 | = note: required for `Filter<std::array::IntoIter<i32, 11>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>` to implement `Iterator` | |
| 4 | = note: required for `Filter<IntoIter<i32, 11>, {closure@overflow-during-mono.rs:14:41}>` to implement `Iterator` | |
| 5 | 5 | = note: 31 redundant requirements hidden |
| 6 | = note: required for `Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<std::array::IntoIter<i32, 11>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>` to implement `Iterator` | |
| 7 | = note: required for `Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<Filter<std::array::IntoIter<i32, 11>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>, {closure@$DIR/overflow-during-mono.rs:13:41: 13:44}>` to implement `IntoIterator` | |
| 6 | = note: required for `Filter<Filter<Filter<Filter<Filter<..., ...>, ...>, ...>, ...>, ...>` to implement `Iterator` | |
| 7 | = note: required for `Filter<Filter<Filter<Filter<Filter<..., ...>, ...>, ...>, ...>, ...>` to implement `IntoIterator` | |
| 8 | = note: the full name for the type has been written to '$TEST_BUILD_DIR/overflow-during-mono.long-type-$LONG_TYPE_HASH.txt' | |
| 9 | = note: consider using `--verbose` to print the full type name to the console | |
| 8 | 10 | |
| 9 | 11 | error: aborting due to 1 previous error |
| 10 | 12 |
tests/ui/coherence/coherence-tuple-conflict.stderr+2| ... | ... | @@ -12,6 +12,8 @@ error[E0609]: no field `dummy` on type `&(A, B)` |
| 12 | 12 | | |
| 13 | 13 | LL | fn get(&self) -> usize { self.dummy } |
| 14 | 14 | | ^^^^^ unknown field |
| 15 | | | |
| 16 | = note: available fields are: `0`, `1` | |
| 15 | 17 | |
| 16 | 18 | error: aborting due to 2 previous errors |
| 17 | 19 |
tests/ui/confuse-field-and-method/issue-18343.stderr+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | error[E0599]: no method named `closure` found for struct `Obj` in the current scope | |
| 1 | error[E0599]: no method named `closure` found for struct `Obj<F>` in the current scope | |
| 2 | 2 | --> $DIR/issue-18343.rs:7:7 |
| 3 | 3 | | |
| 4 | 4 | LL | struct Obj<F> where F: FnMut() -> u32 { |
tests/ui/confuse-field-and-method/issue-2392.stderr+6-6| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | error[E0599]: no method named `closure` found for struct `Obj` in the current scope | |
| 1 | error[E0599]: no method named `closure` found for struct `Obj<F>` in the current scope | |
| 2 | 2 | --> $DIR/issue-2392.rs:36:15 |
| 3 | 3 | | |
| 4 | 4 | LL | struct Obj<F> where F: FnOnce() -> u32 { |
| ... | ... | @@ -12,7 +12,7 @@ help: to call the closure stored in `closure`, surround the field access with pa |
| 12 | 12 | LL | (o_closure.closure)(); |
| 13 | 13 | | + + |
| 14 | 14 | |
| 15 | error[E0599]: no method named `not_closure` found for struct `Obj` in the current scope | |
| 15 | error[E0599]: no method named `not_closure` found for struct `Obj<F>` in the current scope | |
| 16 | 16 | --> $DIR/issue-2392.rs:38:15 |
| 17 | 17 | | |
| 18 | 18 | LL | struct Obj<F> where F: FnOnce() -> u32 { |
| ... | ... | @@ -23,7 +23,7 @@ LL | o_closure.not_closure(); |
| 23 | 23 | | | |
| 24 | 24 | | field, not a method |
| 25 | 25 | |
| 26 | error[E0599]: no method named `closure` found for struct `Obj` in the current scope | |
| 26 | error[E0599]: no method named `closure` found for struct `Obj<F>` in the current scope | |
| 27 | 27 | --> $DIR/issue-2392.rs:42:12 |
| 28 | 28 | | |
| 29 | 29 | LL | struct Obj<F> where F: FnOnce() -> u32 { |
| ... | ... | @@ -65,7 +65,7 @@ help: to call the trait object stored in `boxed_closure`, surround the field acc |
| 65 | 65 | LL | (boxed_closure.boxed_closure)(); |
| 66 | 66 | | + + |
| 67 | 67 | |
| 68 | error[E0599]: no method named `closure` found for struct `Obj` in the current scope | |
| 68 | error[E0599]: no method named `closure` found for struct `Obj<F>` in the current scope | |
| 69 | 69 | --> $DIR/issue-2392.rs:53:12 |
| 70 | 70 | | |
| 71 | 71 | LL | struct Obj<F> where F: FnOnce() -> u32 { |
| ... | ... | @@ -79,7 +79,7 @@ help: to call the function stored in `closure`, surround the field access with p |
| 79 | 79 | LL | (w.wrap.closure)(); |
| 80 | 80 | | + + |
| 81 | 81 | |
| 82 | error[E0599]: no method named `not_closure` found for struct `Obj` in the current scope | |
| 82 | error[E0599]: no method named `not_closure` found for struct `Obj<F>` in the current scope | |
| 83 | 83 | --> $DIR/issue-2392.rs:55:12 |
| 84 | 84 | | |
| 85 | 85 | LL | struct Obj<F> where F: FnOnce() -> u32 { |
| ... | ... | @@ -90,7 +90,7 @@ LL | w.wrap.not_closure(); |
| 90 | 90 | | | |
| 91 | 91 | | field, not a method |
| 92 | 92 | |
| 93 | error[E0599]: no method named `closure` found for struct `Obj` in the current scope | |
| 93 | error[E0599]: no method named `closure` found for struct `Obj<F>` in the current scope | |
| 94 | 94 | --> $DIR/issue-2392.rs:58:24 |
| 95 | 95 | | |
| 96 | 96 | LL | struct Obj<F> where F: FnOnce() -> u32 { |
tests/ui/consts/issue-19244-1.stderr+2| ... | ... | @@ -3,6 +3,8 @@ error[E0609]: no field `1` on type `(usize,)` |
| 3 | 3 | | |
| 4 | 4 | LL | let a: [isize; TUP.1]; |
| 5 | 5 | | ^ unknown field |
| 6 | | | |
| 7 | = note: available field is: `0` | |
| 6 | 8 | |
| 7 | 9 | error: aborting due to 1 previous error |
| 8 | 10 |
tests/ui/custom_test_frameworks/mismatch.stderr+1-1| ... | ... | @@ -2,7 +2,7 @@ error[E0277]: the trait bound `TestDescAndFn: Testable` is not satisfied |
| 2 | 2 | --> $DIR/mismatch.rs:9:1 |
| 3 | 3 | | |
| 4 | 4 | LL | #[test] |
| 5 | | ------- in this procedural macro expansion | |
| 5 | | ------- in this attribute macro expansion | |
| 6 | 6 | LL | fn wrong_kind(){} |
| 7 | 7 | | ^^^^^^^^^^^^^^^^^ the trait `Testable` is not implemented for `TestDescAndFn` |
| 8 | 8 | | |
tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.stderr+1-1| ... | ... | @@ -43,7 +43,7 @@ help: consider introducing lifetime `'a` here |
| 43 | 43 | LL | impl<'a> Trait for Z { |
| 44 | 44 | | ++++ |
| 45 | 45 | |
| 46 | error[E0599]: no function or associated item named `new` found for struct `InvariantRef` in the current scope | |
| 46 | error[E0599]: no function or associated item named `new` found for struct `InvariantRef<'a, T>` in the current scope | |
| 47 | 47 | --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:9:41 |
| 48 | 48 | | |
| 49 | 49 | LL | pub struct InvariantRef<'a, T: ?Sized>(&'a T, PhantomData<&'a mut &'a T>); |
tests/ui/diagnostic-width/long-E0609.stderr+1| ... | ... | @@ -4,6 +4,7 @@ error[E0609]: no field `field` on type `(..., ..., ..., ...)` |
| 4 | 4 | LL | x.field; |
| 5 | 5 | | ^^^^^ unknown field |
| 6 | 6 | | |
| 7 | = note: available fields are: `0`, `1`, `2`, `3` | |
| 7 | 8 | = note: the full name for the type has been written to '$TEST_BUILD_DIR/long-E0609.long-type-$LONG_TYPE_HASH.txt' |
| 8 | 9 | = note: consider using `--verbose` to print the full type name to the console |
| 9 | 10 |
tests/ui/dropck/dropck_no_diverge_on_nonregular_1.rs+1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | // Issue 22443: Reject code using non-regular types that would |
| 2 | 2 | // otherwise cause dropck to loop infinitely. |
| 3 | //@ compile-flags: -Zwrite-long-types-to-disk=yes | |
| 3 | 4 | |
| 4 | 5 | use std::marker::PhantomData; |
| 5 | 6 |
tests/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr+4-2| ... | ... | @@ -1,10 +1,12 @@ |
| 1 | 1 | error[E0320]: overflow while adding drop-check rules for `FingerTree<i32>` |
| 2 | --> $DIR/dropck_no_diverge_on_nonregular_1.rs:24:9 | |
| 2 | --> $DIR/dropck_no_diverge_on_nonregular_1.rs:25:9 | |
| 3 | 3 | | |
| 4 | 4 | LL | let ft = |
| 5 | 5 | | ^^ |
| 6 | 6 | | |
| 7 | = note: overflowed on `FingerTree<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<i32>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` | |
| 7 | = note: overflowed on `FingerTree<Node<Node<Node<Node<Node<Node<Node<Node<Node<...>>>>>>>>>>` | |
| 8 | = note: the full name for the type has been written to '$TEST_BUILD_DIR/dropck_no_diverge_on_nonregular_1.long-type-$LONG_TYPE_HASH.txt' | |
| 9 | = note: consider using `--verbose` to print the full type name to the console | |
| 8 | 10 | |
| 9 | 11 | error: aborting due to 1 previous error |
| 10 | 12 |
tests/ui/editions/never-type-fallback-breaking.e2024.stderr+4-4| ... | ... | @@ -5,7 +5,7 @@ LL | true => Default::default(), |
| 5 | 5 | | ^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `!` |
| 6 | 6 | | |
| 7 | 7 | = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #48950 <https://github.com/rust-lang/rust/issues/48950> for more information) |
| 8 | = help: did you intend to use the type `()` here instead? | |
| 8 | = help: you might have intended to use the type `()` here instead | |
| 9 | 9 | |
| 10 | 10 | error[E0277]: the trait bound `!: Default` is not satisfied |
| 11 | 11 | --> $DIR/never-type-fallback-breaking.rs:37:5 |
| ... | ... | @@ -14,7 +14,7 @@ LL | deserialize()?; |
| 14 | 14 | | ^^^^^^^^^^^^^ the trait `Default` is not implemented for `!` |
| 15 | 15 | | |
| 16 | 16 | = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #48950 <https://github.com/rust-lang/rust/issues/48950> for more information) |
| 17 | = help: did you intend to use the type `()` here instead? | |
| 17 | = help: you might have intended to use the type `()` here instead | |
| 18 | 18 | note: required by a bound in `deserialize` |
| 19 | 19 | --> $DIR/never-type-fallback-breaking.rs:33:23 |
| 20 | 20 | | |
| ... | ... | @@ -51,7 +51,7 @@ LL | takes_apit(|| Default::default())?; |
| 51 | 51 | | ^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `!` |
| 52 | 52 | | |
| 53 | 53 | = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #48950 <https://github.com/rust-lang/rust/issues/48950> for more information) |
| 54 | = help: did you intend to use the type `()` here instead? | |
| 54 | = help: you might have intended to use the type `()` here instead | |
| 55 | 55 | |
| 56 | 56 | error[E0277]: the trait bound `!: Default` is not satisfied |
| 57 | 57 | --> $DIR/never-type-fallback-breaking.rs:76:17 |
| ... | ... | @@ -62,7 +62,7 @@ LL | takes_apit2(mk()?); |
| 62 | 62 | | required by a bound introduced by this call |
| 63 | 63 | | |
| 64 | 64 | = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #48950 <https://github.com/rust-lang/rust/issues/48950> for more information) |
| 65 | = help: did you intend to use the type `()` here instead? | |
| 65 | = help: you might have intended to use the type `()` here instead | |
| 66 | 66 | note: required by a bound in `takes_apit2` |
| 67 | 67 | --> $DIR/never-type-fallback-breaking.rs:71:25 |
| 68 | 68 | | |
tests/ui/error-codes/E0275.rs+1| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | //@ compile-flags: -Zwrite-long-types-to-disk=yes | |
| 1 | 2 | trait Foo {} |
| 2 | 3 | |
| 3 | 4 | struct Bar<T>(T); |
tests/ui/error-codes/E0275.stderr+5-3| ... | ... | @@ -1,17 +1,19 @@ |
| 1 | 1 | error[E0275]: overflow evaluating the requirement `Bar<Bar<Bar<Bar<Bar<Bar<Bar<...>>>>>>>: Foo` |
| 2 | --> $DIR/E0275.rs:5:33 | |
| 2 | --> $DIR/E0275.rs:6:33 | |
| 3 | 3 | | |
| 4 | 4 | LL | impl<T> Foo for T where Bar<T>: Foo {} |
| 5 | 5 | | ^^^ |
| 6 | 6 | | |
| 7 | 7 | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`E0275`) |
| 8 | note: required for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Foo` | |
| 9 | --> $DIR/E0275.rs:5:9 | |
| 8 | note: required for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<...>>>>>>>>>>>>>` to implement `Foo` | |
| 9 | --> $DIR/E0275.rs:6:9 | |
| 10 | 10 | | |
| 11 | 11 | LL | impl<T> Foo for T where Bar<T>: Foo {} |
| 12 | 12 | | ^^^ ^ --- unsatisfied trait bound introduced here |
| 13 | 13 | = note: 126 redundant requirements hidden |
| 14 | 14 | = note: required for `Bar<T>` to implement `Foo` |
| 15 | = note: the full name for the type has been written to '$TEST_BUILD_DIR/E0275.long-type-$LONG_TYPE_HASH.txt' | |
| 16 | = note: consider using `--verbose` to print the full type name to the console | |
| 15 | 17 | |
| 16 | 18 | error: aborting due to 1 previous error |
| 17 | 19 |
tests/ui/error-codes/ex-E0612.stderr+1-5| ... | ... | @@ -4,11 +4,7 @@ error[E0609]: no field `1` on type `Foo` |
| 4 | 4 | LL | y.1; |
| 5 | 5 | | ^ unknown field |
| 6 | 6 | | |
| 7 | help: a field with a similar name exists | |
| 8 | | | |
| 9 | LL - y.1; | |
| 10 | LL + y.0; | |
| 11 | | | |
| 7 | = note: available field is: `0` | |
| 12 | 8 | |
| 13 | 9 | error: aborting due to 1 previous error |
| 14 | 10 |
tests/ui/feature-gates/feature-gate-macro-attr.rs created+4| ... | ... | @@ -0,0 +1,4 @@ |
| 1 | #![crate_type = "lib"] | |
| 2 | ||
| 3 | macro_rules! myattr { attr() {} => {} } | |
| 4 | //~^ ERROR `macro_rules!` attributes are unstable |
tests/ui/feature-gates/feature-gate-macro-attr.stderr created+13| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | error[E0658]: `macro_rules!` attributes are unstable | |
| 2 | --> $DIR/feature-gate-macro-attr.rs:3:1 | |
| 3 | | | |
| 4 | LL | macro_rules! myattr { attr() {} => {} } | |
| 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 6 | | | |
| 7 | = note: see issue #83527 <https://github.com/rust-lang/rust/issues/83527> for more information | |
| 8 | = help: add `#![feature(macro_attr)]` to the crate attributes to enable | |
| 9 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | |
| 10 | ||
| 11 | error: aborting due to 1 previous error | |
| 12 | ||
| 13 | For more information about this error, try `rustc --explain E0658`. |
tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.rs+2| ... | ... | @@ -6,6 +6,8 @@ |
| 6 | 6 | // This tests double-checks that we do not allow such behavior to leak |
| 7 | 7 | // through again. |
| 8 | 8 | |
| 9 | //@ compile-flags: -Zwrite-long-types-to-disk=yes | |
| 10 | ||
| 9 | 11 | pub trait Stream { |
| 10 | 12 | type Item; |
| 11 | 13 | fn next(self) -> Option<Self::Item>; |
tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.stderr+9-7| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, {closure@$DIR/hrtb-doesnt-borrow-self-2.rs:109:30: 109:37}>`, but its trait bounds were not satisfied | |
| 2 | --> $DIR/hrtb-doesnt-borrow-self-2.rs:110:24 | |
| 1 | error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, fn(&u64) -> &u64 {identity::<u64>}>, {closure@...}>`, but its trait bounds were not satisfied | |
| 2 | --> $DIR/hrtb-doesnt-borrow-self-2.rs:112:24 | |
| 3 | 3 | | |
| 4 | 4 | LL | pub struct Filter<S, F> { |
| 5 | 5 | | ----------------------- method `countx` not found for this struct because it doesn't satisfy `_: StreamExt` |
| ... | ... | @@ -8,19 +8,21 @@ LL | let count = filter.countx(); |
| 8 | 8 | | ^^^^^^ method cannot be called due to unsatisfied trait bounds |
| 9 | 9 | | |
| 10 | 10 | note: the following trait bounds were not satisfied: |
| 11 | `&'a mut &Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, {closure@$DIR/hrtb-doesnt-borrow-self-2.rs:109:30: 109:37}>: Stream` | |
| 12 | `&'a mut &mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, {closure@$DIR/hrtb-doesnt-borrow-self-2.rs:109:30: 109:37}>: Stream` | |
| 13 | `&'a mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, {closure@$DIR/hrtb-doesnt-borrow-self-2.rs:109:30: 109:37}>: Stream` | |
| 14 | --> $DIR/hrtb-doesnt-borrow-self-2.rs:96:50 | |
| 11 | `&'a mut &Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, {closure@$DIR/hrtb-doesnt-borrow-self-2.rs:111:30: 111:37}>: Stream` | |
| 12 | `&'a mut &mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, {closure@$DIR/hrtb-doesnt-borrow-self-2.rs:111:30: 111:37}>: Stream` | |
| 13 | `&'a mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, {closure@$DIR/hrtb-doesnt-borrow-self-2.rs:111:30: 111:37}>: Stream` | |
| 14 | --> $DIR/hrtb-doesnt-borrow-self-2.rs:98:50 | |
| 15 | 15 | | |
| 16 | 16 | LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {} |
| 17 | 17 | | --------- - ^^^^^^ unsatisfied trait bound introduced here |
| 18 | 18 | = help: items from traits can only be used if the trait is implemented and in scope |
| 19 | 19 | note: `StreamExt` defines an item `countx`, perhaps you need to implement it |
| 20 | --> $DIR/hrtb-doesnt-borrow-self-2.rs:64:1 | |
| 20 | --> $DIR/hrtb-doesnt-borrow-self-2.rs:66:1 | |
| 21 | 21 | | |
| 22 | 22 | LL | pub trait StreamExt |
| 23 | 23 | | ^^^^^^^^^^^^^^^^^^^ |
| 24 | = note: the full name for the type has been written to '$TEST_BUILD_DIR/hrtb-doesnt-borrow-self-2.long-type-$LONG_TYPE_HASH.txt' | |
| 25 | = note: consider using `--verbose` to print the full type name to the console | |
| 24 | 26 | |
| 25 | 27 | error: aborting due to 1 previous error |
| 26 | 28 |
tests/ui/impl-trait/auto-trait-leakage/auto-trait-leak2.rs+1| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | //@ compile-flags: -Zwrite-long-types-to-disk=yes | |
| 1 | 2 | use std::cell::Cell; |
| 2 | 3 | use std::rc::Rc; |
| 3 | 4 |
tests/ui/impl-trait/auto-trait-leakage/auto-trait-leak2.stderr+8-8| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely |
| 2 | --> $DIR/auto-trait-leak2.rs:20:10 | |
| 2 | --> $DIR/auto-trait-leak2.rs:21:10 | |
| 3 | 3 | | |
| 4 | 4 | LL | fn before() -> impl Fn(i32) { |
| 5 | 5 | | ------------ within this `impl Fn(i32)` |
| ... | ... | @@ -11,23 +11,23 @@ LL | send(before()); |
| 11 | 11 | | |
| 12 | 12 | = help: within `impl Fn(i32)`, the trait `Send` is not implemented for `Rc<Cell<i32>>` |
| 13 | 13 | note: required because it's used within this closure |
| 14 | --> $DIR/auto-trait-leak2.rs:10:5 | |
| 14 | --> $DIR/auto-trait-leak2.rs:11:5 | |
| 15 | 15 | | |
| 16 | 16 | LL | move |x| p.set(x) |
| 17 | 17 | | ^^^^^^^^ |
| 18 | 18 | note: required because it appears within the type `impl Fn(i32)` |
| 19 | --> $DIR/auto-trait-leak2.rs:5:16 | |
| 19 | --> $DIR/auto-trait-leak2.rs:6:16 | |
| 20 | 20 | | |
| 21 | 21 | LL | fn before() -> impl Fn(i32) { |
| 22 | 22 | | ^^^^^^^^^^^^ |
| 23 | 23 | note: required by a bound in `send` |
| 24 | --> $DIR/auto-trait-leak2.rs:13:12 | |
| 24 | --> $DIR/auto-trait-leak2.rs:14:12 | |
| 25 | 25 | | |
| 26 | 26 | LL | fn send<T: Send>(_: T) {} |
| 27 | 27 | | ^^^^ required by this bound in `send` |
| 28 | 28 | |
| 29 | 29 | error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely |
| 30 | --> $DIR/auto-trait-leak2.rs:25:10 | |
| 30 | --> $DIR/auto-trait-leak2.rs:26:10 | |
| 31 | 31 | | |
| 32 | 32 | LL | send(after()); |
| 33 | 33 | | ---- ^^^^^^^ `Rc<Cell<i32>>` cannot be sent between threads safely |
| ... | ... | @@ -39,17 +39,17 @@ LL | fn after() -> impl Fn(i32) { |
| 39 | 39 | | |
| 40 | 40 | = help: within `impl Fn(i32)`, the trait `Send` is not implemented for `Rc<Cell<i32>>` |
| 41 | 41 | note: required because it's used within this closure |
| 42 | --> $DIR/auto-trait-leak2.rs:38:5 | |
| 42 | --> $DIR/auto-trait-leak2.rs:39:5 | |
| 43 | 43 | | |
| 44 | 44 | LL | move |x| p.set(x) |
| 45 | 45 | | ^^^^^^^^ |
| 46 | 46 | note: required because it appears within the type `impl Fn(i32)` |
| 47 | --> $DIR/auto-trait-leak2.rs:33:15 | |
| 47 | --> $DIR/auto-trait-leak2.rs:34:15 | |
| 48 | 48 | | |
| 49 | 49 | LL | fn after() -> impl Fn(i32) { |
| 50 | 50 | | ^^^^^^^^^^^^ |
| 51 | 51 | note: required by a bound in `send` |
| 52 | --> $DIR/auto-trait-leak2.rs:13:12 | |
| 52 | --> $DIR/auto-trait-leak2.rs:14:12 | |
| 53 | 53 | | |
| 54 | 54 | LL | fn send<T: Send>(_: T) {} |
| 55 | 55 | | ^^^^ required by this bound in `send` |
tests/ui/inference/really-long-type-in-let-binding-without-sufficient-type-info.rs+1| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | //@ compile-flags: -Zwrite-long-types-to-disk=yes | |
| 1 | 2 | type A = (i32, i32, i32, i32); |
| 2 | 3 | type B = (A, A, A, A); |
| 3 | 4 | type C = (B, B, B, B); |
tests/ui/inference/really-long-type-in-let-binding-without-sufficient-type-info.stderr+4-2| ... | ... | @@ -1,9 +1,11 @@ |
| 1 | error[E0282]: type annotations needed for `Result<_, ((((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32))), (((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32))), (((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32))), (((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32))))>` | |
| 2 | --> $DIR/really-long-type-in-let-binding-without-sufficient-type-info.rs:7:9 | |
| 1 | error[E0282]: type annotations needed for `Result<_, (((..., ..., ..., ...), ..., ..., ...), ..., ..., ...)>` | |
| 2 | --> $DIR/really-long-type-in-let-binding-without-sufficient-type-info.rs:8:9 | |
| 3 | 3 | | |
| 4 | 4 | LL | let y = Err(x); |
| 5 | 5 | | ^ ------ type must be known at this point |
| 6 | 6 | | |
| 7 | = note: the full name for the type has been written to '$TEST_BUILD_DIR/really-long-type-in-let-binding-without-sufficient-type-info.long-type-$LONG_TYPE_HASH.txt' | |
| 8 | = note: consider using `--verbose` to print the full type name to the console | |
| 7 | 9 | help: consider giving `y` an explicit type, where the type for type parameter `T` is specified |
| 8 | 10 | | |
| 9 | 11 | LL | let y: Result<T, _> = Err(x); |
tests/ui/interior-mutability/interior-mutability.rs+1| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | //@ compile-flags: -Zwrite-long-types-to-disk=yes | |
| 1 | 2 | use std::cell::Cell; |
| 2 | 3 | use std::panic::catch_unwind; |
| 3 | 4 | fn main() { |
tests/ui/interior-mutability/interior-mutability.stderr+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary |
| 2 | --> $DIR/interior-mutability.rs:5:18 | |
| 2 | --> $DIR/interior-mutability.rs:6:18 | |
| 3 | 3 | | |
| 4 | 4 | LL | catch_unwind(|| { x.set(23); }); |
| 5 | 5 | | ------------ ^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary |
| ... | ... | @@ -11,7 +11,7 @@ note: required because it appears within the type `Cell<i32>` |
| 11 | 11 | --> $SRC_DIR/core/src/cell.rs:LL:COL |
| 12 | 12 | = note: required for `&Cell<i32>` to implement `UnwindSafe` |
| 13 | 13 | note: required because it's used within this closure |
| 14 | --> $DIR/interior-mutability.rs:5:18 | |
| 14 | --> $DIR/interior-mutability.rs:6:18 | |
| 15 | 15 | | |
| 16 | 16 | LL | catch_unwind(|| { x.set(23); }); |
| 17 | 17 | | ^^ |
tests/ui/intrinsics/intrinsic-atomics.rs+6-6| ... | ... | @@ -33,14 +33,14 @@ pub fn main() { |
| 33 | 33 | assert_eq!(rusti::atomic_xchg::<_, { Release }>(&mut *x, 0), 1); |
| 34 | 34 | assert_eq!(*x, 0); |
| 35 | 35 | |
| 36 | assert_eq!(rusti::atomic_xadd::<_, { SeqCst }>(&mut *x, 1), 0); | |
| 37 | assert_eq!(rusti::atomic_xadd::<_, { Acquire }>(&mut *x, 1), 1); | |
| 38 | assert_eq!(rusti::atomic_xadd::<_, { Release }>(&mut *x, 1), 2); | |
| 36 | assert_eq!(rusti::atomic_xadd::<_, _, { SeqCst }>(&mut *x, 1), 0); | |
| 37 | assert_eq!(rusti::atomic_xadd::<_, _, { Acquire }>(&mut *x, 1), 1); | |
| 38 | assert_eq!(rusti::atomic_xadd::<_, _, { Release }>(&mut *x, 1), 2); | |
| 39 | 39 | assert_eq!(*x, 3); |
| 40 | 40 | |
| 41 | assert_eq!(rusti::atomic_xsub::<_, { SeqCst }>(&mut *x, 1), 3); | |
| 42 | assert_eq!(rusti::atomic_xsub::<_, { Acquire }>(&mut *x, 1), 2); | |
| 43 | assert_eq!(rusti::atomic_xsub::<_, { Release }>(&mut *x, 1), 1); | |
| 41 | assert_eq!(rusti::atomic_xsub::<_, _, { SeqCst }>(&mut *x, 1), 3); | |
| 42 | assert_eq!(rusti::atomic_xsub::<_, _, { Acquire }>(&mut *x, 1), 2); | |
| 43 | assert_eq!(rusti::atomic_xsub::<_, _, { Release }>(&mut *x, 1), 1); | |
| 44 | 44 | assert_eq!(*x, 0); |
| 45 | 45 | |
| 46 | 46 | loop { |
tests/ui/intrinsics/non-integer-atomic.rs+16-16| ... | ... | @@ -13,80 +13,80 @@ pub type Quux = [u8; 100]; |
| 13 | 13 | |
| 14 | 14 | pub unsafe fn test_bool_load(p: &mut bool, v: bool) { |
| 15 | 15 | intrinsics::atomic_load::<_, { SeqCst }>(p); |
| 16 | //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `bool` | |
| 16 | //~^ ERROR `atomic_load` intrinsic: expected basic integer or pointer type, found `bool` | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | pub unsafe fn test_bool_store(p: &mut bool, v: bool) { |
| 20 | 20 | intrinsics::atomic_store::<_, { SeqCst }>(p, v); |
| 21 | //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `bool` | |
| 21 | //~^ ERROR `atomic_store` intrinsic: expected basic integer or pointer type, found `bool` | |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | pub unsafe fn test_bool_xchg(p: &mut bool, v: bool) { |
| 25 | 25 | intrinsics::atomic_xchg::<_, { SeqCst }>(p, v); |
| 26 | //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `bool` | |
| 26 | //~^ ERROR `atomic_xchg` intrinsic: expected basic integer or pointer type, found `bool` | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | pub unsafe fn test_bool_cxchg(p: &mut bool, v: bool) { |
| 30 | 30 | intrinsics::atomic_cxchg::<_, { SeqCst }, { SeqCst }>(p, v, v); |
| 31 | //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `bool` | |
| 31 | //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer or pointer type, found `bool` | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | pub unsafe fn test_Foo_load(p: &mut Foo, v: Foo) { |
| 35 | 35 | intrinsics::atomic_load::<_, { SeqCst }>(p); |
| 36 | //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `Foo` | |
| 36 | //~^ ERROR `atomic_load` intrinsic: expected basic integer or pointer type, found `Foo` | |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | pub unsafe fn test_Foo_store(p: &mut Foo, v: Foo) { |
| 40 | 40 | intrinsics::atomic_store::<_, { SeqCst }>(p, v); |
| 41 | //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `Foo` | |
| 41 | //~^ ERROR `atomic_store` intrinsic: expected basic integer or pointer type, found `Foo` | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | pub unsafe fn test_Foo_xchg(p: &mut Foo, v: Foo) { |
| 45 | 45 | intrinsics::atomic_xchg::<_, { SeqCst }>(p, v); |
| 46 | //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `Foo` | |
| 46 | //~^ ERROR `atomic_xchg` intrinsic: expected basic integer or pointer type, found `Foo` | |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | pub unsafe fn test_Foo_cxchg(p: &mut Foo, v: Foo) { |
| 50 | 50 | intrinsics::atomic_cxchg::<_, { SeqCst }, { SeqCst }>(p, v, v); |
| 51 | //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `Foo` | |
| 51 | //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer or pointer type, found `Foo` | |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | pub unsafe fn test_Bar_load(p: &mut Bar, v: Bar) { |
| 55 | 55 | intrinsics::atomic_load::<_, { SeqCst }>(p); |
| 56 | //~^ ERROR expected basic integer type, found `&dyn Fn()` | |
| 56 | //~^ ERROR expected basic integer or pointer type, found `&dyn Fn()` | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | pub unsafe fn test_Bar_store(p: &mut Bar, v: Bar) { |
| 60 | 60 | intrinsics::atomic_store::<_, { SeqCst }>(p, v); |
| 61 | //~^ ERROR expected basic integer type, found `&dyn Fn()` | |
| 61 | //~^ ERROR expected basic integer or pointer type, found `&dyn Fn()` | |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | pub unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) { |
| 65 | 65 | intrinsics::atomic_xchg::<_, { SeqCst }>(p, v); |
| 66 | //~^ ERROR expected basic integer type, found `&dyn Fn()` | |
| 66 | //~^ ERROR expected basic integer or pointer type, found `&dyn Fn()` | |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | pub unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) { |
| 70 | 70 | intrinsics::atomic_cxchg::<_, { SeqCst }, { SeqCst }>(p, v, v); |
| 71 | //~^ ERROR expected basic integer type, found `&dyn Fn()` | |
| 71 | //~^ ERROR expected basic integer or pointer type, found `&dyn Fn()` | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | pub unsafe fn test_Quux_load(p: &mut Quux, v: Quux) { |
| 75 | 75 | intrinsics::atomic_load::<_, { SeqCst }>(p); |
| 76 | //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `[u8; 100]` | |
| 76 | //~^ ERROR `atomic_load` intrinsic: expected basic integer or pointer type, found `[u8; 100]` | |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | pub unsafe fn test_Quux_store(p: &mut Quux, v: Quux) { |
| 80 | 80 | intrinsics::atomic_store::<_, { SeqCst }>(p, v); |
| 81 | //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `[u8; 100]` | |
| 81 | //~^ ERROR `atomic_store` intrinsic: expected basic integer or pointer type, found `[u8; 100]` | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | pub unsafe fn test_Quux_xchg(p: &mut Quux, v: Quux) { |
| 85 | 85 | intrinsics::atomic_xchg::<_, { SeqCst }>(p, v); |
| 86 | //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `[u8; 100]` | |
| 86 | //~^ ERROR `atomic_xchg` intrinsic: expected basic integer or pointer type, found `[u8; 100]` | |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | pub unsafe fn test_Quux_cxchg(p: &mut Quux, v: Quux) { |
| 90 | 90 | intrinsics::atomic_cxchg::<_, { SeqCst }, { SeqCst }>(p, v, v); |
| 91 | //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `[u8; 100]` | |
| 91 | //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer or pointer type, found `[u8; 100]` | |
| 92 | 92 | } |
tests/ui/intrinsics/non-integer-atomic.stderr+16-16| ... | ... | @@ -1,94 +1,94 @@ |
| 1 | error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `bool` | |
| 1 | error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer or pointer type, found `bool` | |
| 2 | 2 | --> $DIR/non-integer-atomic.rs:15:5 |
| 3 | 3 | | |
| 4 | 4 | LL | intrinsics::atomic_load::<_, { SeqCst }>(p); |
| 5 | 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 6 | 6 | |
| 7 | error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `bool` | |
| 7 | error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer or pointer type, found `bool` | |
| 8 | 8 | --> $DIR/non-integer-atomic.rs:20:5 |
| 9 | 9 | | |
| 10 | 10 | LL | intrinsics::atomic_store::<_, { SeqCst }>(p, v); |
| 11 | 11 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 12 | 12 | |
| 13 | error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `bool` | |
| 13 | error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer or pointer type, found `bool` | |
| 14 | 14 | --> $DIR/non-integer-atomic.rs:25:5 |
| 15 | 15 | | |
| 16 | 16 | LL | intrinsics::atomic_xchg::<_, { SeqCst }>(p, v); |
| 17 | 17 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 18 | 18 | |
| 19 | error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `bool` | |
| 19 | error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer or pointer type, found `bool` | |
| 20 | 20 | --> $DIR/non-integer-atomic.rs:30:5 |
| 21 | 21 | | |
| 22 | 22 | LL | intrinsics::atomic_cxchg::<_, { SeqCst }, { SeqCst }>(p, v, v); |
| 23 | 23 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 24 | 24 | |
| 25 | error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `Foo` | |
| 25 | error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer or pointer type, found `Foo` | |
| 26 | 26 | --> $DIR/non-integer-atomic.rs:35:5 |
| 27 | 27 | | |
| 28 | 28 | LL | intrinsics::atomic_load::<_, { SeqCst }>(p); |
| 29 | 29 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 30 | 30 | |
| 31 | error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `Foo` | |
| 31 | error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer or pointer type, found `Foo` | |
| 32 | 32 | --> $DIR/non-integer-atomic.rs:40:5 |
| 33 | 33 | | |
| 34 | 34 | LL | intrinsics::atomic_store::<_, { SeqCst }>(p, v); |
| 35 | 35 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 36 | 36 | |
| 37 | error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `Foo` | |
| 37 | error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer or pointer type, found `Foo` | |
| 38 | 38 | --> $DIR/non-integer-atomic.rs:45:5 |
| 39 | 39 | | |
| 40 | 40 | LL | intrinsics::atomic_xchg::<_, { SeqCst }>(p, v); |
| 41 | 41 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 42 | 42 | |
| 43 | error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `Foo` | |
| 43 | error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer or pointer type, found `Foo` | |
| 44 | 44 | --> $DIR/non-integer-atomic.rs:50:5 |
| 45 | 45 | | |
| 46 | 46 | LL | intrinsics::atomic_cxchg::<_, { SeqCst }, { SeqCst }>(p, v, v); |
| 47 | 47 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 48 | 48 | |
| 49 | error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `&dyn Fn()` | |
| 49 | error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer or pointer type, found `&dyn Fn()` | |
| 50 | 50 | --> $DIR/non-integer-atomic.rs:55:5 |
| 51 | 51 | | |
| 52 | 52 | LL | intrinsics::atomic_load::<_, { SeqCst }>(p); |
| 53 | 53 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 54 | 54 | |
| 55 | error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `&dyn Fn()` | |
| 55 | error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer or pointer type, found `&dyn Fn()` | |
| 56 | 56 | --> $DIR/non-integer-atomic.rs:60:5 |
| 57 | 57 | | |
| 58 | 58 | LL | intrinsics::atomic_store::<_, { SeqCst }>(p, v); |
| 59 | 59 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 60 | 60 | |
| 61 | error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `&dyn Fn()` | |
| 61 | error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer or pointer type, found `&dyn Fn()` | |
| 62 | 62 | --> $DIR/non-integer-atomic.rs:65:5 |
| 63 | 63 | | |
| 64 | 64 | LL | intrinsics::atomic_xchg::<_, { SeqCst }>(p, v); |
| 65 | 65 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 66 | 66 | |
| 67 | error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `&dyn Fn()` | |
| 67 | error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer or pointer type, found `&dyn Fn()` | |
| 68 | 68 | --> $DIR/non-integer-atomic.rs:70:5 |
| 69 | 69 | | |
| 70 | 70 | LL | intrinsics::atomic_cxchg::<_, { SeqCst }, { SeqCst }>(p, v, v); |
| 71 | 71 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 72 | 72 | |
| 73 | error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `[u8; 100]` | |
| 73 | error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer or pointer type, found `[u8; 100]` | |
| 74 | 74 | --> $DIR/non-integer-atomic.rs:75:5 |
| 75 | 75 | | |
| 76 | 76 | LL | intrinsics::atomic_load::<_, { SeqCst }>(p); |
| 77 | 77 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 78 | 78 | |
| 79 | error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `[u8; 100]` | |
| 79 | error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer or pointer type, found `[u8; 100]` | |
| 80 | 80 | --> $DIR/non-integer-atomic.rs:80:5 |
| 81 | 81 | | |
| 82 | 82 | LL | intrinsics::atomic_store::<_, { SeqCst }>(p, v); |
| 83 | 83 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 84 | 84 | |
| 85 | error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `[u8; 100]` | |
| 85 | error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer or pointer type, found `[u8; 100]` | |
| 86 | 86 | --> $DIR/non-integer-atomic.rs:85:5 |
| 87 | 87 | | |
| 88 | 88 | LL | intrinsics::atomic_xchg::<_, { SeqCst }>(p, v); |
| 89 | 89 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 90 | 90 | |
| 91 | error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `[u8; 100]` | |
| 91 | error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer or pointer type, found `[u8; 100]` | |
| 92 | 92 | --> $DIR/non-integer-atomic.rs:90:5 |
| 93 | 93 | | |
| 94 | 94 | LL | intrinsics::atomic_cxchg::<_, { SeqCst }, { SeqCst }>(p, v, v); |
tests/ui/issues/issue-41880.stderr+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | error[E0599]: no method named `iter` found for struct `Iterate` in the current scope | |
| 1 | error[E0599]: no method named `iter` found for struct `Iterate<T, F>` in the current scope | |
| 2 | 2 | --> $DIR/issue-41880.rs:27:24 |
| 3 | 3 | | |
| 4 | 4 | LL | pub struct Iterate<T, F> { |
tests/ui/macros/macro-rules-as-derive-or-attr-issue-132928.stderr+1-1| ... | ... | @@ -11,7 +11,7 @@ error: cannot find attribute `sample` in this scope |
| 11 | 11 | --> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:5:3 |
| 12 | 12 | | |
| 13 | 13 | LL | macro_rules! sample { () => {} } |
| 14 | | ------ `sample` exists, but a declarative macro cannot be used as an attribute macro | |
| 14 | | ------ `sample` exists, but has no `attr` rules | |
| 15 | 15 | LL | |
| 16 | 16 | LL | #[sample] |
| 17 | 17 | | ^^^^^^ |
tests/ui/macros/macro-rules-attr-error.rs created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | #![feature(macro_attr)] | |
| 2 | ||
| 3 | macro_rules! local_attr { | |
| 4 | attr() { $($body:tt)* } => { | |
| 5 | compile_error!(concat!("local_attr: ", stringify!($($body)*))); | |
| 6 | }; | |
| 7 | //~^^ ERROR: local_attr | |
| 8 | } | |
| 9 | ||
| 10 | fn main() { | |
| 11 | #[local_attr] | |
| 12 | struct S; | |
| 13 | ||
| 14 | local_attr!(arg); //~ ERROR: macro has no rules for function-like invocation | |
| 15 | } |
tests/ui/macros/macro-rules-attr-error.stderr created+22| ... | ... | @@ -0,0 +1,22 @@ |
| 1 | error: local_attr: struct S; | |
| 2 | --> $DIR/macro-rules-attr-error.rs:5:9 | |
| 3 | | | |
| 4 | LL | compile_error!(concat!("local_attr: ", stringify!($($body)*))); | |
| 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 6 | ... | |
| 7 | LL | #[local_attr] | |
| 8 | | ------------- in this attribute macro expansion | |
| 9 | | | |
| 10 | = note: this error originates in the attribute macro `local_attr` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 11 | ||
| 12 | error: macro has no rules for function-like invocation `local_attr!` | |
| 13 | --> $DIR/macro-rules-attr-error.rs:14:5 | |
| 14 | | | |
| 15 | LL | macro_rules! local_attr { | |
| 16 | | ----------------------- this macro has no rules for function-like invocation | |
| 17 | ... | |
| 18 | LL | local_attr!(arg); | |
| 19 | | ^^^^^^^^^^^^^^^^ | |
| 20 | ||
| 21 | error: aborting due to 2 previous errors | |
| 22 |
tests/ui/macros/macro-rules-attr-infinite-recursion.rs created+12| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | #![crate_type = "lib"] | |
| 2 | #![feature(macro_attr)] | |
| 3 | ||
| 4 | macro_rules! attr { | |
| 5 | attr() { $($body:tt)* } => { | |
| 6 | #[attr] $($body)* | |
| 7 | }; | |
| 8 | //~^^ ERROR: recursion limit reached | |
| 9 | } | |
| 10 | ||
| 11 | #[attr] | |
| 12 | struct S; |
tests/ui/macros/macro-rules-attr-infinite-recursion.stderr created+14| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | error: recursion limit reached while expanding `#[attr]` | |
| 2 | --> $DIR/macro-rules-attr-infinite-recursion.rs:6:9 | |
| 3 | | | |
| 4 | LL | #[attr] $($body)* | |
| 5 | | ^^^^^^^ | |
| 6 | ... | |
| 7 | LL | #[attr] | |
| 8 | | ------- in this attribute macro expansion | |
| 9 | | | |
| 10 | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`macro_rules_attr_infinite_recursion`) | |
| 11 | = note: this error originates in the attribute macro `attr` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 12 | ||
| 13 | error: aborting due to 1 previous error | |
| 14 |
tests/ui/macros/macro-rules-attr-nested.rs created+24| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | //@ run-pass | |
| 2 | //@ check-run-results | |
| 3 | #![feature(macro_attr)] | |
| 4 | ||
| 5 | macro_rules! nest { | |
| 6 | attr() { struct $name:ident; } => { | |
| 7 | println!("nest"); | |
| 8 | #[nest(1)] | |
| 9 | struct $name; | |
| 10 | }; | |
| 11 | attr(1) { struct $name:ident; } => { | |
| 12 | println!("nest(1)"); | |
| 13 | #[nest(2)] | |
| 14 | struct $name; | |
| 15 | }; | |
| 16 | attr(2) { struct $name:ident; } => { | |
| 17 | println!("nest(2)"); | |
| 18 | }; | |
| 19 | } | |
| 20 | ||
| 21 | fn main() { | |
| 22 | #[nest] | |
| 23 | struct S; | |
| 24 | } |
tests/ui/macros/macro-rules-attr-nested.run.stdout created+3| ... | ... | @@ -0,0 +1,3 @@ |
| 1 | nest | |
| 2 | nest(1) | |
| 3 | nest(2) |
tests/ui/macros/macro-rules-attr.rs created+90| ... | ... | @@ -0,0 +1,90 @@ |
| 1 | //@ run-pass | |
| 2 | //@ check-run-results | |
| 3 | #![feature(macro_attr)] | |
| 4 | #![warn(unused)] | |
| 5 | ||
| 6 | #[macro_export] | |
| 7 | macro_rules! exported_attr { | |
| 8 | attr($($args:tt)*) { $($body:tt)* } => { | |
| 9 | println!( | |
| 10 | "exported_attr: args={:?}, body={:?}", | |
| 11 | stringify!($($args)*), | |
| 12 | stringify!($($body)*), | |
| 13 | ); | |
| 14 | }; | |
| 15 | { $($args:tt)* } => { | |
| 16 | println!("exported_attr!({:?})", stringify!($($args)*)); | |
| 17 | }; | |
| 18 | attr() {} => { | |
| 19 | unused_rule(); | |
| 20 | }; | |
| 21 | attr() {} => { | |
| 22 | compile_error!(); | |
| 23 | }; | |
| 24 | {} => { | |
| 25 | unused_rule(); | |
| 26 | }; | |
| 27 | {} => { | |
| 28 | compile_error!(); | |
| 29 | }; | |
| 30 | } | |
| 31 | ||
| 32 | macro_rules! local_attr { | |
| 33 | attr($($args:tt)*) { $($body:tt)* } => { | |
| 34 | println!( | |
| 35 | "local_attr: args={:?}, body={:?}", | |
| 36 | stringify!($($args)*), | |
| 37 | stringify!($($body)*), | |
| 38 | ); | |
| 39 | }; | |
| 40 | { $($args:tt)* } => { | |
| 41 | println!("local_attr!({:?})", stringify!($($args)*)); | |
| 42 | }; | |
| 43 | attr() {} => { //~ WARN: never used | |
| 44 | unused_rule(); | |
| 45 | }; | |
| 46 | attr() {} => { | |
| 47 | compile_error!(); | |
| 48 | }; | |
| 49 | {} => { //~ WARN: never used | |
| 50 | unused_rule(); | |
| 51 | }; | |
| 52 | {} => { | |
| 53 | compile_error!(); | |
| 54 | }; | |
| 55 | } | |
| 56 | ||
| 57 | fn main() { | |
| 58 | #[crate::exported_attr] | |
| 59 | struct S; | |
| 60 | #[::exported_attr(arguments, key = "value")] | |
| 61 | fn func(_arg: u32) {} | |
| 62 | #[self::exported_attr(1)] | |
| 63 | #[self::exported_attr(2)] | |
| 64 | struct Twice; | |
| 65 | ||
| 66 | crate::exported_attr!(); | |
| 67 | crate::exported_attr!(invoked, arguments); | |
| 68 | ||
| 69 | #[exported_attr] | |
| 70 | struct S; | |
| 71 | #[exported_attr(arguments, key = "value")] | |
| 72 | fn func(_arg: u32) {} | |
| 73 | #[exported_attr(1)] | |
| 74 | #[exported_attr(2)] | |
| 75 | struct Twice; | |
| 76 | ||
| 77 | exported_attr!(); | |
| 78 | exported_attr!(invoked, arguments); | |
| 79 | ||
| 80 | #[local_attr] | |
| 81 | struct S; | |
| 82 | #[local_attr(arguments, key = "value")] | |
| 83 | fn func(_arg: u32) {} | |
| 84 | #[local_attr(1)] | |
| 85 | #[local_attr(2)] | |
| 86 | struct Twice; | |
| 87 | ||
| 88 | local_attr!(); | |
| 89 | local_attr!(invoked, arguments); | |
| 90 | } |
tests/ui/macros/macro-rules-attr.run.stdout created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | exported_attr: args="", body="struct S;" | |
| 2 | exported_attr: args="arguments, key = \"value\"", body="fn func(_arg: u32) {}" | |
| 3 | exported_attr: args="1", body="#[self::exported_attr(2)] struct Twice;" | |
| 4 | exported_attr!("") | |
| 5 | exported_attr!("invoked, arguments") | |
| 6 | exported_attr: args="", body="struct S;" | |
| 7 | exported_attr: args="arguments, key = \"value\"", body="fn func(_arg: u32) {}" | |
| 8 | exported_attr: args="1", body="#[exported_attr(2)] struct Twice;" | |
| 9 | exported_attr!("") | |
| 10 | exported_attr!("invoked, arguments") | |
| 11 | local_attr: args="", body="struct S;" | |
| 12 | local_attr: args="arguments, key = \"value\"", body="fn func(_arg: u32) {}" | |
| 13 | local_attr: args="1", body="#[local_attr(2)] struct Twice;" | |
| 14 | local_attr!("") | |
| 15 | local_attr!("invoked, arguments") |
tests/ui/macros/macro-rules-attr.stderr created+21| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | warning: rule #3 of macro `local_attr` is never used | |
| 2 | --> $DIR/macro-rules-attr.rs:43:9 | |
| 3 | | | |
| 4 | LL | attr() {} => { | |
| 5 | | ^^ ^^ | |
| 6 | | | |
| 7 | note: the lint level is defined here | |
| 8 | --> $DIR/macro-rules-attr.rs:4:9 | |
| 9 | | | |
| 10 | LL | #![warn(unused)] | |
| 11 | | ^^^^^^ | |
| 12 | = note: `#[warn(unused_macro_rules)]` implied by `#[warn(unused)]` | |
| 13 | ||
| 14 | warning: rule #5 of macro `local_attr` is never used | |
| 15 | --> $DIR/macro-rules-attr.rs:49:5 | |
| 16 | | | |
| 17 | LL | {} => { | |
| 18 | | ^^ | |
| 19 | ||
| 20 | warning: 2 warnings emitted | |
| 21 |
tests/ui/methods/call_method_unknown_referent.rs+1-1| ... | ... | @@ -44,5 +44,5 @@ fn main() { |
| 44 | 44 | // our resolution logic needs to be able to call methods such as foo() |
| 45 | 45 | // on the outer type even if the inner type is ambiguous. |
| 46 | 46 | let _c = (ptr as SmartPtr<_>).read(); |
| 47 | //~^ ERROR no method named `read` found for struct `SmartPtr` | |
| 47 | //~^ ERROR no method named `read` found for struct `SmartPtr<T>` | |
| 48 | 48 | } |
tests/ui/methods/call_method_unknown_referent.stderr+1-1| ... | ... | @@ -10,7 +10,7 @@ error[E0282]: type annotations needed |
| 10 | 10 | LL | let _b = (rc as std::rc::Rc<_>).read(); |
| 11 | 11 | | ^^^^ cannot infer type |
| 12 | 12 | |
| 13 | error[E0599]: no method named `read` found for struct `SmartPtr` in the current scope | |
| 13 | error[E0599]: no method named `read` found for struct `SmartPtr<T>` in the current scope | |
| 14 | 14 | --> $DIR/call_method_unknown_referent.rs:46:35 |
| 15 | 15 | | |
| 16 | 16 | LL | struct SmartPtr<T>(T); |
tests/ui/methods/inherent-bound-in-probe.rs+1| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | //@ compile-flags: -Zwrite-long-types-to-disk=yes | |
| 1 | 2 | // Fixes #110131 |
| 2 | 3 | // |
| 3 | 4 | // The issue is that we were constructing an `ImplDerived` cause code for the |
tests/ui/methods/inherent-bound-in-probe.stderr+7-5| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error[E0277]: `Helper<'a, T>` is not an iterator |
| 2 | --> $DIR/inherent-bound-in-probe.rs:38:21 | |
| 2 | --> $DIR/inherent-bound-in-probe.rs:39:21 | |
| 3 | 3 | | |
| 4 | 4 | LL | type IntoIter = Helper<'a, T>; |
| 5 | 5 | | ^^^^^^^^^^^^^ `Helper<'a, T>` is not an iterator |
| ... | ... | @@ -9,14 +9,14 @@ note: required by a bound in `std::iter::IntoIterator::IntoIter` |
| 9 | 9 | --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL |
| 10 | 10 | |
| 11 | 11 | error[E0275]: overflow evaluating the requirement `&_: IntoIterator` |
| 12 | --> $DIR/inherent-bound-in-probe.rs:42:9 | |
| 12 | --> $DIR/inherent-bound-in-probe.rs:43:9 | |
| 13 | 13 | | |
| 14 | 14 | LL | Helper::new(&self.0) |
| 15 | 15 | | ^^^^^^ |
| 16 | 16 | | |
| 17 | 17 | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_bound_in_probe`) |
| 18 | 18 | note: required for `&BitReaderWrapper<_>` to implement `IntoIterator` |
| 19 | --> $DIR/inherent-bound-in-probe.rs:32:13 | |
| 19 | --> $DIR/inherent-bound-in-probe.rs:33:13 | |
| 20 | 20 | | |
| 21 | 21 | LL | impl<'a, T> IntoIterator for &'a BitReaderWrapper<T> |
| 22 | 22 | | ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -24,15 +24,17 @@ LL | where |
| 24 | 24 | LL | &'a T: IntoIterator<Item = &'a u8>, |
| 25 | 25 | | ------------- unsatisfied trait bound introduced here |
| 26 | 26 | = note: 126 redundant requirements hidden |
| 27 | = note: required for `&BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<_>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `IntoIterator` | |
| 27 | = note: required for `&BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<...>>>` to implement `IntoIterator` | |
| 28 | 28 | note: required by a bound in `Helper` |
| 29 | --> $DIR/inherent-bound-in-probe.rs:16:12 | |
| 29 | --> $DIR/inherent-bound-in-probe.rs:17:12 | |
| 30 | 30 | | |
| 31 | 31 | LL | struct Helper<'a, T> |
| 32 | 32 | | ------ required by a bound in this struct |
| 33 | 33 | LL | where |
| 34 | 34 | LL | &'a T: IntoIterator<Item = &'a u8>, |
| 35 | 35 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Helper` |
| 36 | = note: the full name for the type has been written to '$TEST_BUILD_DIR/inherent-bound-in-probe.long-type-$LONG_TYPE_HASH.txt' | |
| 37 | = note: consider using `--verbose` to print the full type name to the console | |
| 36 | 38 | |
| 37 | 39 | error: aborting due to 2 previous errors |
| 38 | 40 |
tests/ui/methods/method-not-found-generic-arg-elision.stderr+4-4| ... | ... | @@ -10,7 +10,7 @@ LL | let d = point_i32.distance(); |
| 10 | 10 | = note: the method was found for |
| 11 | 11 | - `Point<f64>` |
| 12 | 12 | |
| 13 | error[E0599]: no method named `other` found for struct `Point` in the current scope | |
| 13 | error[E0599]: no method named `other` found for struct `Point<T>` in the current scope | |
| 14 | 14 | --> $DIR/method-not-found-generic-arg-elision.rs:84:23 |
| 15 | 15 | | |
| 16 | 16 | LL | struct Point<T> { |
| ... | ... | @@ -19,7 +19,7 @@ LL | struct Point<T> { |
| 19 | 19 | LL | let d = point_i32.other(); |
| 20 | 20 | | ^^^^^ method not found in `Point<i32>` |
| 21 | 21 | |
| 22 | error[E0599]: no method named `extend` found for struct `Map` in the current scope | |
| 22 | error[E0599]: no method named `extend` found for struct `Map<I, F>` in the current scope | |
| 23 | 23 | --> $DIR/method-not-found-generic-arg-elision.rs:87:67 |
| 24 | 24 | | |
| 25 | 25 | LL | v.iter().map(Box::new(|x| x * x) as Box<dyn Fn(&i32) -> i32>).extend(std::iter::once(100)); |
| ... | ... | @@ -41,7 +41,7 @@ LL | wrapper.method(); |
| 41 | 41 | - `Wrapper<i8>` |
| 42 | 42 | and 2 more types |
| 43 | 43 | |
| 44 | error[E0599]: no method named `other` found for struct `Wrapper` in the current scope | |
| 44 | error[E0599]: no method named `other` found for struct `Wrapper<T>` in the current scope | |
| 45 | 45 | --> $DIR/method-not-found-generic-arg-elision.rs:92:13 |
| 46 | 46 | | |
| 47 | 47 | LL | struct Wrapper<T>(T); |
| ... | ... | @@ -64,7 +64,7 @@ LL | wrapper.method(); |
| 64 | 64 | - `Wrapper2<'a, i32, C>` |
| 65 | 65 | - `Wrapper2<'a, i8, C>` |
| 66 | 66 | |
| 67 | error[E0599]: no method named `other` found for struct `Wrapper2` in the current scope | |
| 67 | error[E0599]: no method named `other` found for struct `Wrapper2<'a, T, C>` in the current scope | |
| 68 | 68 | --> $DIR/method-not-found-generic-arg-elision.rs:98:13 |
| 69 | 69 | | |
| 70 | 70 | LL | struct Wrapper2<'a, T, const C: usize> { |
tests/ui/methods/probe-error-on-infinite-deref.rs+1| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | //@ compile-flags: -Zwrite-long-types-to-disk=yes | |
| 1 | 2 | use std::ops::Deref; |
| 2 | 3 | |
| 3 | 4 | // Make sure that method probe error reporting doesn't get too tangled up |
tests/ui/methods/probe-error-on-infinite-deref.stderr+5-3| ... | ... | @@ -1,13 +1,15 @@ |
| 1 | error[E0055]: reached the recursion limit while auto-dereferencing `Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<{integer}>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` | |
| 2 | --> $DIR/probe-error-on-infinite-deref.rs:13:13 | |
| 1 | error[E0055]: reached the recursion limit while auto-dereferencing `Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<...>>>>>>>>>>>` | |
| 2 | --> $DIR/probe-error-on-infinite-deref.rs:14:13 | |
| 3 | 3 | | |
| 4 | 4 | LL | Wrap(1).lmao(); |
| 5 | 5 | | ^^^^ deref recursion limit reached |
| 6 | 6 | | |
| 7 | 7 | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`probe_error_on_infinite_deref`) |
| 8 | = note: the full name for the type has been written to '$TEST_BUILD_DIR/probe-error-on-infinite-deref.long-type-$LONG_TYPE_HASH.txt' | |
| 9 | = note: consider using `--verbose` to print the full type name to the console | |
| 8 | 10 | |
| 9 | 11 | error[E0599]: no method named `lmao` found for struct `Wrap<{integer}>` in the current scope |
| 10 | --> $DIR/probe-error-on-infinite-deref.rs:13:13 | |
| 12 | --> $DIR/probe-error-on-infinite-deref.rs:14:13 | |
| 11 | 13 | | |
| 12 | 14 | LL | struct Wrap<T>(T); |
| 13 | 15 | | -------------- method `lmao` not found for this struct |
tests/ui/methods/untrimmed-path-type.stderr+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | error[E0599]: no method named `unknown` found for enum `Result` in the current scope | |
| 1 | error[E0599]: no method named `unknown` found for enum `Result<T, E>` in the current scope | |
| 2 | 2 | --> $DIR/untrimmed-path-type.rs:5:11 |
| 3 | 3 | | |
| 4 | 4 | LL | meow().unknown(); |
tests/ui/never_type/defaulted-never-note.fallback.stderr+1-1| ... | ... | @@ -8,7 +8,7 @@ LL | foo(_x); |
| 8 | 8 | | |
| 9 | 9 | = help: the trait `ImplementedForUnitButNotNever` is implemented for `()` |
| 10 | 10 | = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #48950 <https://github.com/rust-lang/rust/issues/48950> for more information) |
| 11 | = help: did you intend to use the type `()` here instead? | |
| 11 | = help: you might have intended to use the type `()` here instead | |
| 12 | 12 | note: required by a bound in `foo` |
| 13 | 13 | --> $DIR/defaulted-never-note.rs:25:11 |
| 14 | 14 | | |
tests/ui/never_type/defaulted-never-note.rs+1-1| ... | ... | @@ -35,7 +35,7 @@ fn smeg() { |
| 35 | 35 | //[fallback]~| HELP trait `ImplementedForUnitButNotNever` is implemented for `()` |
| 36 | 36 | //[fallback]~| NOTE this error might have been caused |
| 37 | 37 | //[fallback]~| NOTE required by a bound introduced by this call |
| 38 | //[fallback]~| HELP did you intend | |
| 38 | //[fallback]~| HELP you might have intended to use the type `()` | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | fn main() { |
tests/ui/never_type/diverging-fallback-no-leak.fallback.stderr+1-1| ... | ... | @@ -10,7 +10,7 @@ LL | unconstrained_arg(return); |
| 10 | 10 | () |
| 11 | 11 | i32 |
| 12 | 12 | = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #48950 <https://github.com/rust-lang/rust/issues/48950> for more information) |
| 13 | = help: did you intend to use the type `()` here instead? | |
| 13 | = help: you might have intended to use the type `()` here instead | |
| 14 | 14 | note: required by a bound in `unconstrained_arg` |
| 15 | 15 | --> $DIR/diverging-fallback-no-leak.rs:12:25 |
| 16 | 16 | | |
tests/ui/offset-of/offset-of-tuple-field.stderr+36| ... | ... | @@ -15,60 +15,96 @@ error[E0609]: no field `_0` on type `(u8, u8)` |
| 15 | 15 | | |
| 16 | 16 | LL | offset_of!((u8, u8), _0); |
| 17 | 17 | | ^^ |
| 18 | | | |
| 19 | help: a field with a similar name exists | |
| 20 | | | |
| 21 | LL - offset_of!((u8, u8), _0); | |
| 22 | LL + offset_of!((u8, u8), 0); | |
| 23 | | | |
| 18 | 24 | |
| 19 | 25 | error[E0609]: no field `01` on type `(u8, u8)` |
| 20 | 26 | --> $DIR/offset-of-tuple-field.rs:7:26 |
| 21 | 27 | | |
| 22 | 28 | LL | offset_of!((u8, u8), 01); |
| 23 | 29 | | ^^ |
| 30 | | | |
| 31 | = note: available fields are: `0`, `1` | |
| 24 | 32 | |
| 25 | 33 | error[E0609]: no field `1e2` on type `(u8, u8)` |
| 26 | 34 | --> $DIR/offset-of-tuple-field.rs:8:26 |
| 27 | 35 | | |
| 28 | 36 | LL | offset_of!((u8, u8), 1e2); |
| 29 | 37 | | ^^^ |
| 38 | | | |
| 39 | = note: available fields are: `0`, `1` | |
| 30 | 40 | |
| 31 | 41 | error[E0609]: no field `1_` on type `(u8, u8)` |
| 32 | 42 | --> $DIR/offset-of-tuple-field.rs:9:26 |
| 33 | 43 | | |
| 34 | 44 | LL | offset_of!((u8, u8), 1_u8); |
| 35 | 45 | | ^^^^ |
| 46 | | | |
| 47 | help: a field with a similar name exists | |
| 48 | | | |
| 49 | LL - offset_of!((u8, u8), 1_u8); | |
| 50 | LL + offset_of!((u8, u8), 1); | |
| 51 | | | |
| 36 | 52 | |
| 37 | 53 | error[E0609]: no field `1e2` on type `(u8, u8)` |
| 38 | 54 | --> $DIR/offset-of-tuple-field.rs:12:35 |
| 39 | 55 | | |
| 40 | 56 | LL | builtin # offset_of((u8, u8), 1e2); |
| 41 | 57 | | ^^^ |
| 58 | | | |
| 59 | = note: available fields are: `0`, `1` | |
| 42 | 60 | |
| 43 | 61 | error[E0609]: no field `_0` on type `(u8, u8)` |
| 44 | 62 | --> $DIR/offset-of-tuple-field.rs:13:35 |
| 45 | 63 | | |
| 46 | 64 | LL | builtin # offset_of((u8, u8), _0); |
| 47 | 65 | | ^^ |
| 66 | | | |
| 67 | help: a field with a similar name exists | |
| 68 | | | |
| 69 | LL - builtin # offset_of((u8, u8), _0); | |
| 70 | LL + builtin # offset_of((u8, u8), 0); | |
| 71 | | | |
| 48 | 72 | |
| 49 | 73 | error[E0609]: no field `01` on type `(u8, u8)` |
| 50 | 74 | --> $DIR/offset-of-tuple-field.rs:14:35 |
| 51 | 75 | | |
| 52 | 76 | LL | builtin # offset_of((u8, u8), 01); |
| 53 | 77 | | ^^ |
| 78 | | | |
| 79 | = note: available fields are: `0`, `1` | |
| 54 | 80 | |
| 55 | 81 | error[E0609]: no field `1_` on type `(u8, u8)` |
| 56 | 82 | --> $DIR/offset-of-tuple-field.rs:15:35 |
| 57 | 83 | | |
| 58 | 84 | LL | builtin # offset_of((u8, u8), 1_u8); |
| 59 | 85 | | ^^^^ |
| 86 | | | |
| 87 | help: a field with a similar name exists | |
| 88 | | | |
| 89 | LL - builtin # offset_of((u8, u8), 1_u8); | |
| 90 | LL + builtin # offset_of((u8, u8), 1); | |
| 91 | | | |
| 60 | 92 | |
| 61 | 93 | error[E0609]: no field `2` on type `(u8, u16)` |
| 62 | 94 | --> $DIR/offset-of-tuple-field.rs:18:47 |
| 63 | 95 | | |
| 64 | 96 | LL | offset_of!(((u8, u16), (u32, u16, u8)), 0.2); |
| 65 | 97 | | ^ |
| 98 | | | |
| 99 | = note: available fields are: `0`, `1` | |
| 66 | 100 | |
| 67 | 101 | error[E0609]: no field `1e2` on type `(u8, u16)` |
| 68 | 102 | --> $DIR/offset-of-tuple-field.rs:19:47 |
| 69 | 103 | | |
| 70 | 104 | LL | offset_of!(((u8, u16), (u32, u16, u8)), 0.1e2); |
| 71 | 105 | | ^^^ |
| 106 | | | |
| 107 | = note: available fields are: `0`, `1` | |
| 72 | 108 | |
| 73 | 109 | error[E0609]: no field `0` on type `u8` |
| 74 | 110 | --> $DIR/offset-of-tuple-field.rs:21:49 |
tests/ui/parser/float-field.stderr+6| ... | ... | @@ -305,6 +305,8 @@ error[E0609]: no field `1e1` on type `(u8, u8)` |
| 305 | 305 | | |
| 306 | 306 | LL | { s.1.1e1; } |
| 307 | 307 | | ^^^ unknown field |
| 308 | | | |
| 309 | = note: available fields are: `0`, `1` | |
| 308 | 310 | |
| 309 | 311 | error[E0609]: no field `0x1e1` on type `S` |
| 310 | 312 | --> $DIR/float-field.rs:34:9 |
| ... | ... | @@ -343,12 +345,16 @@ error[E0609]: no field `f32` on type `(u8, u8)` |
| 343 | 345 | | |
| 344 | 346 | LL | { s.1.f32; } |
| 345 | 347 | | ^^^ unknown field |
| 348 | | | |
| 349 | = note: available fields are: `0`, `1` | |
| 346 | 350 | |
| 347 | 351 | error[E0609]: no field `1e1` on type `(u8, u8)` |
| 348 | 352 | --> $DIR/float-field.rs:71:9 |
| 349 | 353 | | |
| 350 | 354 | LL | { s.1.1e1f32; } |
| 351 | 355 | | ^^^^^^^^ unknown field |
| 356 | | | |
| 357 | = note: available fields are: `0`, `1` | |
| 352 | 358 | |
| 353 | 359 | error: aborting due to 57 previous errors |
| 354 | 360 |
tests/ui/parser/macro/macro-attr-bad.rs created+32| ... | ... | @@ -0,0 +1,32 @@ |
| 1 | #![crate_type = "lib"] | |
| 2 | #![feature(macro_attr)] | |
| 3 | ||
| 4 | macro_rules! attr_incomplete_1 { attr } | |
| 5 | //~^ ERROR macro definition ended unexpectedly | |
| 6 | ||
| 7 | macro_rules! attr_incomplete_2 { attr() } | |
| 8 | //~^ ERROR macro definition ended unexpectedly | |
| 9 | ||
| 10 | macro_rules! attr_incomplete_3 { attr() {} } | |
| 11 | //~^ ERROR expected `=>` | |
| 12 | ||
| 13 | macro_rules! attr_incomplete_4 { attr() {} => } | |
| 14 | //~^ ERROR macro definition ended unexpectedly | |
| 15 | ||
| 16 | macro_rules! attr_noparens_1 { attr{} {} => {} } | |
| 17 | //~^ ERROR macro attribute argument matchers require parentheses | |
| 18 | ||
| 19 | macro_rules! attr_noparens_2 { attr[] {} => {} } | |
| 20 | //~^ ERROR macro attribute argument matchers require parentheses | |
| 21 | ||
| 22 | macro_rules! attr_noparens_3 { attr _ {} => {} } | |
| 23 | //~^ ERROR invalid macro matcher | |
| 24 | ||
| 25 | macro_rules! attr_dup_matcher_1 { attr() {$x:ident $x:ident} => {} } | |
| 26 | //~^ ERROR duplicate matcher binding | |
| 27 | ||
| 28 | macro_rules! attr_dup_matcher_2 { attr($x:ident $x:ident) {} => {} } | |
| 29 | //~^ ERROR duplicate matcher binding | |
| 30 | ||
| 31 | macro_rules! attr_dup_matcher_3 { attr($x:ident) {$x:ident} => {} } | |
| 32 | //~^ ERROR duplicate matcher binding |
tests/ui/parser/macro/macro-attr-bad.stderr created+80| ... | ... | @@ -0,0 +1,80 @@ |
| 1 | error: macro definition ended unexpectedly | |
| 2 | --> $DIR/macro-attr-bad.rs:4:38 | |
| 3 | | | |
| 4 | LL | macro_rules! attr_incomplete_1 { attr } | |
| 5 | | ^ expected macro attr args | |
| 6 | ||
| 7 | error: macro definition ended unexpectedly | |
| 8 | --> $DIR/macro-attr-bad.rs:7:40 | |
| 9 | | | |
| 10 | LL | macro_rules! attr_incomplete_2 { attr() } | |
| 11 | | ^ expected macro attr body | |
| 12 | ||
| 13 | error: expected `=>`, found end of macro arguments | |
| 14 | --> $DIR/macro-attr-bad.rs:10:43 | |
| 15 | | | |
| 16 | LL | macro_rules! attr_incomplete_3 { attr() {} } | |
| 17 | | ^ expected `=>` | |
| 18 | ||
| 19 | error: macro definition ended unexpectedly | |
| 20 | --> $DIR/macro-attr-bad.rs:13:46 | |
| 21 | | | |
| 22 | LL | macro_rules! attr_incomplete_4 { attr() {} => } | |
| 23 | | ^ expected right-hand side of macro rule | |
| 24 | ||
| 25 | error: macro attribute argument matchers require parentheses | |
| 26 | --> $DIR/macro-attr-bad.rs:16:36 | |
| 27 | | | |
| 28 | LL | macro_rules! attr_noparens_1 { attr{} {} => {} } | |
| 29 | | ^^ | |
| 30 | | | |
| 31 | help: the delimiters should be `(` and `)` | |
| 32 | | | |
| 33 | LL - macro_rules! attr_noparens_1 { attr{} {} => {} } | |
| 34 | LL + macro_rules! attr_noparens_1 { attr() {} => {} } | |
| 35 | | | |
| 36 | ||
| 37 | error: macro attribute argument matchers require parentheses | |
| 38 | --> $DIR/macro-attr-bad.rs:19:36 | |
| 39 | | | |
| 40 | LL | macro_rules! attr_noparens_2 { attr[] {} => {} } | |
| 41 | | ^^ | |
| 42 | | | |
| 43 | help: the delimiters should be `(` and `)` | |
| 44 | | | |
| 45 | LL - macro_rules! attr_noparens_2 { attr[] {} => {} } | |
| 46 | LL + macro_rules! attr_noparens_2 { attr() {} => {} } | |
| 47 | | | |
| 48 | ||
| 49 | error: invalid macro matcher; matchers must be contained in balanced delimiters | |
| 50 | --> $DIR/macro-attr-bad.rs:22:37 | |
| 51 | | | |
| 52 | LL | macro_rules! attr_noparens_3 { attr _ {} => {} } | |
| 53 | | ^ | |
| 54 | ||
| 55 | error: duplicate matcher binding | |
| 56 | --> $DIR/macro-attr-bad.rs:25:52 | |
| 57 | | | |
| 58 | LL | macro_rules! attr_dup_matcher_1 { attr() {$x:ident $x:ident} => {} } | |
| 59 | | -------- ^^^^^^^^ duplicate binding | |
| 60 | | | | |
| 61 | | previous binding | |
| 62 | ||
| 63 | error: duplicate matcher binding | |
| 64 | --> $DIR/macro-attr-bad.rs:28:49 | |
| 65 | | | |
| 66 | LL | macro_rules! attr_dup_matcher_2 { attr($x:ident $x:ident) {} => {} } | |
| 67 | | -------- ^^^^^^^^ duplicate binding | |
| 68 | | | | |
| 69 | | previous binding | |
| 70 | ||
| 71 | error: duplicate matcher binding | |
| 72 | --> $DIR/macro-attr-bad.rs:31:51 | |
| 73 | | | |
| 74 | LL | macro_rules! attr_dup_matcher_3 { attr($x:ident) {$x:ident} => {} } | |
| 75 | | -------- ^^^^^^^^ duplicate binding | |
| 76 | | | | |
| 77 | | previous binding | |
| 78 | ||
| 79 | error: aborting due to 10 previous errors | |
| 80 |
tests/ui/parser/macro/macro-attr-recovery.rs created+19| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | #![crate_type = "lib"] | |
| 2 | #![feature(macro_attr)] | |
| 3 | ||
| 4 | macro_rules! attr { | |
| 5 | attr[$($args:tt)*] { $($body:tt)* } => { | |
| 6 | //~^ ERROR: macro attribute argument matchers require parentheses | |
| 7 | //~v ERROR: attr: | |
| 8 | compile_error!(concat!( | |
| 9 | "attr: args=\"", | |
| 10 | stringify!($($args)*), | |
| 11 | "\" body=\"", | |
| 12 | stringify!($($body)*), | |
| 13 | "\"", | |
| 14 | )); | |
| 15 | }; | |
| 16 | } | |
| 17 | ||
| 18 | #[attr] | |
| 19 | struct S; |
tests/ui/parser/macro/macro-attr-recovery.stderr created+31| ... | ... | @@ -0,0 +1,31 @@ |
| 1 | error: macro attribute argument matchers require parentheses | |
| 2 | --> $DIR/macro-attr-recovery.rs:5:9 | |
| 3 | | | |
| 4 | LL | attr[$($args:tt)*] { $($body:tt)* } => { | |
| 5 | | ^^^^^^^^^^^^^^ | |
| 6 | | | |
| 7 | help: the delimiters should be `(` and `)` | |
| 8 | | | |
| 9 | LL - attr[$($args:tt)*] { $($body:tt)* } => { | |
| 10 | LL + attr($($args:tt)*) { $($body:tt)* } => { | |
| 11 | | | |
| 12 | ||
| 13 | error: attr: args="" body="struct S;" | |
| 14 | --> $DIR/macro-attr-recovery.rs:8:9 | |
| 15 | | | |
| 16 | LL | / compile_error!(concat!( | |
| 17 | LL | | "attr: args=\"", | |
| 18 | LL | | stringify!($($args)*), | |
| 19 | LL | | "\" body=\"", | |
| 20 | LL | | stringify!($($body)*), | |
| 21 | LL | | "\"", | |
| 22 | LL | | )); | |
| 23 | | |__________^ | |
| 24 | ... | |
| 25 | LL | #[attr] | |
| 26 | | ------- in this attribute macro expansion | |
| 27 | | | |
| 28 | = note: this error originates in the attribute macro `attr` (in Nightly builds, run with -Z macro-backtrace for more info) | |
| 29 | ||
| 30 | error: aborting due to 2 previous errors | |
| 31 |
tests/ui/pattern/deref-patterns/usefulness/non-exhaustive.rs+1-1| ... | ... | @@ -15,7 +15,7 @@ fn main() { |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | match Box::new((true, Box::new(false))) { |
| 18 | //~^ ERROR non-exhaustive patterns: `deref!((false, deref!(false)))` and `deref!((true, deref!(true)))` not covered | |
| 18 | //~^ ERROR non-exhaustive patterns: `deref!((true, deref!(true)))` and `deref!((false, deref!(false)))` not covered | |
| 19 | 19 | (true, false) => {} |
| 20 | 20 | (false, true) => {} |
| 21 | 21 | } |
tests/ui/pattern/deref-patterns/usefulness/non-exhaustive.stderr+3-3| ... | ... | @@ -28,11 +28,11 @@ LL ~ true => {}, |
| 28 | 28 | LL + deref!(deref!(false)) => todo!() |
| 29 | 29 | | |
| 30 | 30 | |
| 31 | error[E0004]: non-exhaustive patterns: `deref!((false, deref!(false)))` and `deref!((true, deref!(true)))` not covered | |
| 31 | error[E0004]: non-exhaustive patterns: `deref!((true, deref!(true)))` and `deref!((false, deref!(false)))` not covered | |
| 32 | 32 | --> $DIR/non-exhaustive.rs:17:11 |
| 33 | 33 | | |
| 34 | 34 | LL | match Box::new((true, Box::new(false))) { |
| 35 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ patterns `deref!((false, deref!(false)))` and `deref!((true, deref!(true)))` not covered | |
| 35 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ patterns `deref!((true, deref!(true)))` and `deref!((false, deref!(false)))` not covered | |
| 36 | 36 | | |
| 37 | 37 | note: `Box<(bool, Box<bool>)>` defined here |
| 38 | 38 | --> $SRC_DIR/alloc/src/boxed.rs:LL:COL |
| ... | ... | @@ -40,7 +40,7 @@ note: `Box<(bool, Box<bool>)>` defined here |
| 40 | 40 | help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms |
| 41 | 41 | | |
| 42 | 42 | LL ~ (false, true) => {}, |
| 43 | LL + deref!((false, deref!(false))) | deref!((true, deref!(true))) => todo!() | |
| 43 | LL + deref!((true, deref!(true))) | deref!((false, deref!(false))) => todo!() | |
| 44 | 44 | | |
| 45 | 45 | |
| 46 | 46 | error[E0004]: non-exhaustive patterns: `deref!((deref!(T::C), _))` not covered |
tests/ui/pattern/usefulness/unions.rs+1-1| ... | ... | @@ -26,7 +26,7 @@ fn main() { |
| 26 | 26 | } |
| 27 | 27 | // Our approach can report duplicate witnesses sometimes. |
| 28 | 28 | match (x, true) { |
| 29 | //~^ ERROR non-exhaustive patterns: `(U8AsBool { n: 0_u8 }, false)`, `(U8AsBool { b: false }, false)`, `(U8AsBool { n: 0_u8 }, false)` and 1 more not covered | |
| 29 | //~^ ERROR non-exhaustive patterns: `(U8AsBool { n: 0_u8 }, false)`, `(U8AsBool { b: true }, false)`, `(U8AsBool { n: 0_u8 }, false)` and 1 more not covered | |
| 30 | 30 | (U8AsBool { b: true }, true) => {} |
| 31 | 31 | (U8AsBool { b: false }, true) => {} |
| 32 | 32 | (U8AsBool { n: 1.. }, true) => {} |
tests/ui/pattern/usefulness/unions.stderr+2-2| ... | ... | @@ -16,11 +16,11 @@ LL ~ U8AsBool { n: 1.. } => {}, |
| 16 | 16 | LL + U8AsBool { n: 0_u8 } | U8AsBool { b: false } => todo!() |
| 17 | 17 | | |
| 18 | 18 | |
| 19 | error[E0004]: non-exhaustive patterns: `(U8AsBool { n: 0_u8 }, false)`, `(U8AsBool { b: false }, false)`, `(U8AsBool { n: 0_u8 }, false)` and 1 more not covered | |
| 19 | error[E0004]: non-exhaustive patterns: `(U8AsBool { n: 0_u8 }, false)`, `(U8AsBool { b: true }, false)`, `(U8AsBool { n: 0_u8 }, false)` and 1 more not covered | |
| 20 | 20 | --> $DIR/unions.rs:28:15 |
| 21 | 21 | | |
| 22 | 22 | LL | match (x, true) { |
| 23 | | ^^^^^^^^^ patterns `(U8AsBool { n: 0_u8 }, false)`, `(U8AsBool { b: false }, false)`, `(U8AsBool { n: 0_u8 }, false)` and 1 more not covered | |
| 23 | | ^^^^^^^^^ patterns `(U8AsBool { n: 0_u8 }, false)`, `(U8AsBool { b: true }, false)`, `(U8AsBool { n: 0_u8 }, false)` and 1 more not covered | |
| 24 | 24 | | |
| 25 | 25 | = note: the matched value is of type `(U8AsBool, bool)` |
| 26 | 26 | help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms |
tests/ui/proc-macro/span-from-proc-macro.stderr+1-1| ... | ... | @@ -10,7 +10,7 @@ LL | field: MissingType |
| 10 | 10 | ::: $DIR/span-from-proc-macro.rs:8:1 |
| 11 | 11 | | |
| 12 | 12 | LL | #[error_from_attribute] |
| 13 | | ----------------------- in this procedural macro expansion | |
| 13 | | ----------------------- in this attribute macro expansion | |
| 14 | 14 | |
| 15 | 15 | error[E0412]: cannot find type `OtherMissingType` in this scope |
| 16 | 16 | --> $DIR/auxiliary/span-from-proc-macro.rs:42:21 |
tests/ui/recursion/issue-23122-2.rs+1| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | //@ compile-flags: -Zwrite-long-types-to-disk=yes | |
| 1 | 2 | trait Next { |
| 2 | 3 | type Next: Next; |
| 3 | 4 | } |
tests/ui/recursion/issue-23122-2.stderr+5-3| ... | ... | @@ -1,17 +1,19 @@ |
| 1 | 1 | error[E0275]: overflow evaluating the requirement `<<<<<<<... as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next: Sized` |
| 2 | --> $DIR/issue-23122-2.rs:10:17 | |
| 2 | --> $DIR/issue-23122-2.rs:11:17 | |
| 3 | 3 | | |
| 4 | 4 | LL | type Next = <GetNext<T::Next> as Next>::Next; |
| 5 | 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 6 | 6 | | |
| 7 | 7 | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_23122_2`) |
| 8 | note: required for `GetNext<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<T as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next>` to implement `Next` | |
| 9 | --> $DIR/issue-23122-2.rs:9:15 | |
| 8 | note: required for `GetNext<<<<... as Next>::Next as Next>::Next as Next>::Next>` to implement `Next` | |
| 9 | --> $DIR/issue-23122-2.rs:10:15 | |
| 10 | 10 | | |
| 11 | 11 | LL | impl<T: Next> Next for GetNext<T> { |
| 12 | 12 | | - ^^^^ ^^^^^^^^^^ |
| 13 | 13 | | | |
| 14 | 14 | | unsatisfied trait bound introduced here |
| 15 | = note: the full name for the type has been written to '$TEST_BUILD_DIR/issue-23122-2.long-type-$LONG_TYPE_HASH.txt' | |
| 16 | = note: consider using `--verbose` to print the full type name to the console | |
| 15 | 17 | |
| 16 | 18 | error: aborting due to 1 previous error |
| 17 | 19 |
tests/ui/recursion/issue-38591-non-regular-dropck-recursion.rs+1| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | //@ compile-flags: -Zwrite-long-types-to-disk=yes | |
| 1 | 2 | // `S` is infinitely recursing so it's not possible to generate a finite |
| 2 | 3 | // drop impl. |
| 3 | 4 | // |
tests/ui/recursion/issue-38591-non-regular-dropck-recursion.stderr+4-2| ... | ... | @@ -1,10 +1,12 @@ |
| 1 | 1 | error[E0320]: overflow while adding drop-check rules for `S<u32>` |
| 2 | --> $DIR/issue-38591-non-regular-dropck-recursion.rs:11:6 | |
| 2 | --> $DIR/issue-38591-non-regular-dropck-recursion.rs:12:6 | |
| 3 | 3 | | |
| 4 | 4 | LL | fn f(x: S<u32>) {} |
| 5 | 5 | | ^ |
| 6 | 6 | | |
| 7 | = note: overflowed on `S<fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(u32)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))>` | |
| 7 | = note: overflowed on `S<fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(...))))))))))))))))>` | |
| 8 | = note: the full name for the type has been written to '$TEST_BUILD_DIR/issue-38591-non-regular-dropck-recursion.long-type-$LONG_TYPE_HASH.txt' | |
| 9 | = note: consider using `--verbose` to print the full type name to the console | |
| 8 | 10 | |
| 9 | 11 | error: aborting due to 1 previous error |
| 10 | 12 |
tests/ui/recursion/issue-83150.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //~ ERROR overflow evaluating the requirement `Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>: Iterator` |
| 2 | 2 | //@ build-fail |
| 3 | //@ compile-flags: -Copt-level=0 | |
| 3 | //@ compile-flags: -Copt-level=0 -Zwrite-long-types-to-disk=yes | |
| 4 | 4 | |
| 5 | 5 | fn main() { |
| 6 | 6 | let mut iter = 0u8..1; |
tests/ui/recursion/issue-83150.stderr+4-2| ... | ... | @@ -13,9 +13,11 @@ LL | func(&mut iter.map(|x| x + 1)) |
| 13 | 13 | error[E0275]: overflow evaluating the requirement `Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>: Iterator` |
| 14 | 14 | | |
| 15 | 15 | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`) |
| 16 | = note: required for `&mut Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>` to implement `Iterator` | |
| 16 | = note: required for `&mut Map<&mut Range<u8>, {closure@issue-83150.rs:12:24}>` to implement `Iterator` | |
| 17 | 17 | = note: 65 redundant requirements hidden |
| 18 | = note: required for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>, {closure@$DIR/issue-83150.rs:12:24: 12:27}>` to implement `Iterator` | |
| 18 | = note: required for `&mut Map<&mut Map<&mut Map<&mut Map<&mut ..., ...>, ...>, ...>, ...>` to implement `Iterator` | |
| 19 | = note: the full name for the type has been written to '$TEST_BUILD_DIR/issue-83150.long-type-$LONG_TYPE_HASH.txt' | |
| 20 | = note: consider using `--verbose` to print the full type name to the console | |
| 19 | 21 | |
| 20 | 22 | error: aborting due to 1 previous error; 1 warning emitted |
| 21 | 23 |
tests/ui/rfcs/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr+1-1| ... | ... | @@ -2,7 +2,7 @@ error[E0277]: the trait bound `f32: Termination` is not satisfied |
| 2 | 2 | --> $DIR/termination-trait-test-wrong-type.rs:6:31 |
| 3 | 3 | | |
| 4 | 4 | LL | #[test] |
| 5 | | ------- in this procedural macro expansion | |
| 5 | | ------- in this attribute macro expansion | |
| 6 | 6 | LL | fn can_parse_zero_as_f32() -> Result<f32, ParseFloatError> { |
| 7 | 7 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Termination` is not implemented for `f32` |
| 8 | 8 | | |
tests/ui/self/arbitrary_self_type_infinite_recursion.stderr+1-1| ... | ... | @@ -32,7 +32,7 @@ LL | p.method(); |
| 32 | 32 | | |
| 33 | 33 | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`arbitrary_self_type_infinite_recursion`) |
| 34 | 34 | |
| 35 | error[E0599]: no method named `method` found for struct `MySmartPtr` in the current scope | |
| 35 | error[E0599]: no method named `method` found for struct `MySmartPtr<T>` in the current scope | |
| 36 | 36 | --> $DIR/arbitrary_self_type_infinite_recursion.rs:21:5 |
| 37 | 37 | | |
| 38 | 38 | LL | struct MySmartPtr<T>(T); |
tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.stderr+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | error[E0599]: no method named `frobnicate_ref` found for struct `CppRef` in the current scope | |
| 1 | error[E0599]: no method named `frobnicate_ref` found for struct `CppRef<T>` in the current scope | |
| 2 | 2 | --> $DIR/arbitrary_self_types_not_allow_call_with_no_deref.rs:29:17 |
| 3 | 3 | | |
| 4 | 4 | LL | struct CppRef<T>(T); |
| ... | ... | @@ -16,7 +16,7 @@ help: there is a method `frobnicate_cpp_ref` with a similar name |
| 16 | 16 | LL | foo_cpp_ref.frobnicate_cpp_ref(); |
| 17 | 17 | | ++++ |
| 18 | 18 | |
| 19 | error[E0599]: no method named `frobnicate_self` found for struct `CppRef` in the current scope | |
| 19 | error[E0599]: no method named `frobnicate_self` found for struct `CppRef<T>` in the current scope | |
| 20 | 20 | --> $DIR/arbitrary_self_types_not_allow_call_with_no_deref.rs:32:17 |
| 21 | 21 | | |
| 22 | 22 | LL | struct CppRef<T>(T); |
tests/ui/self/arbitrary_self_types_pin_needing_borrow.rs+1-1| ... | ... | @@ -9,5 +9,5 @@ impl S { |
| 9 | 9 | fn main() { |
| 10 | 10 | Pin::new(S).x(); |
| 11 | 11 | //~^ ERROR the trait bound `S: Deref` is not satisfied |
| 12 | //~| ERROR no method named `x` found for struct `Pin` in the current scope | |
| 12 | //~| ERROR no method named `x` found for struct `Pin<Ptr>` in the current scope | |
| 13 | 13 | } |
tests/ui/self/arbitrary_self_types_pin_needing_borrow.stderr+1-1| ... | ... | @@ -15,7 +15,7 @@ LL | Pin::new(&S).x(); |
| 15 | 15 | LL | Pin::new(&mut S).x(); |
| 16 | 16 | | ++++ |
| 17 | 17 | |
| 18 | error[E0599]: no method named `x` found for struct `Pin` in the current scope | |
| 18 | error[E0599]: no method named `x` found for struct `Pin<Ptr>` in the current scope | |
| 19 | 19 | --> $DIR/arbitrary_self_types_pin_needing_borrow.rs:10:17 |
| 20 | 20 | | |
| 21 | 21 | LL | Pin::new(S).x(); |
tests/ui/simd/libm_no_std_cant_float.stderr+6-6| ... | ... | @@ -1,34 +1,34 @@ |
| 1 | error[E0599]: no method named `ceil` found for struct `Simd` in the current scope | |
| 1 | error[E0599]: no method named `ceil` found for struct `Simd<T, N>` in the current scope | |
| 2 | 2 | --> $DIR/libm_no_std_cant_float.rs:15:17 |
| 3 | 3 | | |
| 4 | 4 | LL | let _xc = x.ceil(); |
| 5 | 5 | | ^^^^ method not found in `Simd<f32, 4>` |
| 6 | 6 | |
| 7 | error[E0599]: no method named `floor` found for struct `Simd` in the current scope | |
| 7 | error[E0599]: no method named `floor` found for struct `Simd<T, N>` in the current scope | |
| 8 | 8 | --> $DIR/libm_no_std_cant_float.rs:16:17 |
| 9 | 9 | | |
| 10 | 10 | LL | let _xf = x.floor(); |
| 11 | 11 | | ^^^^^ method not found in `Simd<f32, 4>` |
| 12 | 12 | |
| 13 | error[E0599]: no method named `round` found for struct `Simd` in the current scope | |
| 13 | error[E0599]: no method named `round` found for struct `Simd<T, N>` in the current scope | |
| 14 | 14 | --> $DIR/libm_no_std_cant_float.rs:17:17 |
| 15 | 15 | | |
| 16 | 16 | LL | let _xr = x.round(); |
| 17 | 17 | | ^^^^^ method not found in `Simd<f32, 4>` |
| 18 | 18 | |
| 19 | error[E0599]: no method named `trunc` found for struct `Simd` in the current scope | |
| 19 | error[E0599]: no method named `trunc` found for struct `Simd<T, N>` in the current scope | |
| 20 | 20 | --> $DIR/libm_no_std_cant_float.rs:18:17 |
| 21 | 21 | | |
| 22 | 22 | LL | let _xt = x.trunc(); |
| 23 | 23 | | ^^^^^ method not found in `Simd<f32, 4>` |
| 24 | 24 | |
| 25 | error[E0599]: no method named `mul_add` found for struct `Simd` in the current scope | |
| 25 | error[E0599]: no method named `mul_add` found for struct `Simd<T, N>` in the current scope | |
| 26 | 26 | --> $DIR/libm_no_std_cant_float.rs:19:19 |
| 27 | 27 | | |
| 28 | 28 | LL | let _xfma = x.mul_add(x, x); |
| 29 | 29 | | ^^^^^^^ method not found in `Simd<f32, 4>` |
| 30 | 30 | |
| 31 | error[E0599]: no method named `sqrt` found for struct `Simd` in the current scope | |
| 31 | error[E0599]: no method named `sqrt` found for struct `Simd<T, N>` in the current scope | |
| 32 | 32 | --> $DIR/libm_no_std_cant_float.rs:20:20 |
| 33 | 33 | | |
| 34 | 34 | LL | let _xsqrt = x.sqrt(); |
tests/ui/structs/tuple-struct-field-naming-47073.stderr+1-5| ... | ... | @@ -4,11 +4,7 @@ error[E0609]: no field `00` on type `Verdict` |
| 4 | 4 | LL | let _condemned = justice.00; |
| 5 | 5 | | ^^ unknown field |
| 6 | 6 | | |
| 7 | help: a field with a similar name exists | |
| 8 | | | |
| 9 | LL - let _condemned = justice.00; | |
| 10 | LL + let _condemned = justice.0; | |
| 11 | | | |
| 7 | = note: available fields are: `0`, `1` | |
| 12 | 8 | |
| 13 | 9 | error[E0609]: no field `001` on type `Verdict` |
| 14 | 10 | --> $DIR/tuple-struct-field-naming-47073.rs:11:31 |
tests/ui/suggestions/enum-method-probe.fixed+6-6| ... | ... | @@ -14,7 +14,7 @@ impl Foo { |
| 14 | 14 | fn test_result_in_result() -> Result<(), ()> { |
| 15 | 15 | let res: Result<_, ()> = Ok(Foo); |
| 16 | 16 | res?.get(); |
| 17 | //~^ ERROR no method named `get` found for enum `Result` in the current scope | |
| 17 | //~^ ERROR no method named `get` found for enum `Result<T, E>` in the current scope | |
| 18 | 18 | //~| HELP use the `?` operator |
| 19 | 19 | Ok(()) |
| 20 | 20 | } |
| ... | ... | @@ -22,7 +22,7 @@ fn test_result_in_result() -> Result<(), ()> { |
| 22 | 22 | async fn async_test_result_in_result() -> Result<(), ()> { |
| 23 | 23 | let res: Result<_, ()> = Ok(Foo); |
| 24 | 24 | res?.get(); |
| 25 | //~^ ERROR no method named `get` found for enum `Result` in the current scope | |
| 25 | //~^ ERROR no method named `get` found for enum `Result<T, E>` in the current scope | |
| 26 | 26 | //~| HELP use the `?` operator |
| 27 | 27 | Ok(()) |
| 28 | 28 | } |
| ... | ... | @@ -30,21 +30,21 @@ async fn async_test_result_in_result() -> Result<(), ()> { |
| 30 | 30 | fn test_result_in_unit_return() { |
| 31 | 31 | let res: Result<_, ()> = Ok(Foo); |
| 32 | 32 | res.expect("REASON").get(); |
| 33 | //~^ ERROR no method named `get` found for enum `Result` in the current scope | |
| 33 | //~^ ERROR no method named `get` found for enum `Result<T, E>` in the current scope | |
| 34 | 34 | //~| HELP consider using `Result::expect` to unwrap the `Foo` value, panicking if the value is a `Result::Err` |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | async fn async_test_result_in_unit_return() { |
| 38 | 38 | let res: Result<_, ()> = Ok(Foo); |
| 39 | 39 | res.expect("REASON").get(); |
| 40 | //~^ ERROR no method named `get` found for enum `Result` in the current scope | |
| 40 | //~^ ERROR no method named `get` found for enum `Result<T, E>` in the current scope | |
| 41 | 41 | //~| HELP consider using `Result::expect` to unwrap the `Foo` value, panicking if the value is a `Result::Err` |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | fn test_option_in_option() -> Option<()> { |
| 45 | 45 | let res: Option<_> = Some(Foo); |
| 46 | 46 | res?.get(); |
| 47 | //~^ ERROR no method named `get` found for enum `Option` in the current scope | |
| 47 | //~^ ERROR no method named `get` found for enum `Option<T>` in the current scope | |
| 48 | 48 | //~| HELP use the `?` operator |
| 49 | 49 | Some(()) |
| 50 | 50 | } |
| ... | ... | @@ -52,7 +52,7 @@ fn test_option_in_option() -> Option<()> { |
| 52 | 52 | fn test_option_in_unit_return() { |
| 53 | 53 | let res: Option<_> = Some(Foo); |
| 54 | 54 | res.expect("REASON").get(); |
| 55 | //~^ ERROR no method named `get` found for enum `Option` in the current scope | |
| 55 | //~^ ERROR no method named `get` found for enum `Option<T>` in the current scope | |
| 56 | 56 | //~| HELP consider using `Option::expect` to unwrap the `Foo` value, panicking if the value is an `Option::None` |
| 57 | 57 | } |
| 58 | 58 |
tests/ui/suggestions/enum-method-probe.rs+6-6| ... | ... | @@ -14,7 +14,7 @@ impl Foo { |
| 14 | 14 | fn test_result_in_result() -> Result<(), ()> { |
| 15 | 15 | let res: Result<_, ()> = Ok(Foo); |
| 16 | 16 | res.get(); |
| 17 | //~^ ERROR no method named `get` found for enum `Result` in the current scope | |
| 17 | //~^ ERROR no method named `get` found for enum `Result<T, E>` in the current scope | |
| 18 | 18 | //~| HELP use the `?` operator |
| 19 | 19 | Ok(()) |
| 20 | 20 | } |
| ... | ... | @@ -22,7 +22,7 @@ fn test_result_in_result() -> Result<(), ()> { |
| 22 | 22 | async fn async_test_result_in_result() -> Result<(), ()> { |
| 23 | 23 | let res: Result<_, ()> = Ok(Foo); |
| 24 | 24 | res.get(); |
| 25 | //~^ ERROR no method named `get` found for enum `Result` in the current scope | |
| 25 | //~^ ERROR no method named `get` found for enum `Result<T, E>` in the current scope | |
| 26 | 26 | //~| HELP use the `?` operator |
| 27 | 27 | Ok(()) |
| 28 | 28 | } |
| ... | ... | @@ -30,21 +30,21 @@ async fn async_test_result_in_result() -> Result<(), ()> { |
| 30 | 30 | fn test_result_in_unit_return() { |
| 31 | 31 | let res: Result<_, ()> = Ok(Foo); |
| 32 | 32 | res.get(); |
| 33 | //~^ ERROR no method named `get` found for enum `Result` in the current scope | |
| 33 | //~^ ERROR no method named `get` found for enum `Result<T, E>` in the current scope | |
| 34 | 34 | //~| HELP consider using `Result::expect` to unwrap the `Foo` value, panicking if the value is a `Result::Err` |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | async fn async_test_result_in_unit_return() { |
| 38 | 38 | let res: Result<_, ()> = Ok(Foo); |
| 39 | 39 | res.get(); |
| 40 | //~^ ERROR no method named `get` found for enum `Result` in the current scope | |
| 40 | //~^ ERROR no method named `get` found for enum `Result<T, E>` in the current scope | |
| 41 | 41 | //~| HELP consider using `Result::expect` to unwrap the `Foo` value, panicking if the value is a `Result::Err` |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | fn test_option_in_option() -> Option<()> { |
| 45 | 45 | let res: Option<_> = Some(Foo); |
| 46 | 46 | res.get(); |
| 47 | //~^ ERROR no method named `get` found for enum `Option` in the current scope | |
| 47 | //~^ ERROR no method named `get` found for enum `Option<T>` in the current scope | |
| 48 | 48 | //~| HELP use the `?` operator |
| 49 | 49 | Some(()) |
| 50 | 50 | } |
| ... | ... | @@ -52,7 +52,7 @@ fn test_option_in_option() -> Option<()> { |
| 52 | 52 | fn test_option_in_unit_return() { |
| 53 | 53 | let res: Option<_> = Some(Foo); |
| 54 | 54 | res.get(); |
| 55 | //~^ ERROR no method named `get` found for enum `Option` in the current scope | |
| 55 | //~^ ERROR no method named `get` found for enum `Option<T>` in the current scope | |
| 56 | 56 | //~| HELP consider using `Option::expect` to unwrap the `Foo` value, panicking if the value is an `Option::None` |
| 57 | 57 | } |
| 58 | 58 |
tests/ui/suggestions/enum-method-probe.stderr+6-6| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | error[E0599]: no method named `get` found for enum `Result` in the current scope | |
| 1 | error[E0599]: no method named `get` found for enum `Result<T, E>` in the current scope | |
| 2 | 2 | --> $DIR/enum-method-probe.rs:24:9 |
| 3 | 3 | | |
| 4 | 4 | LL | res.get(); |
| ... | ... | @@ -14,7 +14,7 @@ help: use the `?` operator to extract the `Foo` value, propagating a `Result::Er |
| 14 | 14 | LL | res?.get(); |
| 15 | 15 | | + |
| 16 | 16 | |
| 17 | error[E0599]: no method named `get` found for enum `Result` in the current scope | |
| 17 | error[E0599]: no method named `get` found for enum `Result<T, E>` in the current scope | |
| 18 | 18 | --> $DIR/enum-method-probe.rs:39:9 |
| 19 | 19 | | |
| 20 | 20 | LL | res.get(); |
| ... | ... | @@ -30,7 +30,7 @@ help: consider using `Result::expect` to unwrap the `Foo` value, panicking if th |
| 30 | 30 | LL | res.expect("REASON").get(); |
| 31 | 31 | | +++++++++++++++++ |
| 32 | 32 | |
| 33 | error[E0599]: no method named `get` found for enum `Result` in the current scope | |
| 33 | error[E0599]: no method named `get` found for enum `Result<T, E>` in the current scope | |
| 34 | 34 | --> $DIR/enum-method-probe.rs:16:9 |
| 35 | 35 | | |
| 36 | 36 | LL | res.get(); |
| ... | ... | @@ -46,7 +46,7 @@ help: use the `?` operator to extract the `Foo` value, propagating a `Result::Er |
| 46 | 46 | LL | res?.get(); |
| 47 | 47 | | + |
| 48 | 48 | |
| 49 | error[E0599]: no method named `get` found for enum `Result` in the current scope | |
| 49 | error[E0599]: no method named `get` found for enum `Result<T, E>` in the current scope | |
| 50 | 50 | --> $DIR/enum-method-probe.rs:32:9 |
| 51 | 51 | | |
| 52 | 52 | LL | res.get(); |
| ... | ... | @@ -62,7 +62,7 @@ help: consider using `Result::expect` to unwrap the `Foo` value, panicking if th |
| 62 | 62 | LL | res.expect("REASON").get(); |
| 63 | 63 | | +++++++++++++++++ |
| 64 | 64 | |
| 65 | error[E0599]: no method named `get` found for enum `Option` in the current scope | |
| 65 | error[E0599]: no method named `get` found for enum `Option<T>` in the current scope | |
| 66 | 66 | --> $DIR/enum-method-probe.rs:46:9 |
| 67 | 67 | | |
| 68 | 68 | LL | res.get(); |
| ... | ... | @@ -78,7 +78,7 @@ help: use the `?` operator to extract the `Foo` value, propagating an `Option::N |
| 78 | 78 | LL | res?.get(); |
| 79 | 79 | | + |
| 80 | 80 | |
| 81 | error[E0599]: no method named `get` found for enum `Option` in the current scope | |
| 81 | error[E0599]: no method named `get` found for enum `Option<T>` in the current scope | |
| 82 | 82 | --> $DIR/enum-method-probe.rs:54:9 |
| 83 | 83 | | |
| 84 | 84 | LL | res.get(); |
tests/ui/suggestions/field-has-method.rs+1-1| ... | ... | @@ -17,7 +17,7 @@ struct InferOk<T> { |
| 17 | 17 | |
| 18 | 18 | fn foo(i: InferOk<Ty>) { |
| 19 | 19 | let k = i.kind(); |
| 20 | //~^ ERROR no method named `kind` found for struct `InferOk` in the current scope | |
| 20 | //~^ ERROR no method named `kind` found for struct `InferOk<T>` in the current scope | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | fn main() {} |
tests/ui/suggestions/field-has-method.stderr+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | error[E0599]: no method named `kind` found for struct `InferOk` in the current scope | |
| 1 | error[E0599]: no method named `kind` found for struct `InferOk<T>` in the current scope | |
| 2 | 2 | --> $DIR/field-has-method.rs:19:15 |
| 3 | 3 | | |
| 4 | 4 | LL | struct InferOk<T> { |
tests/ui/suggestions/inner_type.fixed+5-5| ... | ... | @@ -15,26 +15,26 @@ fn main() { |
| 15 | 15 | let other_item = std::cell::RefCell::new(Struct { p: 42_u32 }); |
| 16 | 16 | |
| 17 | 17 | other_item.borrow().method(); |
| 18 | //~^ ERROR no method named `method` found for struct `RefCell` in the current scope [E0599] | |
| 18 | //~^ ERROR no method named `method` found for struct `RefCell<T>` in the current scope [E0599] | |
| 19 | 19 | //~| HELP use `.borrow()` to borrow the `Struct<u32>`, panicking if a mutable borrow exists |
| 20 | 20 | |
| 21 | 21 | other_item.borrow_mut().some_mutable_method(); |
| 22 | //~^ ERROR no method named `some_mutable_method` found for struct `RefCell` in the current scope [E0599] | |
| 22 | //~^ ERROR no method named `some_mutable_method` found for struct `RefCell<T>` in the current scope [E0599] | |
| 23 | 23 | //~| HELP .borrow_mut()` to mutably borrow the `Struct<u32>`, panicking if any borrows exist |
| 24 | 24 | |
| 25 | 25 | let another_item = std::sync::Mutex::new(Struct { p: 42_u32 }); |
| 26 | 26 | |
| 27 | 27 | another_item.lock().unwrap().method(); |
| 28 | //~^ ERROR no method named `method` found for struct `std::sync::Mutex` in the current scope [E0599] | |
| 28 | //~^ ERROR no method named `method` found for struct `std::sync::Mutex<T>` in the current scope [E0599] | |
| 29 | 29 | //~| HELP use `.lock().unwrap()` to borrow the `Struct<u32>`, blocking the current thread until it can be acquired |
| 30 | 30 | |
| 31 | 31 | let another_item = std::sync::RwLock::new(Struct { p: 42_u32 }); |
| 32 | 32 | |
| 33 | 33 | another_item.read().unwrap().method(); |
| 34 | //~^ ERROR no method named `method` found for struct `RwLock` in the current scope [E0599] | |
| 34 | //~^ ERROR no method named `method` found for struct `RwLock<T>` in the current scope [E0599] | |
| 35 | 35 | //~| HELP use `.read().unwrap()` to borrow the `Struct<u32>`, blocking the current thread until it can be acquired |
| 36 | 36 | |
| 37 | 37 | another_item.write().unwrap().some_mutable_method(); |
| 38 | //~^ ERROR no method named `some_mutable_method` found for struct `RwLock` in the current scope [E0599] | |
| 38 | //~^ ERROR no method named `some_mutable_method` found for struct `RwLock<T>` in the current scope [E0599] | |
| 39 | 39 | //~| HELP use `.write().unwrap()` to mutably borrow the `Struct<u32>`, blocking the current thread until it can be acquired |
| 40 | 40 | } |
tests/ui/suggestions/inner_type.rs+5-5| ... | ... | @@ -15,26 +15,26 @@ fn main() { |
| 15 | 15 | let other_item = std::cell::RefCell::new(Struct { p: 42_u32 }); |
| 16 | 16 | |
| 17 | 17 | other_item.method(); |
| 18 | //~^ ERROR no method named `method` found for struct `RefCell` in the current scope [E0599] | |
| 18 | //~^ ERROR no method named `method` found for struct `RefCell<T>` in the current scope [E0599] | |
| 19 | 19 | //~| HELP use `.borrow()` to borrow the `Struct<u32>`, panicking if a mutable borrow exists |
| 20 | 20 | |
| 21 | 21 | other_item.some_mutable_method(); |
| 22 | //~^ ERROR no method named `some_mutable_method` found for struct `RefCell` in the current scope [E0599] | |
| 22 | //~^ ERROR no method named `some_mutable_method` found for struct `RefCell<T>` in the current scope [E0599] | |
| 23 | 23 | //~| HELP .borrow_mut()` to mutably borrow the `Struct<u32>`, panicking if any borrows exist |
| 24 | 24 | |
| 25 | 25 | let another_item = std::sync::Mutex::new(Struct { p: 42_u32 }); |
| 26 | 26 | |
| 27 | 27 | another_item.method(); |
| 28 | //~^ ERROR no method named `method` found for struct `std::sync::Mutex` in the current scope [E0599] | |
| 28 | //~^ ERROR no method named `method` found for struct `std::sync::Mutex<T>` in the current scope [E0599] | |
| 29 | 29 | //~| HELP use `.lock().unwrap()` to borrow the `Struct<u32>`, blocking the current thread until it can be acquired |
| 30 | 30 | |
| 31 | 31 | let another_item = std::sync::RwLock::new(Struct { p: 42_u32 }); |
| 32 | 32 | |
| 33 | 33 | another_item.method(); |
| 34 | //~^ ERROR no method named `method` found for struct `RwLock` in the current scope [E0599] | |
| 34 | //~^ ERROR no method named `method` found for struct `RwLock<T>` in the current scope [E0599] | |
| 35 | 35 | //~| HELP use `.read().unwrap()` to borrow the `Struct<u32>`, blocking the current thread until it can be acquired |
| 36 | 36 | |
| 37 | 37 | another_item.some_mutable_method(); |
| 38 | //~^ ERROR no method named `some_mutable_method` found for struct `RwLock` in the current scope [E0599] | |
| 38 | //~^ ERROR no method named `some_mutable_method` found for struct `RwLock<T>` in the current scope [E0599] | |
| 39 | 39 | //~| HELP use `.write().unwrap()` to mutably borrow the `Struct<u32>`, blocking the current thread until it can be acquired |
| 40 | 40 | } |
tests/ui/suggestions/inner_type.stderr+5-5| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | error[E0599]: no method named `method` found for struct `RefCell` in the current scope | |
| 1 | error[E0599]: no method named `method` found for struct `RefCell<T>` in the current scope | |
| 2 | 2 | --> $DIR/inner_type.rs:17:16 |
| 3 | 3 | | |
| 4 | 4 | LL | other_item.method(); |
| ... | ... | @@ -14,7 +14,7 @@ help: use `.borrow()` to borrow the `Struct<u32>`, panicking if a mutable borrow |
| 14 | 14 | LL | other_item.borrow().method(); |
| 15 | 15 | | +++++++++ |
| 16 | 16 | |
| 17 | error[E0599]: no method named `some_mutable_method` found for struct `RefCell` in the current scope | |
| 17 | error[E0599]: no method named `some_mutable_method` found for struct `RefCell<T>` in the current scope | |
| 18 | 18 | --> $DIR/inner_type.rs:21:16 |
| 19 | 19 | | |
| 20 | 20 | LL | other_item.some_mutable_method(); |
| ... | ... | @@ -30,7 +30,7 @@ help: use `.borrow_mut()` to mutably borrow the `Struct<u32>`, panicking if any |
| 30 | 30 | LL | other_item.borrow_mut().some_mutable_method(); |
| 31 | 31 | | +++++++++++++ |
| 32 | 32 | |
| 33 | error[E0599]: no method named `method` found for struct `std::sync::Mutex` in the current scope | |
| 33 | error[E0599]: no method named `method` found for struct `std::sync::Mutex<T>` in the current scope | |
| 34 | 34 | --> $DIR/inner_type.rs:27:18 |
| 35 | 35 | | |
| 36 | 36 | LL | another_item.method(); |
| ... | ... | @@ -46,7 +46,7 @@ help: use `.lock().unwrap()` to borrow the `Struct<u32>`, blocking the current t |
| 46 | 46 | LL | another_item.lock().unwrap().method(); |
| 47 | 47 | | ++++++++++++++++ |
| 48 | 48 | |
| 49 | error[E0599]: no method named `method` found for struct `RwLock` in the current scope | |
| 49 | error[E0599]: no method named `method` found for struct `RwLock<T>` in the current scope | |
| 50 | 50 | --> $DIR/inner_type.rs:33:18 |
| 51 | 51 | | |
| 52 | 52 | LL | another_item.method(); |
| ... | ... | @@ -62,7 +62,7 @@ help: use `.read().unwrap()` to borrow the `Struct<u32>`, blocking the current t |
| 62 | 62 | LL | another_item.read().unwrap().method(); |
| 63 | 63 | | ++++++++++++++++ |
| 64 | 64 | |
| 65 | error[E0599]: no method named `some_mutable_method` found for struct `RwLock` in the current scope | |
| 65 | error[E0599]: no method named `some_mutable_method` found for struct `RwLock<T>` in the current scope | |
| 66 | 66 | --> $DIR/inner_type.rs:37:18 |
| 67 | 67 | | |
| 68 | 68 | LL | another_item.some_mutable_method(); |
tests/ui/suggestions/inner_type2.rs+2-2| ... | ... | @@ -16,11 +16,11 @@ thread_local! { |
| 16 | 16 | |
| 17 | 17 | fn main() { |
| 18 | 18 | STRUCT.method(); |
| 19 | //~^ ERROR no method named `method` found for struct `LocalKey` in the current scope [E0599] | |
| 19 | //~^ ERROR no method named `method` found for struct `LocalKey<T>` in the current scope [E0599] | |
| 20 | 20 | //~| HELP use `with` or `try_with` to access thread local storage |
| 21 | 21 | |
| 22 | 22 | let item = std::mem::MaybeUninit::new(Struct { p: 42_u32 }); |
| 23 | 23 | item.method(); |
| 24 | //~^ ERROR no method named `method` found for union `MaybeUninit` in the current scope [E0599] | |
| 24 | //~^ ERROR no method named `method` found for union `MaybeUninit<T>` in the current scope [E0599] | |
| 25 | 25 | //~| HELP if this `MaybeUninit<Struct<u32>>` has been initialized, use one of the `assume_init` methods to access the inner value |
| 26 | 26 | } |
tests/ui/suggestions/inner_type2.stderr+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | error[E0599]: no method named `method` found for struct `LocalKey` in the current scope | |
| 1 | error[E0599]: no method named `method` found for struct `LocalKey<T>` in the current scope | |
| 2 | 2 | --> $DIR/inner_type2.rs:18:12 |
| 3 | 3 | | |
| 4 | 4 | LL | STRUCT.method(); |
| ... | ... | @@ -11,7 +11,7 @@ note: the method `method` exists on the type `Struct<u32>` |
| 11 | 11 | LL | pub fn method(&self) {} |
| 12 | 12 | | ^^^^^^^^^^^^^^^^^^^^ |
| 13 | 13 | |
| 14 | error[E0599]: no method named `method` found for union `MaybeUninit` in the current scope | |
| 14 | error[E0599]: no method named `method` found for union `MaybeUninit<T>` in the current scope | |
| 15 | 15 | --> $DIR/inner_type2.rs:23:10 |
| 16 | 16 | | |
| 17 | 17 | LL | item.method(); |
tests/ui/test-attrs/issue-12997-2.stderr+1-1| ... | ... | @@ -2,7 +2,7 @@ error[E0308]: mismatched types |
| 2 | 2 | --> $DIR/issue-12997-2.rs:8:1 |
| 3 | 3 | | |
| 4 | 4 | LL | #[bench] |
| 5 | | -------- in this procedural macro expansion | |
| 5 | | -------- in this attribute macro expansion | |
| 6 | 6 | LL | fn bar(x: isize) { } |
| 7 | 7 | | ^^^^^^^^^^^^^^^^^^^^ |
| 8 | 8 | | | |
tests/ui/test-attrs/test-function-signature.stderr+1-1| ... | ... | @@ -26,7 +26,7 @@ error[E0277]: the trait bound `i32: Termination` is not satisfied |
| 26 | 26 | --> $DIR/test-function-signature.rs:9:13 |
| 27 | 27 | | |
| 28 | 28 | LL | #[test] |
| 29 | | ------- in this procedural macro expansion | |
| 29 | | ------- in this attribute macro expansion | |
| 30 | 30 | LL | fn bar() -> i32 { |
| 31 | 31 | | ^^^ the trait `Termination` is not implemented for `i32` |
| 32 | 32 | | |
tests/ui/traits/issue-91949-hangs-on-recursion.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //~ ERROR overflow evaluating the requirement `<std::iter::Empty<()> as Iterator>::Item == ()` |
| 2 | 2 | //@ build-fail |
| 3 | //@ compile-flags: -Zinline-mir=no | |
| 3 | //@ compile-flags: -Zinline-mir=no -Zwrite-long-types-to-disk=yes | |
| 4 | 4 | |
| 5 | 5 | // Regression test for #91949. |
| 6 | 6 | // This hanged *forever* on 1.56, fixed by #90423. |
tests/ui/traits/issue-91949-hangs-on-recursion.stderr+3-1| ... | ... | @@ -24,7 +24,9 @@ LL | impl<T, I: Iterator<Item = T>> Iterator for IteratorOfWrapped<T, I> { |
| 24 | 24 | | | |
| 25 | 25 | | unsatisfied trait bound introduced here |
| 26 | 26 | = note: 256 redundant requirements hidden |
| 27 | = note: required for `IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), std::iter::Empty<()>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48}>>` to implement `Iterator` | |
| 27 | = note: required for `IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<..., ...>>, ...>>` to implement `Iterator` | |
| 28 | = note: the full name for the type has been written to '$TEST_BUILD_DIR/issue-91949-hangs-on-recursion.long-type-$LONG_TYPE_HASH.txt' | |
| 29 | = note: consider using `--verbose` to print the full type name to the console | |
| 28 | 30 | |
| 29 | 31 | error: aborting due to 1 previous error; 1 warning emitted |
| 30 | 32 |
tests/ui/traits/well-formed-recursion-limit.stderr+4| ... | ... | @@ -3,12 +3,16 @@ error[E0609]: no field `ab` on type `(Box<(dyn Fn(Option<A>) -> Option<B> + 'sta |
| 3 | 3 | | |
| 4 | 4 | LL | let (ab, ba) = (i.ab, i.ba); |
| 5 | 5 | | ^^ unknown field |
| 6 | | | |
| 7 | = note: available fields are: `0`, `1` | |
| 6 | 8 | |
| 7 | 9 | error[E0609]: no field `ba` on type `(Box<(dyn Fn(Option<A>) -> Option<B> + 'static)>, Box<(dyn Fn(Option<B>) -> Option<A> + 'static)>)` |
| 8 | 10 | --> $DIR/well-formed-recursion-limit.rs:12:29 |
| 9 | 11 | | |
| 10 | 12 | LL | let (ab, ba) = (i.ab, i.ba); |
| 11 | 13 | | ^^ unknown field |
| 14 | | | |
| 15 | = note: available fields are: `0`, `1` | |
| 12 | 16 | |
| 13 | 17 | error[E0275]: overflow assigning `_` to `Option<_>` |
| 14 | 18 | --> $DIR/well-formed-recursion-limit.rs:15:33 |
tests/ui/tuple/index-invalid.stderr+6| ... | ... | @@ -3,18 +3,24 @@ error[E0609]: no field `1` on type `(((),),)` |
| 3 | 3 | | |
| 4 | 4 | LL | let _ = (((),),).1.0; |
| 5 | 5 | | ^ unknown field |
| 6 | | | |
| 7 | = note: available field is: `0` | |
| 6 | 8 | |
| 7 | 9 | error[E0609]: no field `1` on type `((),)` |
| 8 | 10 | --> $DIR/index-invalid.rs:4:24 |
| 9 | 11 | | |
| 10 | 12 | LL | let _ = (((),),).0.1; |
| 11 | 13 | | ^ unknown field |
| 14 | | | |
| 15 | = note: available field is: `0` | |
| 12 | 16 | |
| 13 | 17 | error[E0609]: no field `000` on type `(((),),)` |
| 14 | 18 | --> $DIR/index-invalid.rs:6:22 |
| 15 | 19 | | |
| 16 | 20 | LL | let _ = (((),),).000.000; |
| 17 | 21 | | ^^^ unknown field |
| 22 | | | |
| 23 | = note: available field is: `0` | |
| 18 | 24 | |
| 19 | 25 | error: aborting due to 3 previous errors |
| 20 | 26 |
tests/ui/tuple/missing-field-access.rs created+16| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | // Ensure that suggestions to search for missing intermediary field accesses are available for both | |
| 2 | // tuple structs *and* regular tuples. | |
| 3 | // Ensure that we do not suggest pinning the expression just because `Pin::get_ref` exists. | |
| 4 | // https://github.com/rust-lang/rust/issues/144602 | |
| 5 | use std::{fs::File, io::BufReader}; | |
| 6 | ||
| 7 | struct F(BufReader<File>); | |
| 8 | ||
| 9 | fn main() { | |
| 10 | let f = F(BufReader::new(File::open("x").unwrap())); | |
| 11 | let x = f.get_ref(); //~ ERROR E0599 | |
| 12 | //~^ HELP one of the expressions' fields has a method of the same name | |
| 13 | let f = (BufReader::new(File::open("x").unwrap()), ); | |
| 14 | let x = f.get_ref(); //~ ERROR E0599 | |
| 15 | //~^ HELP one of the expressions' fields has a method of the same name | |
| 16 | } |
tests/ui/tuple/missing-field-access.stderr created+28| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | error[E0599]: no method named `get_ref` found for struct `F` in the current scope | |
| 2 | --> $DIR/missing-field-access.rs:11:15 | |
| 3 | | | |
| 4 | LL | struct F(BufReader<File>); | |
| 5 | | -------- method `get_ref` not found for this struct | |
| 6 | ... | |
| 7 | LL | let x = f.get_ref(); | |
| 8 | | ^^^^^^^ method not found in `F` | |
| 9 | | | |
| 10 | help: one of the expressions' fields has a method of the same name | |
| 11 | | | |
| 12 | LL | let x = f.0.get_ref(); | |
| 13 | | ++ | |
| 14 | ||
| 15 | error[E0599]: no method named `get_ref` found for tuple `(BufReader<File>,)` in the current scope | |
| 16 | --> $DIR/missing-field-access.rs:14:15 | |
| 17 | | | |
| 18 | LL | let x = f.get_ref(); | |
| 19 | | ^^^^^^^ method not found in `(BufReader<File>,)` | |
| 20 | | | |
| 21 | help: one of the expressions' fields has a method of the same name | |
| 22 | | | |
| 23 | LL | let x = f.0.get_ref(); | |
| 24 | | ++ | |
| 25 | ||
| 26 | error: aborting due to 2 previous errors | |
| 27 | ||
| 28 | For more information about this error, try `rustc --explain E0599`. |
tests/ui/tuple/tuple-index-out-of-bounds.stderr+3-5| ... | ... | @@ -4,17 +4,15 @@ error[E0609]: no field `2` on type `Point` |
| 4 | 4 | LL | origin.2; |
| 5 | 5 | | ^ unknown field |
| 6 | 6 | | |
| 7 | help: a field with a similar name exists | |
| 8 | | | |
| 9 | LL - origin.2; | |
| 10 | LL + origin.0; | |
| 11 | | | |
| 7 | = note: available fields are: `0`, `1` | |
| 12 | 8 | |
| 13 | 9 | error[E0609]: no field `2` on type `({integer}, {integer})` |
| 14 | 10 | --> $DIR/tuple-index-out-of-bounds.rs:12:11 |
| 15 | 11 | | |
| 16 | 12 | LL | tuple.2; |
| 17 | 13 | | ^ unknown field |
| 14 | | | |
| 15 | = note: available fields are: `0`, `1` | |
| 18 | 16 | |
| 19 | 17 | error: aborting due to 2 previous errors |
| 20 | 18 |