rust/tests/ui/self
Matthias Krüger 3201fe9893
Rollup merge of #134524 - adetaylor:getref, r=compiler-errors
Arbitrary self types v2: no deshadow pre feature.

The arbitrary self types v2 work introduces a check for shadowed methods, whereby a method in some "outer" smart pointer type may called in preference to a method in the inner referent. This is bad if the outer pointer adds a method later, as it may change behavior, so we ensure we error in this circumstance.

It was intended that this new shadowing detection system only comes into play for users who enable the `arbitrary_self_types` feature (or of course everyone later if it's stabilized). It was believed that the new deshadowing code couldn't be reached without building the custom smart pointers that `arbitrary_self_types` enables, and therefore there was no risk of this code impacting existing users.

However, it turns out that cunning use of `Pin::get_ref` can cause this type of shadowing error to be emitted now. This commit adds a test for this case.

As we want this test to pass without arbitrary_self_types, but fail with it, I've split it into two files (one with run-pass and one without). If there's a better way I can amend it.

Part of #44874

r? ```@wesleywiser```
2024-12-21 01:30:16 +01:00
..
auxiliary
elision Bless ui tests. 2024-10-04 23:38:41 +00:00
arbitrary_self_type_mut_difference.rs
arbitrary_self_type_mut_difference.stderr Deduplicate some logic and reword output 2024-02-22 18:05:28 +00:00
arbitrary_self_types_by_value_reborrow.rs Arbitrary self types v2: detect shadowing problems. 2024-12-11 11:59:13 +00:00
arbitrary_self_types_generic_over_receiver.rs Arbitrary self types v2: use Receiver trait 2024-12-11 11:59:12 +00:00
arbitrary_self_types_generic_over_receiver.stderr Arbitrary self types v2: use Receiver trait 2024-12-11 11:59:12 +00:00
arbitrary_self_types_generic_receiver.rs Arbitrary self types v2: generics test. 2024-12-11 11:59:13 +00:00
arbitrary_self_types_generic_receiver.stderr Arbitrary self types v2: generics test. 2024-12-11 11:59:13 +00:00
arbitrary_self_types_lifetime_elision.rs Arbitrary self types v2: use Receiver trait 2024-12-11 11:59:12 +00:00
arbitrary_self_types_needing_box_or_arc_wrapping.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
arbitrary_self_types_needing_box_or_arc_wrapping.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
arbitrary_self_types_needing_box_or_arc_wrapping.stderr
arbitrary_self_types_needing_mut_pin.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
arbitrary_self_types_needing_mut_pin.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
arbitrary_self_types_needing_mut_pin.stderr
arbitrary_self_types_nested.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
arbitrary_self_types_niche_deshadowing.rs Arbitrary self types v2: niche deshadowing test 2024-12-19 12:02:08 +00:00
arbitrary_self_types_no_generics.rs Arbitrary self types v2: use Receiver trait 2024-12-11 11:59:12 +00:00
arbitrary_self_types_nonnull.rs Arbitrary self types v2: Weak, NonNull hints 2024-12-14 20:27:15 +00:00
arbitrary_self_types_nonnull.stderr Arbitrary self types v2: Weak, NonNull hints 2024-12-14 20:27:15 +00:00
arbitrary_self_types_not_allow_call_with_no_deref.rs Arbitrary self types v2: use Receiver trait 2024-12-11 11:59:12 +00:00
arbitrary_self_types_not_allow_call_with_no_deref.stderr Arbitrary self types v2: use Receiver trait 2024-12-11 11:59:12 +00:00
arbitrary_self_types_pin_getref.feature.stderr Arbitrary self types v2: no deshadow pre feature. 2024-12-20 12:29:00 +00:00
arbitrary_self_types_pin_getref.rs Arbitrary self types v2: no deshadow pre feature. 2024-12-20 12:29:00 +00:00
arbitrary_self_types_pin_lifetime_impl_trait-async.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
arbitrary_self_types_pin_lifetime_impl_trait-async.stderr Bless test fallout 2024-08-17 12:43:25 -04:00
arbitrary_self_types_pin_lifetime_impl_trait.rs
arbitrary_self_types_pin_lifetime_impl_trait.stderr Bless test fallout 2024-08-17 12:43:25 -04:00
arbitrary_self_types_pin_lifetime_mismatch-async.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
arbitrary_self_types_pin_lifetime_mismatch-async.stderr Bless ui tests. 2024-10-04 23:38:41 +00:00
arbitrary_self_types_pin_lifetime_mismatch.rs Run rustfmt on modified tests 2024-05-17 20:31:13 +00:00
arbitrary_self_types_pin_lifetime_mismatch.stderr Detect when a lifetime is being reused in suggestion 2024-05-17 21:23:47 +00:00
arbitrary_self_types_pin_lifetime-async.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
arbitrary_self_types_pin_lifetime.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
arbitrary_self_types_pin_needing_borrow.rs
arbitrary_self_types_pin_needing_borrow.stderr
arbitrary_self_types_pointers_and_wrappers.rs UI tests: Rename "object safe" to "dyn compatible" 2024-10-10 01:13:29 +02:00
arbitrary_self_types_raw_pointer_struct.rs Arbitrary self types v2: pointers feature gate. 2024-08-27 17:32:35 +00:00
arbitrary_self_types_raw_pointer_trait.rs Arbitrary self types v2: pointers feature gate. 2024-08-27 17:32:35 +00:00
arbitrary_self_types_recursive_receiver.rs Arbitrary self types v2: use Receiver trait 2024-12-11 11:59:12 +00:00
arbitrary_self_types_shadowing_val_constptr.rs Arbitrary self types v2: detect shadowing problems. 2024-12-11 11:59:13 +00:00
arbitrary_self_types_silly.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
arbitrary_self_types_stdlib_pointers.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
arbitrary_self_types_struct_receiver_trait.rs Arbitrary self types v2: use Receiver trait 2024-12-11 11:59:12 +00:00
arbitrary_self_types_struct.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
arbitrary_self_types_trait_receiver_trait.rs Arbitrary self types v2: use Receiver trait 2024-12-11 11:59:12 +00:00
arbitrary_self_types_trait.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
arbitrary_self_types_unshadowing_ptrs.rs Arbitrary self types v2: detect shadowing problems. 2024-12-11 11:59:13 +00:00
arbitrary_self_types_unshadowing_ptrs.stderr Arbitrary self types v2: detect shadowing problems. 2024-12-11 11:59:13 +00:00
arbitrary_self_types_unshadowing.rs Arbitrary self types v2: detect shadowing problems. 2024-12-11 11:59:13 +00:00
arbitrary_self_types_unshadowing.stderr Arbitrary self types v2: detect shadowing problems. 2024-12-11 11:59:13 +00:00
arbitrary_self_types_unsized_struct.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
arbitrary_self_types_weak.rs Arbitrary self types v2: Weak, NonNull hints 2024-12-14 20:27:15 +00:00
arbitrary_self_types_weak.stderr Arbitrary self types v2: Weak, NonNull hints 2024-12-14 20:27:15 +00:00
arbitrary-self-from-method-substs-ice.rs Constify Deref and DerefMut 2024-11-24 00:19:47 +00:00
arbitrary-self-from-method-substs-ice.stderr fix ICE on type error in promoted 2024-12-09 15:17:26 +01:00
arbitrary-self-from-method-substs-with-receiver.rs Arbitrary self types v2: use Receiver trait 2024-12-11 11:59:12 +00:00
arbitrary-self-from-method-substs-with-receiver.stderr Arbitrary self types v2: use Receiver trait 2024-12-11 11:59:12 +00:00
arbitrary-self-from-method-substs.default.stderr Arbitrary self types v2: use Receiver trait 2024-12-11 11:59:12 +00:00
arbitrary-self-from-method-substs.feature.stderr Reject generic self types. 2024-10-30 10:48:08 +00:00
arbitrary-self-from-method-substs.rs Reject generic self types. 2024-10-30 10:48:08 +00:00
arbitrary-self-opaque.rs Avoid opaque type not constrained errors in the presence of other errors 2024-12-04 10:16:04 +00:00
arbitrary-self-opaque.stderr Arbitrary self types v2: adjust diagnostic. 2024-12-13 15:40:37 +00:00
arbitrary-self-types-dyn-incompatible.curr.stderr UI tests: Rename "object safe" to "dyn compatible" 2024-10-10 01:13:29 +02:00
arbitrary-self-types-dyn-incompatible.dyn_compatible_for_dispatch.stderr UI tests: Rename "object safe" to "dyn compatible" 2024-10-10 01:13:29 +02:00
arbitrary-self-types-dyn-incompatible.rs UI tests: Rename "object safe" to "dyn compatible" 2024-10-10 01:13:29 +02:00
builtin-superkinds-self-type.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
by-value-self-in-mut-slot.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
class-missing-self.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
class-missing-self.stderr
conflicting_inner2.rs Arbitrary self types v2: detect shadowing problems. 2024-12-11 11:59:13 +00:00
conflicting_inner.rs Arbitrary self types v2: detect shadowing problems. 2024-12-11 11:59:13 +00:00
dyn-compatibility-sized-self-by-value-self.rs UI tests: Rename "object safe" to "dyn compatible" 2024-10-10 01:13:29 +02:00
dyn-compatibility-sized-self-generic-method.rs UI tests: Rename "object safe" to "dyn compatible" 2024-10-10 01:13:29 +02:00
dyn-compatibility-sized-self-return-Self.rs UI tests: Rename "object safe" to "dyn compatible" 2024-10-10 01:13:29 +02:00
explicit_self_xcrate_exe.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
explicit-self-closures.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
explicit-self-generic.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
explicit-self-objects-uniq.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
explicit-self.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-61882-2.rs
issue-61882-2.stderr
issue-61882.rs
issue-61882.stderr
move-self.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
objects-owned-object-owned-method.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
point-at-arbitrary-self-type-method.rs
point-at-arbitrary-self-type-method.stderr
point-at-arbitrary-self-type-trait-method.rs
point-at-arbitrary-self-type-trait-method.stderr
self_lifetime-async.rs elided_named_lifetimes: bless & add tests 2024-08-31 15:35:42 +03:00
self_lifetime-async.stderr elided_named_lifetimes: bless & add tests 2024-08-31 15:35:42 +03:00
self_lifetime.rs elided_named_lifetimes: bless & add tests 2024-08-31 15:35:42 +03:00
self_lifetime.stderr elided_named_lifetimes: bless & add tests 2024-08-31 15:35:42 +03:00
self_type_keyword-2.rs
self_type_keyword-2.stderr
self_type_keyword.rs
self_type_keyword.stderr Deny keyword lifetimes pre-expansion 2024-07-16 12:06:25 -04:00
self-ctor-nongeneric.rs Warn/error on self ctor from outer item in inner item 2024-05-18 13:08:34 -04:00
self-ctor-nongeneric.stderr Warn/error on self ctor from outer item in inner item 2024-05-18 13:08:34 -04:00
self-ctor.rs Warn/error on self ctor from outer item in inner item 2024-05-18 13:08:34 -04:00
self-ctor.stderr Warn/error on self ctor from outer item in inner item 2024-05-18 13:08:34 -04:00
self-impl-2.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
self-impl.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
self-impl.stderr
self-in-mut-slot-default-method.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
self-in-mut-slot-immediate-value.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
self-in-typedefs.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
self-infer.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
self-infer.stderr
self-re-assign.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
self-shadowing-import.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
self-type-param.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
self-vs-path-ambiguity.rs
self-vs-path-ambiguity.stderr Make parse error suggestions verbose and fix spans 2024-07-12 03:02:57 +00:00
string-self-append.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
suggest-self-2.rs
suggest-self-2.stderr
suggest-self.rs
suggest-self.stderr
ufcs-explicit-self.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
uniq-self-in-mut-slot.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
where-for-self.rs Update tests for hidden references to mutable static 2024-09-13 14:10:56 +03:00