diff --git a/compiler/rustc_codegen_cranelift/example/arbitrary_self_types_pointers_and_wrappers.rs b/compiler/rustc_codegen_cranelift/example/arbitrary_self_types_pointers_and_wrappers.rs index 5479b0c617bfb..dddb08faa7c6e 100644 --- a/compiler/rustc_codegen_cranelift/example/arbitrary_self_types_pointers_and_wrappers.rs +++ b/compiler/rustc_codegen_cranelift/example/arbitrary_self_types_pointers_and_wrappers.rs @@ -1,6 +1,6 @@ // Adapted from rustc run-pass test suite -#![feature(arbitrary_self_types, unsize, coerce_unsized, dispatch_from_dyn)] +#![feature(unsize, coerce_unsized, dispatch_from_dyn)] use std::marker::Unsize; use std::ops::{CoerceUnsized, Deref, DispatchFromDyn}; diff --git a/compiler/rustc_codegen_cranelift/example/mini_core.rs b/compiler/rustc_codegen_cranelift/example/mini_core.rs index 72c9df59d833f..131d901192d84 100644 --- a/compiler/rustc_codegen_cranelift/example/mini_core.rs +++ b/compiler/rustc_codegen_cranelift/example/mini_core.rs @@ -47,13 +47,6 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<*const U> for *const T {} impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<*mut U> for *mut T {} impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U>> for Box<T> {} -#[lang = "legacy_receiver"] -pub trait LegacyReceiver {} - -impl<T: ?Sized> LegacyReceiver for &T {} -impl<T: ?Sized> LegacyReceiver for &mut T {} -impl<T: ?Sized> LegacyReceiver for Box<T> {} - #[lang = "copy"] pub trait Copy {} diff --git a/compiler/rustc_codegen_gcc/example/arbitrary_self_types_pointers_and_wrappers.rs b/compiler/rustc_codegen_gcc/example/arbitrary_self_types_pointers_and_wrappers.rs index b299aa879740a..04ac235bc59eb 100644 --- a/compiler/rustc_codegen_gcc/example/arbitrary_self_types_pointers_and_wrappers.rs +++ b/compiler/rustc_codegen_gcc/example/arbitrary_self_types_pointers_and_wrappers.rs @@ -1,6 +1,6 @@ // Adapted from rustc run-pass test suite -#![feature(arbitrary_self_types, unsize, coerce_unsized, dispatch_from_dyn)] +#![feature(unsize, coerce_unsized, dispatch_from_dyn)] #![feature(rustc_attrs)] #![allow(internal_features)] diff --git a/compiler/rustc_codegen_gcc/example/mini_core.rs b/compiler/rustc_codegen_gcc/example/mini_core.rs index 3dad35bc4ce47..ea33467d0af6b 100644 --- a/compiler/rustc_codegen_gcc/example/mini_core.rs +++ b/compiler/rustc_codegen_gcc/example/mini_core.rs @@ -44,13 +44,6 @@ impl<T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<*const U> for *const T {} impl<T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<*mut U> for *mut T {} impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U, ()>> for Box<T, ()> {} -#[lang = "legacy_receiver"] -pub trait LegacyReceiver {} - -impl<T: ?Sized> LegacyReceiver for &T {} -impl<T: ?Sized> LegacyReceiver for &mut T {} -impl<T: ?Sized, A: Allocator> LegacyReceiver for Box<T, A> {} - #[lang = "copy"] pub trait Copy {} diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index d50fe8c6a3e6b..fbc68261e51f6 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -60,6 +60,8 @@ declare_features! ( (accepted, adx_target_feature, "1.61.0", Some(44839)), /// Allows explicit discriminants on non-unit enum variants. (accepted, arbitrary_enum_discriminant, "1.66.0", Some(60553)), + /// Allows inherent and trait methods with arbitrary self types. + (accepted, arbitrary_self_types, "CURRENT_RUSTC_VERSION", Some(44874)), /// Allows using `const` operands in inline assembly. (accepted, asm_const, "1.82.0", Some(93332)), /// Allows using `sym` operands in inline assembly. diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index c6e992573d6f3..092036c486c9d 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -364,8 +364,6 @@ declare_features! ( (unstable, adt_const_params, "1.56.0", Some(95174)), /// Allows defining an `#[alloc_error_handler]`. (unstable, alloc_error_handler, "1.29.0", Some(51540)), - /// Allows inherent and trait methods with arbitrary self types. - (unstable, arbitrary_self_types, "1.23.0", Some(44874)), /// Allows inherent and trait methods with arbitrary self types that are raw pointers. (unstable, arbitrary_self_types_pointers, "1.83.0", Some(44874)), /// Enables experimental inline assembly support for additional architectures. diff --git a/compiler/rustc_hir/src/lang_items.rs b/compiler/rustc_hir/src/lang_items.rs index c3b14a4e06c79..b78ae142879df 100644 --- a/compiler/rustc_hir/src/lang_items.rs +++ b/compiler/rustc_hir/src/lang_items.rs @@ -242,7 +242,6 @@ language_item_table! { DerefTarget, sym::deref_target, deref_target, Target::AssocTy, GenericRequirement::None; Receiver, sym::receiver, receiver_trait, Target::Trait, GenericRequirement::None; ReceiverTarget, sym::receiver_target, receiver_target, Target::AssocTy, GenericRequirement::None; - LegacyReceiver, sym::legacy_receiver, legacy_receiver_trait, Target::Trait, GenericRequirement::None; Fn, kw::Fn, fn_trait, Target::Trait, GenericRequirement::Exact(1); FnMut, sym::fn_mut, fn_mut_trait, Target::Trait, GenericRequirement::Exact(1); diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl index 935f4de6c58c8..7cee8e56ff565 100644 --- a/compiler/rustc_hir_analysis/messages.ftl +++ b/compiler/rustc_hir_analysis/messages.ftl @@ -256,18 +256,12 @@ hir_analysis_invalid_receiver_ty = invalid `self` parameter type: `{$receiver_ty hir_analysis_invalid_receiver_ty_help = consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` -hir_analysis_invalid_receiver_ty_help_no_arbitrary_self_types = - consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) - hir_analysis_invalid_receiver_ty_help_nonnull_note = `NonNull` does not implement `Receiver` because it has methods that may shadow the referent; consider wrapping your `NonNull` in a newtype wrapper for which you implement `Receiver` hir_analysis_invalid_receiver_ty_help_weak_note = `Weak` does not implement `Receiver` because it has methods that may shadow the referent; consider wrapping your `Weak` in a newtype wrapper for which you implement `Receiver` -hir_analysis_invalid_receiver_ty_no_arbitrary_self_types = invalid `self` parameter type: `{$receiver_ty}` - .note = type of `self` must be `Self` or a type that dereferences to it - hir_analysis_invalid_union_field = field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union .note = union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index a400aaa814279..6b6560f018086 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -29,7 +29,6 @@ use rustc_trait_selection::regions::{InferCtxtRegionExt, OutlivesEnvironmentBuil use rustc_trait_selection::traits::misc::{ ConstParamTyImplementationError, type_allowed_to_implement_const_param_ty, }; -use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _; use rustc_trait_selection::traits::{ self, FulfillmentError, Obligation, ObligationCause, ObligationCauseCode, ObligationCtxt, WellFormedLoc, @@ -1698,13 +1697,6 @@ fn check_sized_if_body<'tcx>( } } -/// The `arbitrary_self_types_pointers` feature implies `arbitrary_self_types`. -#[derive(Clone, Copy, PartialEq)] -enum ArbitrarySelfTypesLevel { - Basic, // just arbitrary_self_types - WithPointers, // both arbitrary_self_types and arbitrary_self_types_pointers -} - #[instrument(level = "debug", skip(wfcx))] fn check_method_receiver<'tcx>( wfcx: &WfCheckingCtxt<'_, 'tcx>, @@ -1737,55 +1729,21 @@ fn check_method_receiver<'tcx>( return Ok(()); } - let arbitrary_self_types_level = if tcx.features().arbitrary_self_types_pointers() { - Some(ArbitrarySelfTypesLevel::WithPointers) - } else if tcx.features().arbitrary_self_types() { - Some(ArbitrarySelfTypesLevel::Basic) - } else { - None - }; let generics = tcx.generics_of(method.def_id); - let receiver_validity = - receiver_is_valid(wfcx, span, receiver_ty, self_ty, arbitrary_self_types_level, generics); + let arbitrary_self_types_pointers_enabled = tcx.features().arbitrary_self_types_pointers(); + let receiver_validity = receiver_is_valid( + wfcx, + span, + receiver_ty, + self_ty, + arbitrary_self_types_pointers_enabled, + generics, + ); if let Err(receiver_validity_err) = receiver_validity { - return Err(match arbitrary_self_types_level { - // Wherever possible, emit a message advising folks that the features - // `arbitrary_self_types` or `arbitrary_self_types_pointers` might - // have helped. - None if receiver_is_valid( - wfcx, - span, - receiver_ty, - self_ty, - Some(ArbitrarySelfTypesLevel::Basic), - generics, - ) - .is_ok() => - { - // Report error; would have worked with `arbitrary_self_types`. - feature_err( - &tcx.sess, - sym::arbitrary_self_types, - span, - format!( - "`{receiver_ty}` cannot be used as the type of `self` without \ - the `arbitrary_self_types` feature", - ), - ) - .with_help(fluent::hir_analysis_invalid_receiver_ty_help) - .emit() - } - None | Some(ArbitrarySelfTypesLevel::Basic) - if receiver_is_valid( - wfcx, - span, - receiver_ty, - self_ty, - Some(ArbitrarySelfTypesLevel::WithPointers), - generics, - ) - .is_ok() => + return Err( + if !arbitrary_self_types_pointers_enabled + && receiver_is_valid(wfcx, span, receiver_ty, self_ty, true, generics).is_ok() { // Report error; would have worked with `arbitrary_self_types_pointers`. feature_err( @@ -1794,17 +1752,15 @@ fn check_method_receiver<'tcx>( span, format!( "`{receiver_ty}` cannot be used as the type of `self` without \ - the `arbitrary_self_types_pointers` feature", + the `arbitrary_self_types_pointers` feature", ), ) .with_help(fluent::hir_analysis_invalid_receiver_ty_help) .emit() - } - _ => - // Report error; would not have worked with `arbitrary_self_types[_pointers]`. - { + } else { + // Report error; would not have worked with `arbitrary_self_types_pointers`. match receiver_validity_err { - ReceiverValidityError::DoesNotDeref if arbitrary_self_types_level.is_some() => { + ReceiverValidityError::DoesNotDeref => { let hint = match receiver_ty .builtin_deref(false) .unwrap_or(receiver_ty) @@ -1818,18 +1774,12 @@ fn check_method_receiver<'tcx>( tcx.dcx().emit_err(errors::InvalidReceiverTy { span, receiver_ty, hint }) } - ReceiverValidityError::DoesNotDeref => { - tcx.dcx().emit_err(errors::InvalidReceiverTyNoArbitrarySelfTypes { - span, - receiver_ty, - }) - } ReceiverValidityError::MethodGenericParamUsed => { tcx.dcx().emit_err(errors::InvalidGenericReceiverTy { span, receiver_ty }) } } - } - }); + }, + ); } Ok(()) } @@ -1873,11 +1823,10 @@ fn receiver_is_valid<'tcx>( span: Span, receiver_ty: Ty<'tcx>, self_ty: Ty<'tcx>, - arbitrary_self_types_enabled: Option<ArbitrarySelfTypesLevel>, + arbitrary_self_types_pointers_enabled: bool, method_generics: &ty::Generics, ) -> Result<(), ReceiverValidityError> { let infcx = wfcx.infcx; - let tcx = wfcx.tcx(); let cause = ObligationCause::new(span, wfcx.body_def_id, traits::ObligationCauseCode::MethodReceiver); @@ -1892,17 +1841,11 @@ fn receiver_is_valid<'tcx>( confirm_type_is_not_a_method_generic_param(receiver_ty, method_generics)?; - let mut autoderef = Autoderef::new(infcx, wfcx.param_env, wfcx.body_def_id, span, receiver_ty); - - // The `arbitrary_self_types` feature allows custom smart pointer - // types to be method receivers, as identified by following the Receiver<Target=T> - // chain. - if arbitrary_self_types_enabled.is_some() { - autoderef = autoderef.use_receiver_trait(); - } + let mut autoderef = Autoderef::new(infcx, wfcx.param_env, wfcx.body_def_id, span, receiver_ty) + .use_receiver_trait(); // The `arbitrary_self_types_pointers` feature allows raw pointer receivers like `self: *const Self`. - if arbitrary_self_types_enabled == Some(ArbitrarySelfTypesLevel::WithPointers) { + if arbitrary_self_types_pointers_enabled { autoderef = autoderef.include_raw_pointers(); } @@ -1925,58 +1868,12 @@ fn receiver_is_valid<'tcx>( wfcx.register_obligations(autoderef.into_obligations()); return Ok(()); } - - // Without `feature(arbitrary_self_types)`, we require that each step in the - // deref chain implement `LegacyReceiver`. - if arbitrary_self_types_enabled.is_none() { - let legacy_receiver_trait_def_id = - tcx.require_lang_item(LangItem::LegacyReceiver, Some(span)); - if !legacy_receiver_is_implemented( - wfcx, - legacy_receiver_trait_def_id, - cause.clone(), - potential_self_ty, - ) { - // We cannot proceed. - break; - } - - // Register the bound, in case it has any region side-effects. - wfcx.register_bound( - cause.clone(), - wfcx.param_env, - potential_self_ty, - legacy_receiver_trait_def_id, - ); - } } debug!("receiver_is_valid: type `{:?}` does not deref to `{:?}`", receiver_ty, self_ty); Err(ReceiverValidityError::DoesNotDeref) } -fn legacy_receiver_is_implemented<'tcx>( - wfcx: &WfCheckingCtxt<'_, 'tcx>, - legacy_receiver_trait_def_id: DefId, - cause: ObligationCause<'tcx>, - receiver_ty: Ty<'tcx>, -) -> bool { - let tcx = wfcx.tcx(); - let trait_ref = ty::TraitRef::new(tcx, legacy_receiver_trait_def_id, [receiver_ty]); - - let obligation = Obligation::new(tcx, cause, wfcx.param_env, trait_ref); - - if wfcx.infcx.predicate_must_hold_modulo_regions(&obligation) { - true - } else { - debug!( - "receiver_is_implemented: type `{:?}` does not implement `LegacyReceiver` trait", - receiver_ty - ); - false - } -} - fn check_variances_for_type_defn<'tcx>( tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>, diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index 4c6c2504126a8..f13e843ce81ef 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -1610,16 +1610,6 @@ pub(crate) enum InvalidReceiverTyHint { NonNull, } -#[derive(Diagnostic)] -#[diag(hir_analysis_invalid_receiver_ty_no_arbitrary_self_types, code = E0307)] -#[note] -#[help(hir_analysis_invalid_receiver_ty_help_no_arbitrary_self_types)] -pub(crate) struct InvalidReceiverTyNoArbitrarySelfTypes<'tcx> { - #[primary_span] - pub span: Span, - pub receiver_ty: Ty<'tcx>, -} - #[derive(Diagnostic)] #[diag(hir_analysis_invalid_receiver_ty, code = E0307)] #[note] diff --git a/compiler/rustc_hir_typeck/src/method/confirm.rs b/compiler/rustc_hir_typeck/src/method/confirm.rs index 0483164ca0300..08d2708bc5067 100644 --- a/compiler/rustc_hir_typeck/src/method/confirm.rs +++ b/compiler/rustc_hir_typeck/src/method/confirm.rs @@ -352,15 +352,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { // yield an object-type (e.g., `&Object` or `Box<Object>` // etc). - let mut autoderef = self.fcx.autoderef(self.span, self_ty); - - // We don't need to gate this behind arbitrary self types - // per se, but it does make things a bit more gated. - if self.tcx.features().arbitrary_self_types() - || self.tcx.features().arbitrary_self_types_pointers() - { - autoderef = autoderef.use_receiver_trait(); - } + let autoderef = self.fcx.autoderef(self.span, self_ty).use_receiver_trait(); autoderef .include_raw_pointers() @@ -540,24 +532,9 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { self.register_predicates(obligations); } Err(terr) => { - if self.tcx.features().arbitrary_self_types() { - self.err_ctxt() - .report_mismatched_types( - &cause, - self.param_env, - method_self_ty, - self_ty, - terr, - ) - .emit(); - } else { - // This has/will have errored in wfcheck, which we cannot depend on from here, as typeck on functions - // may run before wfcheck if the function is used in const eval. - self.dcx().span_delayed_bug( - cause.span, - format!("{self_ty} was a subtype of {method_self_ty} but now is not?"), - ); - } + self.err_ctxt() + .report_mismatched_types(&cause, self.param_env, method_self_ty, self_ty, terr) + .emit(); } } } diff --git a/compiler/rustc_hir_typeck/src/method/probe.rs b/compiler/rustc_hir_typeck/src/method/probe.rs index f87e5b5202ab5..2b18f53a12e2e 100644 --- a/compiler/rustc_hir_typeck/src/method/probe.rs +++ b/compiler/rustc_hir_typeck/src/method/probe.rs @@ -479,7 +479,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let guar = match *ty.kind() { ty::Infer(ty::TyVar(_)) => { let raw_ptr_call = bad_ty.reached_raw_pointer - && !self.tcx.features().arbitrary_self_types(); + && !self.tcx.features().arbitrary_self_types_pointers(); let mut err = self.err_ctxt().emit_inference_failure_err( self.body_id, span, @@ -565,73 +565,39 @@ fn method_autoderef_steps<'tcx>( let (ref infcx, goal, inference_vars) = tcx.infer_ctxt().build_with_canonical(DUMMY_SP, &goal); let ParamEnvAnd { param_env, value: self_ty } = goal; - // If arbitrary self types is not enabled, we follow the chain of - // `Deref<Target=T>`. If arbitrary self types is enabled, we instead - // follow the chain of `Receiver<Target=T>`, but we also record whether - // such types are reachable by following the (potentially shorter) - // chain of `Deref<Target=T>`. We will use the first list when finding - // potentially relevant function implementations (e.g. relevant impl blocks) - // but the second list when determining types that the receiver may be - // converted to, in order to find out which of those methods might actually - // be callable. let mut autoderef_via_deref = Autoderef::new(infcx, param_env, hir::def_id::CRATE_DEF_ID, DUMMY_SP, self_ty) .include_raw_pointers() .silence_errors(); + let mut autoderef_via_receiver = + Autoderef::new(infcx, param_env, hir::def_id::CRATE_DEF_ID, DUMMY_SP, self_ty) + .include_raw_pointers() + .use_receiver_trait() + .silence_errors(); + let mut reached_raw_pointer = false; - let arbitrary_self_types_enabled = - tcx.features().arbitrary_self_types() || tcx.features().arbitrary_self_types_pointers(); - let (mut steps, reached_recursion_limit): (Vec<_>, bool) = if arbitrary_self_types_enabled { - let reachable_via_deref = - autoderef_via_deref.by_ref().map(|_| true).chain(std::iter::repeat(false)); - - let mut autoderef_via_receiver = - Autoderef::new(infcx, param_env, hir::def_id::CRATE_DEF_ID, DUMMY_SP, self_ty) - .include_raw_pointers() - .use_receiver_trait() - .silence_errors(); - let steps = autoderef_via_receiver - .by_ref() - .zip(reachable_via_deref) - .map(|((ty, d), reachable_via_deref)| { - let step = CandidateStep { - self_ty: infcx - .make_query_response_ignoring_pending_obligations(inference_vars, ty), - autoderefs: d, - from_unsafe_deref: reached_raw_pointer, - unsize: false, - reachable_via_deref, - }; - if ty.is_raw_ptr() { - // all the subsequent steps will be from_unsafe_deref - reached_raw_pointer = true; - } - step - }) - .collect(); - (steps, autoderef_via_receiver.reached_recursion_limit()) - } else { - let steps = autoderef_via_deref - .by_ref() - .map(|(ty, d)| { - let step = CandidateStep { - self_ty: infcx - .make_query_response_ignoring_pending_obligations(inference_vars, ty), - autoderefs: d, - from_unsafe_deref: reached_raw_pointer, - unsize: false, - reachable_via_deref: true, - }; - if ty.is_raw_ptr() { - // all the subsequent steps will be from_unsafe_deref - reached_raw_pointer = true; - } - step - }) - .collect(); - (steps, autoderef_via_deref.reached_recursion_limit()) - }; + let reachable_via_deref = + autoderef_via_deref.by_ref().map(|_| true).chain(std::iter::repeat(false)); + let mut steps: Vec<_> = autoderef_via_receiver + .by_ref() + .zip(reachable_via_deref) + .map(|((ty, d), reachable_via_deref)| { + let step = CandidateStep { + self_ty: infcx.make_query_response_ignoring_pending_obligations(inference_vars, ty), + autoderefs: d, + from_unsafe_deref: reached_raw_pointer, + unsize: false, + reachable_via_deref, + }; + if ty.is_raw_ptr() { + // all the subsequent steps will be from_unsafe_deref + reached_raw_pointer = true; + } + step + }) + .collect(); + let final_ty = autoderef_via_deref.final_ty(true); let opt_bad_ty = match final_ty.kind() { ty::Infer(ty::TyVar(_)) | ty::Error(_) => Some(MethodAutoderefBadTy { @@ -664,7 +630,7 @@ fn method_autoderef_steps<'tcx>( MethodAutoderefStepsResult { steps: tcx.arena.alloc_from_iter(steps), opt_bad_ty: opt_bad_ty.map(|ty| &*tcx.arena.alloc(ty)), - reached_recursion_limit, + reached_recursion_limit: autoderef_via_receiver.reached_recursion_limit(), } } @@ -1333,15 +1299,6 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { mutbl: hir::Mutability, track_unstable_candidates: bool, ) -> Result<(), MethodError<'tcx>> { - // The errors emitted by this function are part of - // the arbitrary self types work, and should not impact - // other users. - if !self.tcx.features().arbitrary_self_types() - && !self.tcx.features().arbitrary_self_types_pointers() - { - return Ok(()); - } - // We don't want to remember any of the diagnostic hints from this // shadow search, but we do need to provide Some/None for the // unstable_candidates in order to reflect the behavior of the diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs index 9b19ab74edfd5..c4393b10056da 100644 --- a/library/alloc/src/boxed.rs +++ b/library/alloc/src/boxed.rs @@ -193,9 +193,11 @@ use core::future::Future; use core::hash::{Hash, Hasher}; use core::marker::{PointerLike, Tuple, Unsize}; use core::mem::{self, SizedTypeProperties}; +#[cfg(bootstrap)] +use core::ops::LegacyReceiver; use core::ops::{ AsyncFn, AsyncFnMut, AsyncFnOnce, CoerceUnsized, Coroutine, CoroutineState, Deref, DerefMut, - DerefPure, DispatchFromDyn, LegacyReceiver, + DerefPure, DispatchFromDyn, }; use core::pin::{Pin, PinCoerceUnsized}; use core::ptr::{self, NonNull, Unique}; @@ -1959,6 +1961,7 @@ impl<T: ?Sized, A: Allocator> DerefMut for Box<T, A> { #[unstable(feature = "deref_pure_trait", issue = "87121")] unsafe impl<T: ?Sized, A: Allocator> DerefPure for Box<T, A> {} +#[cfg(bootstrap)] #[unstable(feature = "legacy_receiver_trait", issue = "none")] impl<T: ?Sized, A: Allocator> LegacyReceiver for Box<T, A> {} diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index cb93100f56cf0..c3058e33c75ac 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -125,7 +125,6 @@ #![feature(iter_advance_by)] #![feature(iter_next_chunk)] #![feature(layout_for_ptr)] -#![feature(legacy_receiver_trait)] #![feature(local_waker)] #![feature(maybe_uninit_slice)] #![feature(maybe_uninit_uninit_array_transpose)] @@ -159,6 +158,7 @@ // // Language features: // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(legacy_receiver_trait))] #![cfg_attr(not(test), feature(coroutine_trait))] #![cfg_attr(test, feature(panic_update_hook))] #![cfg_attr(test, feature(test))] diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs index 09206c2f8b290..9086500b4bb2a 100644 --- a/library/alloc/src/rc.rs +++ b/library/alloc/src/rc.rs @@ -253,7 +253,9 @@ use core::iter; use core::marker::{PhantomData, Unsize}; use core::mem::{self, ManuallyDrop, align_of_val_raw}; use core::num::NonZeroUsize; -use core::ops::{CoerceUnsized, Deref, DerefMut, DerefPure, DispatchFromDyn, LegacyReceiver}; +#[cfg(bootstrap)] +use core::ops::LegacyReceiver; +use core::ops::{CoerceUnsized, Deref, DerefMut, DerefPure, DispatchFromDyn}; use core::panic::{RefUnwindSafe, UnwindSafe}; #[cfg(not(no_global_oom_handling))] use core::pin::Pin; @@ -2267,6 +2269,7 @@ unsafe impl<T: ?Sized, A: Allocator> DerefPure for Rc<T, A> {} #[unstable(feature = "deref_pure_trait", issue = "87121")] unsafe impl<T: ?Sized, A: Allocator> DerefPure for UniqueRc<T, A> {} +#[cfg(bootstrap)] #[unstable(feature = "legacy_receiver_trait", issue = "none")] impl<T: ?Sized> LegacyReceiver for Rc<T> {} diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs index 1956dda538816..d03f6e6cd545e 100644 --- a/library/alloc/src/sync.rs +++ b/library/alloc/src/sync.rs @@ -19,7 +19,9 @@ use core::iter; use core::marker::{PhantomData, Unsize}; use core::mem::{self, ManuallyDrop, align_of_val_raw}; use core::num::NonZeroUsize; -use core::ops::{CoerceUnsized, Deref, DerefPure, DispatchFromDyn, LegacyReceiver}; +#[cfg(bootstrap)] +use core::ops::LegacyReceiver; +use core::ops::{CoerceUnsized, Deref, DerefPure, DispatchFromDyn}; use core::panic::{RefUnwindSafe, UnwindSafe}; use core::pin::{Pin, PinCoerceUnsized}; use core::ptr::{self, NonNull}; @@ -2216,6 +2218,7 @@ unsafe impl<T: ?Sized, A: Allocator> PinCoerceUnsized for Weak<T, A> {} #[unstable(feature = "deref_pure_trait", issue = "87121")] unsafe impl<T: ?Sized, A: Allocator> DerefPure for Arc<T, A> {} +#[cfg(bootstrap)] #[unstable(feature = "legacy_receiver_trait", issue = "none")] impl<T: ?Sized> LegacyReceiver for Arc<T> {} diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index e234f105b0b76..72ba49925bd86 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -1168,7 +1168,8 @@ pub trait FnPtr: Copy + Clone { /// type as a receiver are dyn-compatible. For example, this compiles: /// /// ``` -/// #![feature(arbitrary_self_types, derive_coerce_pointee)] +/// #![feature(derive_coerce_pointee)] +/// # #![cfg_attr(bootstrap, feature(legacy_receiver_trait))] /// use std::marker::CoercePointee; /// use std::ops::Deref; /// @@ -1182,6 +1183,9 @@ pub trait FnPtr: Copy + Clone { /// &self.0 /// } /// } +/// # +/// # #[cfg(bootstrap)] +/// # impl<T: ?Sized> core::ops::LegacyReceiver for MySmartPointer<T> {} /// /// // You can always define this trait. (as long as you have #![feature(arbitrary_self_types)]) /// trait MyTrait { diff --git a/library/core/src/ops/deref.rs b/library/core/src/ops/deref.rs index e74f5443ac2d8..9e5c88ff9f332 100644 --- a/library/core/src/ops/deref.rs +++ b/library/core/src/ops/deref.rs @@ -303,9 +303,7 @@ unsafe impl<T: ?Sized> DerefPure for &mut T {} /// Indicates that a struct can be used as a method receiver. /// That is, a type can use this type as a type of `self`, like this: -/// ```compile_fail -/// # // This is currently compile_fail because the compiler-side parts -/// # // of arbitrary_self_types are not implemented +/// ```ignore (trying to figure out bootstrap stuff, will be reinstated) /// use std::ops::Receiver; /// /// struct SmartPointer<T>(T); @@ -365,16 +363,16 @@ unsafe impl<T: ?Sized> DerefPure for &mut T {} /// } /// ``` #[lang = "receiver"] -#[unstable(feature = "arbitrary_self_types", issue = "44874")] +#[stable(feature = "arbitrary_self_types", since = "CURRENT_RUSTC_VERSION")] pub trait Receiver { /// The target type on which the method may be called. #[rustc_diagnostic_item = "receiver_target"] #[lang = "receiver_target"] - #[unstable(feature = "arbitrary_self_types", issue = "44874")] + #[stable(feature = "arbitrary_self_types", since = "CURRENT_RUSTC_VERSION")] type Target: ?Sized; } -#[unstable(feature = "arbitrary_self_types", issue = "44874")] +#[stable(feature = "arbitrary_self_types", since = "CURRENT_RUSTC_VERSION")] impl<P: ?Sized, T: ?Sized> Receiver for P where P: Deref<Target = T>, @@ -390,15 +388,18 @@ where /// facility based around the current "arbitrary self types" unstable feature. /// That new facility will use the replacement trait above called `Receiver` /// which is why this is now named `LegacyReceiver`. -#[lang = "legacy_receiver"] -#[unstable(feature = "legacy_receiver_trait", issue = "none")] +#[cfg(bootstrap)] +#[cfg_attr(bootstrap, lang = "legacy_receiver")] +#[cfg_attr(bootstrap, unstable(feature = "legacy_receiver_trait", issue = "none"))] #[doc(hidden)] pub trait LegacyReceiver { // Empty. } -#[unstable(feature = "legacy_receiver_trait", issue = "none")] +#[cfg(bootstrap)] +#[cfg_attr(bootstrap, unstable(feature = "legacy_receiver_trait", issue = "none"))] impl<T: ?Sized> LegacyReceiver for &T {} -#[unstable(feature = "legacy_receiver_trait", issue = "none")] +#[cfg(bootstrap)] +#[cfg_attr(bootstrap, unstable(feature = "legacy_receiver_trait", issue = "none"))] impl<T: ?Sized> LegacyReceiver for &mut T {} diff --git a/library/core/src/ops/mod.rs b/library/core/src/ops/mod.rs index 627a875d9f724..911f05ab3d925 100644 --- a/library/core/src/ops/mod.rs +++ b/library/core/src/ops/mod.rs @@ -168,9 +168,10 @@ pub use self::control_flow::ControlFlow; pub use self::coroutine::{Coroutine, CoroutineState}; #[unstable(feature = "deref_pure_trait", issue = "87121")] pub use self::deref::DerefPure; +#[cfg(bootstrap)] #[unstable(feature = "legacy_receiver_trait", issue = "none")] pub use self::deref::LegacyReceiver; -#[unstable(feature = "arbitrary_self_types", issue = "44874")] +#[stable(feature = "arbitrary_self_types", since = "CURRENT_RUSTC_VERSION")] pub use self::deref::Receiver; #[stable(feature = "rust1", since = "1.0.0")] pub use self::deref::{Deref, DerefMut}; diff --git a/library/core/src/pin.rs b/library/core/src/pin.rs index 7fcd19f67ee2d..3771739644998 100644 --- a/library/core/src/pin.rs +++ b/library/core/src/pin.rs @@ -921,7 +921,9 @@ #![stable(feature = "pin", since = "1.33.0")] use crate::hash::{Hash, Hasher}; -use crate::ops::{CoerceUnsized, Deref, DerefMut, DerefPure, DispatchFromDyn, LegacyReceiver}; +#[cfg(bootstrap)] +use crate::ops::LegacyReceiver; +use crate::ops::{CoerceUnsized, Deref, DerefMut, DerefPure, DispatchFromDyn}; #[allow(unused_imports)] use crate::{ cell::{RefCell, UnsafeCell}, @@ -1694,7 +1696,8 @@ impl<Ptr: DerefMut<Target: Unpin>> DerefMut for Pin<Ptr> { #[unstable(feature = "deref_pure_trait", issue = "87121")] unsafe impl<Ptr: DerefPure> DerefPure for Pin<Ptr> {} -#[unstable(feature = "legacy_receiver_trait", issue = "none")] +#[cfg(bootstrap)] +#[cfg_attr(bootstrap, unstable(feature = "legacy_receiver_trait", issue = "none"))] impl<Ptr: LegacyReceiver> LegacyReceiver for Pin<Ptr> {} #[stable(feature = "pin", since = "1.33.0")] diff --git a/src/doc/unstable-book/src/language-features/arbitrary-self-types-pointers.md b/src/doc/unstable-book/src/language-features/arbitrary-self-types-pointers.md index f73bcaffa8003..4160975702da5 100644 --- a/src/doc/unstable-book/src/language-features/arbitrary-self-types-pointers.md +++ b/src/doc/unstable-book/src/language-features/arbitrary-self-types-pointers.md @@ -6,8 +6,7 @@ The tracking issue for this feature is: [#44874] ------------------------ -This extends the [arbitrary self types] feature to allow methods to -receive `self` by pointer. For example: +This allow methods to receive `self` by pointer. For example: ```rust #![feature(arbitrary_self_types_pointers)] @@ -27,7 +26,7 @@ fn main() { In general this is not advised: it's thought to be better practice to wrap raw pointers in a newtype wrapper which implements the `core::ops::Receiver` -trait, then you need "only" the `arbitrary_self_types` feature. For example: +trait. For example: ```rust #![feature(arbitrary_self_types)] @@ -53,5 +52,3 @@ fn main() { a_wrapper.m(); } ``` - -[arbitrary self types]: arbitrary-self-types.md diff --git a/src/doc/unstable-book/src/language-features/arbitrary-self-types.md b/src/doc/unstable-book/src/language-features/arbitrary-self-types.md deleted file mode 100644 index 2f8b52d404393..0000000000000 --- a/src/doc/unstable-book/src/language-features/arbitrary-self-types.md +++ /dev/null @@ -1,154 +0,0 @@ -# `arbitrary_self_types` - -The tracking issue for this feature is: [#44874] - -[#38788]: https://github.com/rust-lang/rust/issues/44874 - ------------------------- - -Allows any type implementing `core::ops::Receiver<Target=T>` to be used as the type -of `self` in a method belonging to `T`. - -For example, - -```rust -#![feature(arbitrary_self_types)] - -struct A; - -impl A { - fn f(self: SmartPtr<Self>) -> i32 { 1 } // note self type -} - -struct SmartPtr<T>(T); - -impl<T> core::ops::Receiver for SmartPtr<T> { - type Target = T; -} - -fn main() { - let smart_ptr = SmartPtr(A); - assert_eq!(smart_ptr.f(), 1); -} -``` - -The `Receiver` trait has a blanket implementation for all `T: Deref`, so in fact -things like this work too: - -```rust -#![feature(arbitrary_self_types)] - -use std::rc::Rc; - -struct A; - -impl A { - fn f(self: Rc<Self>) -> i32 { 1 } // Rc implements Deref -} - -fn main() { - let smart_ptr = Rc::new(A); - assert_eq!(smart_ptr.f(), 1); -} -``` - -Interestingly, that works even without the `arbitrary_self_types` feature -- but that's because certain types are _effectively_ hard coded, including -`Rc`. ("Hard coding" isn't quite true; they use a lang-item called -`LegacyReceiver` to denote their special-ness in this way). With the -`arbitrary_self_types` feature, their special-ness goes away, and custom -smart pointers can achieve the same. - -## Changes to method lookup - -Method lookup previously used to work by stepping through the `Deref` -chain then using the resulting list of steps in two different ways: - -* To identify types that might contribute methods via their `impl` - blocks (inherent methods) or via traits -* To identify the types that the method receiver (`a` in the above - examples) can be converted to. - -With this feature, these lists are created by instead stepping through -the `Receiver` chain. However, a note is kept about whether the type -can be reached also via the `Deref` chain. - -The full chain (via `Receiver` hops) is used for the first purpose -(identifying relevant `impl` blocks and traits); whereas the shorter -list (reachable via `Deref`) is used for the second purpose. That's -because, to convert the method target (`a` in `a.b()`) to the self -type, Rust may need to be able to use `Deref::deref`. Type conversions, -then, can only proceed as far as the end of the `Deref` chain whereas -the longer `Receiver` chain can be used to explore more places where -useful methods might reside. - -## Types suitable for use as smart pointers - -This feature allows the creation of customised smart pointers - for example -your own equivalent to `Rc` or `Box` with whatever capabilities you like. -Those smart pointers can either implement `Deref` (if it's safe to -create a reference to the referent) or `Receiver` (if it isn't). - -Either way, smart pointer types should mostly _avoid having methods_. -Calling methods on a smart pointer leads to ambiguity about whether you're -aiming for a method on the pointer, or on the referent. - -Best practice is therefore to put smart pointer functionality into -associated functions instead - that's what's done in all the smart pointer -types within Rust's standard library which implement `Receiver`. - -If you choose to add any methods to your smart pointer type, your users -may run into errors from deshadowing, as described in the next section. - -## Avoiding shadowing - -With or without this feature, Rust emits an error if it finds two method -candidates, like this: - -```rust,compile_fail -use std::pin::Pin; -use std::pin::pin; - -struct A; - -impl A { - fn get_ref(self: Pin<&A>) {} -} - -fn main() { - let pinned_a: Pin<&A> = pin!(A).as_ref(); - let pinned_a: Pin<&A> = pinned_a.as_ref(); - pinned_a.get_ref(); // error[E0034]: multiple applicable items in scope -} -``` - -(this is why Rust's smart pointers are mostly carefully designed to avoid -having methods at all, and shouldn't add new methods in future.) - -With `arbitrary_self_types`, we take care to spot some other kinds of -conflict: - -```rust,compile_fail -#![feature(arbitrary_self_types)] - -use std::pin::Pin; -use std::pin::pin; - -struct A; - -impl A { - fn get_ref(self: &Pin<&A>) {} // note &Pin -} - -fn main() { - let pinned_a: Pin<&mut A> = pin!(A); - let pinned_a: Pin<&A> = pinned_a.as_ref(); - pinned_a.get_ref(); -} -``` - -This is to guard against the case where an inner (referent) type has a -method of a given name, taking the smart pointer by reference, and then -the smart pointer implementer adds a similar method taking self by value. -As noted in the previous section, the safe option is simply -not to add methods to smart pointers, and then these errors can't occur. diff --git a/src/doc/unstable-book/src/language-features/coroutines.md b/src/doc/unstable-book/src/language-features/coroutines.md index 9fb07594650f4..365c05f348d66 100644 --- a/src/doc/unstable-book/src/language-features/coroutines.md +++ b/src/doc/unstable-book/src/language-features/coroutines.md @@ -89,7 +89,7 @@ Feedback on the design and usage is always appreciated! The `Coroutine` trait in `std::ops` currently looks like: ```rust -# #![feature(arbitrary_self_types, coroutine_trait)] +# #![feature(coroutine_trait)] # use std::ops::CoroutineState; # use std::pin::Pin; @@ -184,7 +184,7 @@ fn main() { This coroutine literal will compile down to something similar to: ```rust -#![feature(arbitrary_self_types, coroutine_trait)] +#![feature(coroutine_trait)] use std::ops::{Coroutine, CoroutineState}; use std::pin::Pin; diff --git a/src/tools/miri/src/lib.rs b/src/tools/miri/src/lib.rs index 0bf5ae87f3836..ea47b1a08bca2 100644 --- a/src/tools/miri/src/lib.rs +++ b/src/tools/miri/src/lib.rs @@ -15,7 +15,7 @@ #![feature(pointer_is_aligned_to)] #![feature(unqualified_local_imports)] #![feature(derive_coerce_pointee)] -#![feature(arbitrary_self_types)] +#![cfg_attr(bootstrap,feature(legacy_receiver_trait))] // Configure clippy and other lints #![allow( clippy::collapsible_else_if, diff --git a/src/tools/miri/src/shims/files.rs b/src/tools/miri/src/shims/files.rs index 6b4f4cdc922a0..a7b408ec76600 100644 --- a/src/tools/miri/src/shims/files.rs +++ b/src/tools/miri/src/shims/files.rs @@ -43,6 +43,10 @@ impl<T: ?Sized> Deref for FileDescriptionRef<T> { } } +#[cfg(bootstrap)] +impl<T: ?Sized> core::ops::LegacyReceiver for FileDescriptionRef<T> { +} + impl<T: ?Sized> FileDescriptionRef<T> { pub fn id(&self) -> FdId { self.0.id diff --git a/tests/auxiliary/minicore.rs b/tests/auxiliary/minicore.rs index 03aa847650823..b091bc82b3f51 100644 --- a/tests/auxiliary/minicore.rs +++ b/tests/auxiliary/minicore.rs @@ -43,11 +43,6 @@ macro_rules! impl_marker_trait { #[lang = "sized"] pub trait Sized {} -#[lang = "legacy_receiver"] -pub trait LegacyReceiver {} -impl<T: ?Sized> LegacyReceiver for &T {} -impl<T: ?Sized> LegacyReceiver for &mut T {} - #[lang = "copy"] pub trait Copy: Sized {} diff --git a/tests/codegen/avr/avr-func-addrspace.rs b/tests/codegen/avr/avr-func-addrspace.rs index 2ae2f40d7b349..9c142a415c3e9 100644 --- a/tests/codegen/avr/avr-func-addrspace.rs +++ b/tests/codegen/avr/avr-func-addrspace.rs @@ -10,7 +10,7 @@ // It also validates that functions can be called through function pointers // through traits. -#![feature(no_core, lang_items, intrinsics, unboxed_closures, arbitrary_self_types)] +#![feature(no_core, lang_items, intrinsics, unboxed_closures)] #![crate_type = "lib"] #![no_core] diff --git a/tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs b/tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs index 15c107bea158b..b183b234ad0f3 100644 --- a/tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs +++ b/tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs @@ -9,7 +9,7 @@ //@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 #![crate_type = "lib"] -#![feature(arbitrary_self_types, no_core, lang_items)] +#![feature(no_core, lang_items)] #![no_core] extern crate minicore; diff --git a/tests/rustdoc-json/impls/auto.rs b/tests/rustdoc-json/impls/auto.rs index f37dae4c1ed43..538ef892afd06 100644 --- a/tests/rustdoc-json/impls/auto.rs +++ b/tests/rustdoc-json/impls/auto.rs @@ -4,9 +4,6 @@ #[lang = "sized"] trait Sized {} -#[lang = "legacy_receiver"] -pub trait LegacyReceiver {} - pub auto trait Bar {} /// has span @@ -15,8 +12,8 @@ impl Foo { } // Testing spans, so all tests below code -//@ is "$.index[*][?(@.docs=='has span')].span.begin" "[13, 0]" -//@ is "$.index[*][?(@.docs=='has span')].span.end" "[15, 1]" +//@ is "$.index[*][?(@.docs=='has span')].span.begin" "[10, 0]" +//@ is "$.index[*][?(@.docs=='has span')].span.end" "[12, 1]" // FIXME: this doesn't work due to https://github.com/freestrings/jsonpath/issues/91 // is "$.index[*][?(@.inner.impl.is_synthetic==true)].span" null pub struct Foo; diff --git a/tests/ui/async-await/inference_var_self_argument.stderr b/tests/ui/async-await/inference_var_self_argument.stderr index 1fccc32470ff6..5681444980c28 100644 --- a/tests/ui/async-await/inference_var_self_argument.stderr +++ b/tests/ui/async-await/inference_var_self_argument.stderr @@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `&dyn Foo` LL | async fn foo(self: &dyn Foo) { | ^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0038]: the trait `Foo` is not dyn compatible --> $DIR/inference_var_self_argument.rs:5:5 diff --git a/tests/ui/async-await/issue-66312.stderr b/tests/ui/async-await/issue-66312.stderr index c95ae1147df36..f4db949a5f430 100644 --- a/tests/ui/async-await/issue-66312.stderr +++ b/tests/ui/async-await/issue-66312.stderr @@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `T` LL | fn is_some(self: T); | ^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0308]: mismatched types --> $DIR/issue-66312.rs:9:8 diff --git a/tests/ui/async-await/issues/issue-53249.rs b/tests/ui/async-await/issues/issue-53249.rs index da86c0c7b26c1..ca666d8fdd520 100644 --- a/tests/ui/async-await/issues/issue-53249.rs +++ b/tests/ui/async-await/issues/issue-53249.rs @@ -1,8 +1,6 @@ //@ check-pass //@ edition:2018 -#![feature(arbitrary_self_types)] - use std::task::{self, Poll}; use std::future::Future; use std::marker::Unpin; diff --git a/tests/ui/deriving/deriving-coerce-pointee-neg.rs b/tests/ui/deriving/deriving-coerce-pointee-neg.rs index 2713366945e9a..399e709fd59e4 100644 --- a/tests/ui/deriving/deriving-coerce-pointee-neg.rs +++ b/tests/ui/deriving/deriving-coerce-pointee-neg.rs @@ -1,5 +1,5 @@ //@ proc-macro: malicious-macro.rs -#![feature(derive_coerce_pointee, arbitrary_self_types)] +#![feature(derive_coerce_pointee)] extern crate core; extern crate malicious_macro; diff --git a/tests/ui/deriving/deriving-coerce-pointee.rs b/tests/ui/deriving/deriving-coerce-pointee.rs index 26762e4d0face..44c255c661405 100644 --- a/tests/ui/deriving/deriving-coerce-pointee.rs +++ b/tests/ui/deriving/deriving-coerce-pointee.rs @@ -1,5 +1,5 @@ //@ run-pass -#![feature(derive_coerce_pointee, arbitrary_self_types)] +#![feature(derive_coerce_pointee)] use std::marker::CoercePointee; diff --git a/tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.feature.stderr b/tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.feature.stderr deleted file mode 100644 index d0a25e28a7666..0000000000000 --- a/tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.feature.stderr +++ /dev/null @@ -1,36 +0,0 @@ -error[E0658]: `*const Bar` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature - --> $DIR/feature-gate-arbitrary-self-types-pointers.rs:11:18 - | -LL | fn foo(self: *const Self) {} - | ^^^^^^^^^^^ - | - = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information - = help: add `#![feature(arbitrary_self_types_pointers)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` - -error[E0658]: `*mut Bar` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature - --> $DIR/feature-gate-arbitrary-self-types-pointers.rs:15:18 - | -LL | fn bar(self: *mut Self) {} - | ^^^^^^^^^ - | - = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information - = help: add `#![feature(arbitrary_self_types_pointers)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` - -error[E0658]: `*const Self` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature - --> $DIR/feature-gate-arbitrary-self-types-pointers.rs:5:18 - | -LL | fn foo(self: *const Self); - | ^^^^^^^^^^^ - | - = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information - = help: add `#![feature(arbitrary_self_types_pointers)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.rs b/tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.rs index 7ea1b875f79a4..79ceb05662bc4 100644 --- a/tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.rs +++ b/tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.rs @@ -1,6 +1,3 @@ -//@ revisions: default feature -#![cfg_attr(feature, feature(arbitrary_self_types))] - trait Foo { fn foo(self: *const Self); //~ ERROR `*const Self` cannot be used as the type of `self` } diff --git a/tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.default.stderr b/tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.stderr similarity index 91% rename from tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.default.stderr rename to tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.stderr index d0a25e28a7666..0c5b8a4d3b685 100644 --- a/tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.default.stderr +++ b/tests/ui/feature-gates/feature-gate-arbitrary-self-types-pointers.stderr @@ -1,5 +1,5 @@ error[E0658]: `*const Bar` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature - --> $DIR/feature-gate-arbitrary-self-types-pointers.rs:11:18 + --> $DIR/feature-gate-arbitrary-self-types-pointers.rs:8:18 | LL | fn foo(self: *const Self) {} | ^^^^^^^^^^^ @@ -10,7 +10,7 @@ LL | fn foo(self: *const Self) {} = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0658]: `*mut Bar` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature - --> $DIR/feature-gate-arbitrary-self-types-pointers.rs:15:18 + --> $DIR/feature-gate-arbitrary-self-types-pointers.rs:12:18 | LL | fn bar(self: *mut Self) {} | ^^^^^^^^^ @@ -21,7 +21,7 @@ LL | fn bar(self: *mut Self) {} = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0658]: `*const Self` cannot be used as the type of `self` without the `arbitrary_self_types_pointers` feature - --> $DIR/feature-gate-arbitrary-self-types-pointers.rs:5:18 + --> $DIR/feature-gate-arbitrary-self-types-pointers.rs:2:18 | LL | fn foo(self: *const Self); | ^^^^^^^^^^^ diff --git a/tests/ui/feature-gates/feature-gate-arbitrary-self-types.rs b/tests/ui/feature-gates/feature-gate-arbitrary-self-types.rs deleted file mode 100644 index 47ca7e3497578..0000000000000 --- a/tests/ui/feature-gates/feature-gate-arbitrary-self-types.rs +++ /dev/null @@ -1,29 +0,0 @@ -use std::{ - ops::Deref, -}; - -struct Ptr<T: ?Sized>(Box<T>); - -impl<T: ?Sized> Deref for Ptr<T> { - type Target = T; - - fn deref(&self) -> &T { - &*self.0 - } -} - -trait Foo { - fn foo(self: Ptr<Self>); //~ ERROR `Ptr<Self>` cannot be used as the type of `self` without -} - -struct Bar; - -impl Foo for Bar { - fn foo(self: Ptr<Self>) {} //~ ERROR `Ptr<Bar>` cannot be used as the type of `self` without -} - -impl Bar { - fn bar(self: Box<Ptr<Self>>) {} //~ ERROR `Box<Ptr<Bar>>` cannot be used as the -} - -fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-arbitrary-self-types.stderr b/tests/ui/feature-gates/feature-gate-arbitrary-self-types.stderr deleted file mode 100644 index 3ffba533d63fc..0000000000000 --- a/tests/ui/feature-gates/feature-gate-arbitrary-self-types.stderr +++ /dev/null @@ -1,36 +0,0 @@ -error[E0658]: `Ptr<Bar>` cannot be used as the type of `self` without the `arbitrary_self_types` feature - --> $DIR/feature-gate-arbitrary-self-types.rs:22:18 - | -LL | fn foo(self: Ptr<Self>) {} - | ^^^^^^^^^ - | - = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information - = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` - -error[E0658]: `Box<Ptr<Bar>>` cannot be used as the type of `self` without the `arbitrary_self_types` feature - --> $DIR/feature-gate-arbitrary-self-types.rs:26:18 - | -LL | fn bar(self: Box<Ptr<Self>>) {} - | ^^^^^^^^^^^^^^ - | - = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information - = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` - -error[E0658]: `Ptr<Self>` cannot be used as the type of `self` without the `arbitrary_self_types` feature - --> $DIR/feature-gate-arbitrary-self-types.rs:16:18 - | -LL | fn foo(self: Ptr<Self>); - | ^^^^^^^^^ - | - = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information - = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-cell.stderr b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-cell.stderr index 2150effc3b74d..eb9e51a04c394 100644 --- a/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-cell.stderr +++ b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-cell.stderr @@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `Cell<&Self>` LL | fn cell(self: Cell<&Self>); | ^^^^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error: aborting due to 1 previous error diff --git a/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.rs b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.rs index 37eabbf160220..551a979dc89c7 100644 --- a/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.rs +++ b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.rs @@ -1,6 +1,6 @@ // Check that a self parameter type requires a DispatchFromDyn impl to be dyn-compatible. -#![feature(arbitrary_self_types, unsize, coerce_unsized)] +#![feature(unsize, coerce_unsized)] use std::{ marker::Unsize, diff --git a/tests/ui/issues/issue-56806.stderr b/tests/ui/issues/issue-56806.stderr index ec50d863758db..4b0a59fe12def 100644 --- a/tests/ui/issues/issue-56806.stderr +++ b/tests/ui/issues/issue-56806.stderr @@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `Box<(dyn Trait + 'static)>` LL | fn dyn_instead_of_self(self: Box<dyn Trait>); | ^^^^^^^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error: aborting due to 1 previous error diff --git a/tests/ui/lifetimes/could-not-resolve-issue-121503.rs b/tests/ui/lifetimes/could-not-resolve-issue-121503.rs index 363162370f21b..339db4cdd9a65 100644 --- a/tests/ui/lifetimes/could-not-resolve-issue-121503.rs +++ b/tests/ui/lifetimes/could-not-resolve-issue-121503.rs @@ -4,7 +4,7 @@ struct Struct; impl Struct { async fn box_ref_Struct(self: Box<Self, impl FnMut(&mut Self)>) -> &u32 { - //~^ ERROR Box<Struct, impl FnMut(&mut Self)>` cannot be used as the type of `self` without + //~^ ERROR the trait bound &1 } } diff --git a/tests/ui/lifetimes/could-not-resolve-issue-121503.stderr b/tests/ui/lifetimes/could-not-resolve-issue-121503.stderr index 46804642af88e..5ec8c496af133 100644 --- a/tests/ui/lifetimes/could-not-resolve-issue-121503.stderr +++ b/tests/ui/lifetimes/could-not-resolve-issue-121503.stderr @@ -1,14 +1,16 @@ -error[E0658]: `Box<Struct, impl FnMut(&mut Self)>` cannot be used as the type of `self` without the `arbitrary_self_types` feature +error[E0277]: the trait bound `impl FnMut(&mut Self): Allocator` is not satisfied --> $DIR/could-not-resolve-issue-121503.rs:6:35 | LL | async fn box_ref_Struct(self: Box<Self, impl FnMut(&mut Self)>) -> &u32 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Allocator` is not implemented for `impl FnMut(&mut Self)` | - = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information - = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` +note: required by a bound in `Box` + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL +help: consider restricting opaque type `impl FnMut(&mut Self)` with unstable trait `Allocator` + | +LL | async fn box_ref_Struct(self: Box<Self, impl FnMut(&mut Self) + std::alloc::Allocator>) -> &u32 { + | +++++++++++++++++++++++ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0658`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/lint/unused/must_use-in-stdlib-traits.rs b/tests/ui/lint/unused/must_use-in-stdlib-traits.rs index 70dddf61fb7d8..3e5a512f1190b 100644 --- a/tests/ui/lint/unused/must_use-in-stdlib-traits.rs +++ b/tests/ui/lint/unused/must_use-in-stdlib-traits.rs @@ -1,5 +1,4 @@ #![deny(unused_must_use)] -#![feature(arbitrary_self_types)] use std::iter::Iterator; use std::future::Future; diff --git a/tests/ui/lint/unused/must_use-in-stdlib-traits.stderr b/tests/ui/lint/unused/must_use-in-stdlib-traits.stderr index ef738708d5f4e..6ee43ffcf28e6 100644 --- a/tests/ui/lint/unused/must_use-in-stdlib-traits.stderr +++ b/tests/ui/lint/unused/must_use-in-stdlib-traits.stderr @@ -1,5 +1,5 @@ error: unused implementer of `Iterator` that must be used - --> $DIR/must_use-in-stdlib-traits.rs:42:4 + --> $DIR/must_use-in-stdlib-traits.rs:41:4 | LL | iterator(); | ^^^^^^^^^^ @@ -12,7 +12,7 @@ LL | #![deny(unused_must_use)] | ^^^^^^^^^^^^^^^ error: unused implementer of `Future` that must be used - --> $DIR/must_use-in-stdlib-traits.rs:43:4 + --> $DIR/must_use-in-stdlib-traits.rs:42:4 | LL | future(); | ^^^^^^^^ @@ -20,7 +20,7 @@ LL | future(); = note: futures do nothing unless you `.await` or poll them error: unused implementer of `FnOnce` that must be used - --> $DIR/must_use-in-stdlib-traits.rs:44:4 + --> $DIR/must_use-in-stdlib-traits.rs:43:4 | LL | square_fn_once(); | ^^^^^^^^^^^^^^^^ @@ -28,7 +28,7 @@ LL | square_fn_once(); = note: closures are lazy and do nothing unless called error: unused implementer of `FnMut` that must be used - --> $DIR/must_use-in-stdlib-traits.rs:45:4 + --> $DIR/must_use-in-stdlib-traits.rs:44:4 | LL | square_fn_mut(); | ^^^^^^^^^^^^^^^ @@ -36,7 +36,7 @@ LL | square_fn_mut(); = note: closures are lazy and do nothing unless called error: unused implementer of `Fn` that must be used - --> $DIR/must_use-in-stdlib-traits.rs:46:4 + --> $DIR/must_use-in-stdlib-traits.rs:45:4 | LL | square_fn(); | ^^^^^^^^^^^ diff --git a/tests/ui/methods/call_method_unknown_referent.rs b/tests/ui/methods/call_method_unknown_referent.rs index b01e2d80f7f80..f03c781508608 100644 --- a/tests/ui/methods/call_method_unknown_referent.rs +++ b/tests/ui/methods/call_method_unknown_referent.rs @@ -1,7 +1,5 @@ //@ edition: 2018 -#![feature(arbitrary_self_types)] - // tests that the referent type of a reference must be known to call methods on it struct SmartPtr<T>(T); diff --git a/tests/ui/methods/call_method_unknown_referent.stderr b/tests/ui/methods/call_method_unknown_referent.stderr index 748b02b52b577..c0760c6fd69f6 100644 --- a/tests/ui/methods/call_method_unknown_referent.stderr +++ b/tests/ui/methods/call_method_unknown_referent.stderr @@ -1,17 +1,17 @@ error[E0282]: type annotations needed - --> $DIR/call_method_unknown_referent.rs:20:31 + --> $DIR/call_method_unknown_referent.rs:18:31 | LL | let _a: i32 = (ptr as &_).read(); | ^^^^ cannot infer type error[E0282]: type annotations needed - --> $DIR/call_method_unknown_referent.rs:26:37 + --> $DIR/call_method_unknown_referent.rs:24:37 | LL | let _b = (rc as std::rc::Rc<_>).read(); | ^^^^ cannot infer type error[E0599]: no method named `read` found for struct `SmartPtr` in the current scope - --> $DIR/call_method_unknown_referent.rs:46:35 + --> $DIR/call_method_unknown_referent.rs:44:35 | LL | struct SmartPtr<T>(T); | ------------------ method `read` not found for this struct diff --git a/tests/ui/methods/call_method_unknown_referent2.rs b/tests/ui/methods/call_method_unknown_referent2.rs index b1615bd8d4414..97a643291f34b 100644 --- a/tests/ui/methods/call_method_unknown_referent2.rs +++ b/tests/ui/methods/call_method_unknown_referent2.rs @@ -1,8 +1,6 @@ //@ edition: 2018 //@ run-pass -#![feature(arbitrary_self_types)] - // tests that the referent type of a reference must be known to call methods on it struct SmartPtr<T>(T); diff --git a/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.rs b/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.rs index 9e53ff0791728..a579758f920a3 100644 --- a/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.rs +++ b/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.rs @@ -1,4 +1,4 @@ -#![feature(arbitrary_self_types, coerce_unsized, dispatch_from_dyn, unsize)] +#![feature(coerce_unsized, dispatch_from_dyn, unsize)] #![feature(unsized_locals, unsized_fn_params)] //~^ WARN the feature `unsized_locals` is incomplete diff --git a/tests/ui/privacy/privacy1.rs b/tests/ui/privacy/privacy1.rs index 9436441ecc6a7..ad2b652014fc7 100644 --- a/tests/ui/privacy/privacy1.rs +++ b/tests/ui/privacy/privacy1.rs @@ -12,15 +12,10 @@ pub trait Deref { type Target; } -#[lang="legacy_receiver"] -pub trait LegacyReceiver: Deref {} - impl<'a, T> Deref for &'a T { type Target = T; } -impl<'a, T> LegacyReceiver for &'a T {} - mod bar { // shouldn't bring in too much pub use self::glob::*; diff --git a/tests/ui/privacy/privacy1.stderr b/tests/ui/privacy/privacy1.stderr index cb7b858e54dc8..b42a7a18c28bb 100644 --- a/tests/ui/privacy/privacy1.stderr +++ b/tests/ui/privacy/privacy1.stderr @@ -1,54 +1,54 @@ error[E0603]: module `baz` is private - --> $DIR/privacy1.rs:132:18 + --> $DIR/privacy1.rs:127:18 | LL | use bar::baz::{foo, bar}; | ^^^ private module | note: the module `baz` is defined here - --> $DIR/privacy1.rs:50:5 + --> $DIR/privacy1.rs:45:5 | LL | mod baz { | ^^^^^^^ error[E0603]: module `baz` is private - --> $DIR/privacy1.rs:132:18 + --> $DIR/privacy1.rs:127:18 | LL | use bar::baz::{foo, bar}; | ^^^ private module | note: the module `baz` is defined here - --> $DIR/privacy1.rs:50:5 + --> $DIR/privacy1.rs:45:5 | LL | mod baz { | ^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0603]: module `baz` is private - --> $DIR/privacy1.rs:141:18 + --> $DIR/privacy1.rs:136:18 | LL | use bar::baz; | ^^^ private module | note: the module `baz` is defined here - --> $DIR/privacy1.rs:50:5 + --> $DIR/privacy1.rs:45:5 | LL | mod baz { | ^^^^^^^ error[E0603]: module `i` is private - --> $DIR/privacy1.rs:165:20 + --> $DIR/privacy1.rs:160:20 | LL | use self::foo::i::A; | ^ private module | note: the module `i` is defined here - --> $DIR/privacy1.rs:170:9 + --> $DIR/privacy1.rs:165:9 | LL | mod i { | ^^^^^ error[E0603]: module `baz` is private - --> $DIR/privacy1.rs:104:16 + --> $DIR/privacy1.rs:99:16 | LL | ::bar::baz::A::foo(); | ^^^ - struct `A` is not publicly re-exported @@ -56,13 +56,13 @@ LL | ::bar::baz::A::foo(); | private module | note: the module `baz` is defined here - --> $DIR/privacy1.rs:50:5 + --> $DIR/privacy1.rs:45:5 | LL | mod baz { | ^^^^^^^ error[E0603]: module `baz` is private - --> $DIR/privacy1.rs:105:16 + --> $DIR/privacy1.rs:100:16 | LL | ::bar::baz::A::bar(); | ^^^ - struct `A` is not publicly re-exported @@ -70,13 +70,13 @@ LL | ::bar::baz::A::bar(); | private module | note: the module `baz` is defined here - --> $DIR/privacy1.rs:50:5 + --> $DIR/privacy1.rs:45:5 | LL | mod baz { | ^^^^^^^ error[E0603]: module `baz` is private - --> $DIR/privacy1.rs:107:16 + --> $DIR/privacy1.rs:102:16 | LL | ::bar::baz::A.foo2(); | ^^^ - unit struct `A` is not publicly re-exported @@ -84,13 +84,13 @@ LL | ::bar::baz::A.foo2(); | private module | note: the module `baz` is defined here - --> $DIR/privacy1.rs:50:5 + --> $DIR/privacy1.rs:45:5 | LL | mod baz { | ^^^^^^^ error[E0603]: module `baz` is private - --> $DIR/privacy1.rs:108:16 + --> $DIR/privacy1.rs:103:16 | LL | ::bar::baz::A.bar2(); | ^^^ - unit struct `A` is not publicly re-exported @@ -98,13 +98,13 @@ LL | ::bar::baz::A.bar2(); | private module | note: the module `baz` is defined here - --> $DIR/privacy1.rs:50:5 + --> $DIR/privacy1.rs:45:5 | LL | mod baz { | ^^^^^^^ error[E0603]: trait `B` is private - --> $DIR/privacy1.rs:112:16 + --> $DIR/privacy1.rs:107:16 | LL | ::bar::B::foo(); | ^ --- associated function `foo` is not publicly re-exported @@ -112,31 +112,31 @@ LL | ::bar::B::foo(); | private trait | note: the trait `B` is defined here - --> $DIR/privacy1.rs:40:5 + --> $DIR/privacy1.rs:35:5 | LL | trait B { | ^^^^^^^ error[E0603]: function `epriv` is private - --> $DIR/privacy1.rs:118:20 + --> $DIR/privacy1.rs:113:20 | LL | ::bar::epriv(); | ^^^^^ private function | note: the function `epriv` is defined here - --> $DIR/privacy1.rs:65:9 + --> $DIR/privacy1.rs:60:9 | LL | fn epriv(); | ^^^^^^^^^^^ error[E0603]: module `baz` is private - --> $DIR/privacy1.rs:127:16 + --> $DIR/privacy1.rs:122:16 | LL | ::bar::baz::foo(); | ^^^ private module | note: the module `baz` is defined here - --> $DIR/privacy1.rs:50:5 + --> $DIR/privacy1.rs:45:5 | LL | mod baz { | ^^^^^^^ @@ -147,13 +147,13 @@ LL + bar::foo(); | error[E0603]: module `baz` is private - --> $DIR/privacy1.rs:128:16 + --> $DIR/privacy1.rs:123:16 | LL | ::bar::baz::bar(); | ^^^ private module | note: the module `baz` is defined here - --> $DIR/privacy1.rs:50:5 + --> $DIR/privacy1.rs:45:5 | LL | mod baz { | ^^^^^^^ @@ -164,19 +164,19 @@ LL + bar::bar(); | error[E0603]: trait `B` is private - --> $DIR/privacy1.rs:157:17 + --> $DIR/privacy1.rs:152:17 | LL | impl ::bar::B for f32 { fn foo() -> f32 { 1.0 } } | ^ private trait | note: the trait `B` is defined here - --> $DIR/privacy1.rs:40:5 + --> $DIR/privacy1.rs:35:5 | LL | trait B { | ^^^^^^^ error[E0624]: associated function `bar` is private - --> $DIR/privacy1.rs:77:23 + --> $DIR/privacy1.rs:72:23 | LL | fn bar() {} | -------- private associated function defined here @@ -185,7 +185,7 @@ LL | self::baz::A::bar(); | ^^^ private associated function error[E0624]: associated function `bar` is private - --> $DIR/privacy1.rs:95:13 + --> $DIR/privacy1.rs:90:13 | LL | fn bar() {} | -------- private associated function defined here @@ -194,7 +194,7 @@ LL | bar::A::bar(); | ^^^ private associated function error[E0624]: associated function `bar` is private - --> $DIR/privacy1.rs:102:19 + --> $DIR/privacy1.rs:97:19 | LL | fn bar() {} | -------- private associated function defined here @@ -203,7 +203,7 @@ LL | ::bar::A::bar(); | ^^^ private associated function error[E0624]: associated function `bar` is private - --> $DIR/privacy1.rs:105:24 + --> $DIR/privacy1.rs:100:24 | LL | fn bar() {} | -------- private associated function defined here @@ -212,7 +212,7 @@ LL | ::bar::baz::A::bar(); | ^^^ private associated function error[E0624]: method `bar2` is private - --> $DIR/privacy1.rs:108:23 + --> $DIR/privacy1.rs:103:23 | LL | fn bar2(&self) {} | -------------- private method defined here diff --git a/tests/ui/self/arbitrary-self-from-method-substs-ice.rs b/tests/ui/self/arbitrary-self-from-method-substs-ice.rs index 46e4afd8532e1..4f142ed29f2e0 100644 --- a/tests/ui/self/arbitrary-self-from-method-substs-ice.rs +++ b/tests/ui/self/arbitrary-self-from-method-substs-ice.rs @@ -8,8 +8,8 @@ use std::ops::Deref; struct Foo(u32); impl Foo { const fn get<R: Deref<Target = Self>>(self: R) -> u32 { - //~^ ERROR invalid generic `self` parameter type - //~| ERROR destructor of `R` cannot be evaluated at compile-time + //~^ ERROR destructor of `R` cannot be evaluated at compile-time + //~| ERROR invalid generic self.0 //~^ ERROR cannot perform non-const deref coercion on `R` in constant functions } @@ -18,6 +18,7 @@ impl Foo { const FOO: () = { let foo = Foo(1); foo.get::<&Foo>(); + //~^ ERROR mismatched types }; const BAR: [(); { diff --git a/tests/ui/self/arbitrary-self-from-method-substs-ice.stderr b/tests/ui/self/arbitrary-self-from-method-substs-ice.stderr index f217370b024b5..586813f7eaebc 100644 --- a/tests/ui/self/arbitrary-self-from-method-substs-ice.stderr +++ b/tests/ui/self/arbitrary-self-from-method-substs-ice.stderr @@ -1,3 +1,18 @@ +error[E0308]: mismatched types + --> $DIR/arbitrary-self-from-method-substs-ice.rs:20:5 + | +LL | foo.get::<&Foo>(); + | ^^^ expected `&Foo`, found `Foo` + +error[E0801]: invalid generic `self` parameter type: `R` + --> $DIR/arbitrary-self-from-method-substs-ice.rs:10:49 + | +LL | const fn get<R: Deref<Target = Self>>(self: R) -> u32 { + | ^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + error[E0015]: cannot perform non-const deref coercion on `R` in constant functions --> $DIR/arbitrary-self-from-method-substs-ice.rs:13:9 | @@ -16,16 +31,7 @@ LL | const fn get<R: Deref<Target = Self>>(self: R) -> u32 { LL | } | - value is dropped here -error[E0801]: invalid generic `self` parameter type: `R` - --> $DIR/arbitrary-self-from-method-substs-ice.rs:10:49 - | -LL | const fn get<R: Deref<Target = Self>>(self: R) -> u32 { - | ^ - | - = note: type of `self` must not be a method generic parameter type - = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) - -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0015, E0493, E0801. +Some errors have detailed explanations: E0015, E0308, E0493, E0801. For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/self/arbitrary-self-from-method-substs-with-receiver.rs b/tests/ui/self/arbitrary-self-from-method-substs-with-receiver.rs index 495d261c549ca..ba3bb3a0d7081 100644 --- a/tests/ui/self/arbitrary-self-from-method-substs-with-receiver.rs +++ b/tests/ui/self/arbitrary-self-from-method-substs-with-receiver.rs @@ -1,5 +1,3 @@ -#![feature(arbitrary_self_types)] - use std::ops::{Receiver, Deref}; struct SmartPtr<'a, T: ?Sized>(&'a T); diff --git a/tests/ui/self/arbitrary-self-from-method-substs-with-receiver.stderr b/tests/ui/self/arbitrary-self-from-method-substs-with-receiver.stderr index bafa290a3cfd0..d0dcd527c7fcc 100644 --- a/tests/ui/self/arbitrary-self-from-method-substs-with-receiver.stderr +++ b/tests/ui/self/arbitrary-self-from-method-substs-with-receiver.stderr @@ -1,5 +1,5 @@ error[E0801]: invalid generic `self` parameter type: `R` - --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:25:42 + --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:23:42 | LL | fn a<R: Receiver<Target=Self>>(self: R) -> u32 { | ^ @@ -8,7 +8,7 @@ LL | fn a<R: Receiver<Target=Self>>(self: R) -> u32 { = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) error[E0801]: invalid generic `self` parameter type: `R` - --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:29:39 + --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:27:39 | LL | fn b<R: Deref<Target=Self>>(self: R) -> u32 { | ^ @@ -17,7 +17,7 @@ LL | fn b<R: Deref<Target=Self>>(self: R) -> u32 { = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) error[E0801]: invalid generic `self` parameter type: `impl Receiver<Target = Self>` - --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:33:16 + --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:31:16 | LL | fn c(self: impl Receiver<Target=Self>) -> u32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | fn c(self: impl Receiver<Target=Self>) -> u32 { = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) error[E0801]: invalid generic `self` parameter type: `impl Deref<Target = Self>` - --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:37:16 + --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:35:16 | LL | fn d(self: impl Deref<Target=Self>) -> u32 { | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -35,19 +35,19 @@ LL | fn d(self: impl Deref<Target=Self>) -> u32 { = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) error[E0308]: mismatched types - --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:51:16 + --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:49:16 | LL | assert_eq!(foo.a::<&Foo>(), 2); | ^^^ expected `&Foo`, found `Foo` error[E0308]: mismatched types - --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:53:16 + --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:51:16 | LL | assert_eq!(foo.b::<&Foo>(), 1); | ^^^ expected `&Foo`, found `Foo` error[E0308]: mismatched types - --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:60:16 + --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:58:16 | LL | assert_eq!(smart_ptr.a::<&Foo>(), 2); | ^^^^^^^^^ expected `&Foo`, found `SmartPtr<'_, Foo>` @@ -56,7 +56,7 @@ LL | assert_eq!(smart_ptr.a::<&Foo>(), 2); found struct `SmartPtr<'_, Foo>` error[E0308]: mismatched types - --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:62:16 + --> $DIR/arbitrary-self-from-method-substs-with-receiver.rs:60:16 | LL | assert_eq!(smart_ptr.b::<&Foo>(), 1); | ^^^^^^^^^ expected `&Foo`, found `SmartPtr<'_, Foo>` diff --git a/tests/ui/self/arbitrary-self-from-method-substs.rs b/tests/ui/self/arbitrary-self-from-method-substs.rs index f2d6585961517..9f477018dc5cd 100644 --- a/tests/ui/self/arbitrary-self-from-method-substs.rs +++ b/tests/ui/self/arbitrary-self-from-method-substs.rs @@ -1,6 +1,3 @@ -//@ revisions: default feature -#![cfg_attr(feature, feature(arbitrary_self_types))] - use std::ops::Deref; use std::marker::PhantomData; @@ -31,7 +28,6 @@ impl Foo { self.0 } fn get6<FR: FindReceiver>(self: FR::Receiver, other: FR) -> u32 { - //[default]~^ ERROR: `<FR as FindReceiver>::Receiver` cannot be used as the type of `self` 42 } } @@ -59,7 +55,6 @@ struct Bar<R>(std::marker::PhantomData<R>); impl<R: std::ops::Deref<Target = Self>> Bar<R> { fn get(self: R) {} - //[default]~^ ERROR: `R` cannot be used as the type of `self` } trait FindReceiver { @@ -74,17 +69,17 @@ impl FindReceiver for Silly { fn main() { let mut foo = Foo(1); foo.get::<&Foo>(); - //[feature]~^ ERROR mismatched types + //~^ ERROR mismatched types foo.get::<std::rc::Rc<Foo>>(); - //[feature]~^ ERROR mismatched types + //~^ ERROR mismatched types let smart_ptr = SmartPtr(&foo); let smart_ptr2 = SmartPtr2(&foo); smart_ptr.get(); // this compiles smart_ptr.get::<SmartPtr2<Foo>>(); - //[feature]~^ ERROR mismatched types + //~^ ERROR mismatched types smart_ptr.get::<&Foo>(); - //[feature]~^ ERROR mismatched types + //~^ ERROR mismatched types let mut foo = Foo(1); // This test is slightly contrived in an attempt to generate a mismatched types diff --git a/tests/ui/self/arbitrary-self-from-method-substs.stderr b/tests/ui/self/arbitrary-self-from-method-substs.stderr new file mode 100644 index 0000000000000..2baddc06eed66 --- /dev/null +++ b/tests/ui/self/arbitrary-self-from-method-substs.stderr @@ -0,0 +1,179 @@ +error[E0801]: invalid generic `self` parameter type: `R` + --> $DIR/arbitrary-self-from-method-substs.rs:6:43 + | +LL | fn get<R: Deref<Target = Self>>(self: R) -> u32 { + | ^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `&R` + --> $DIR/arbitrary-self-from-method-substs.rs:10:44 + | +LL | fn get1<R: Deref<Target = Self>>(self: &R) -> u32 { + | ^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `&mut R` + --> $DIR/arbitrary-self-from-method-substs.rs:14:44 + | +LL | fn get2<R: Deref<Target = Self>>(self: &mut R) -> u32 { + | ^^^^^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `Rc<R>` + --> $DIR/arbitrary-self-from-method-substs.rs:18:44 + | +LL | fn get3<R: Deref<Target = Self>>(self: std::rc::Rc<R>) -> u32 { + | ^^^^^^^^^^^^^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `&Rc<R>` + --> $DIR/arbitrary-self-from-method-substs.rs:22:44 + | +LL | fn get4<R: Deref<Target = Self>>(self: &std::rc::Rc<R>) -> u32 { + | ^^^^^^^^^^^^^^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `Rc<&R>` + --> $DIR/arbitrary-self-from-method-substs.rs:26:44 + | +LL | fn get5<R: Deref<Target = Self>>(self: std::rc::Rc<&R>) -> u32 { + | ^^^^^^^^^^^^^^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0308]: mismatched types + --> $DIR/arbitrary-self-from-method-substs.rs:71:5 + | +LL | foo.get::<&Foo>(); + | ^^^ expected `&Foo`, found `Foo` + +error[E0308]: mismatched types + --> $DIR/arbitrary-self-from-method-substs.rs:73:5 + | +LL | foo.get::<std::rc::Rc<Foo>>(); + | ^^^ expected `Rc<Foo>`, found `Foo` + | + = note: expected struct `Rc<Foo>` + found struct `Foo` + +error[E0308]: mismatched types + --> $DIR/arbitrary-self-from-method-substs.rs:79:5 + | +LL | smart_ptr.get::<SmartPtr2<Foo>>(); + | ^^^^^^^^^ expected `SmartPtr2<'_, Foo>`, found `SmartPtr<'_, Foo>` + | + = note: expected struct `SmartPtr2<'_, Foo>` + found struct `SmartPtr<'_, Foo>` + +error[E0308]: mismatched types + --> $DIR/arbitrary-self-from-method-substs.rs:81:5 + | +LL | smart_ptr.get::<&Foo>(); + | ^^^^^^^^^ expected `&Foo`, found `SmartPtr<'_, Foo>` + | + = note: expected reference `&Foo` + found struct `SmartPtr<'_, Foo>` + +error[E0271]: type mismatch resolving `<Silly as FindReceiver>::Receiver == Foo` + --> $DIR/arbitrary-self-from-method-substs.rs:87:9 + | +LL | foo.get6(Silly); + | ^^^^ type mismatch resolving `<Silly as FindReceiver>::Receiver == Foo` + | +note: expected this to be `Foo` + --> $DIR/arbitrary-self-from-method-substs.rs:66:21 + | +LL | type Receiver = std::rc::Rc<Foo>; + | ^^^^^^^^^^^^^^^^ + = note: expected struct `Foo` + found struct `Rc<Foo>` + +error[E0271]: type mismatch resolving `<Silly as FindReceiver>::Receiver == &Foo` + --> $DIR/arbitrary-self-from-method-substs.rs:91:9 + | +LL | foo.get6(Silly); + | ^^^^ type mismatch resolving `<Silly as FindReceiver>::Receiver == &Foo` + | +note: expected this to be `&Foo` + --> $DIR/arbitrary-self-from-method-substs.rs:66:21 + | +LL | type Receiver = std::rc::Rc<Foo>; + | ^^^^^^^^^^^^^^^^ + = note: expected reference `&Foo` + found struct `Rc<Foo>` + +error[E0599]: the method `get` exists for struct `Rc<Bar<_>>`, but its trait bounds were not satisfied + --> $DIR/arbitrary-self-from-method-substs.rs:95:7 + | +LL | struct Bar<R>(std::marker::PhantomData<R>); + | ------------- doesn't satisfy `Bar<_>: Deref` +... +LL | t.get(); + | ^^^ method cannot be called on `Rc<Bar<_>>` due to unsatisfied trait bounds + | +note: the following trait bounds were not satisfied: + `<&Bar<_> as Deref>::Target = Bar<&Bar<_>>` + `<&Rc<Bar<_>> as Deref>::Target = Bar<&Rc<Bar<_>>>` + `<&mut Bar<_> as Deref>::Target = Bar<&mut Bar<_>>` + `<&mut Rc<Bar<_>> as Deref>::Target = Bar<&mut Rc<Bar<_>>>` + `<Rc<Bar<_>> as Deref>::Target = Bar<Rc<Bar<_>>>` + `Bar<_>: Deref` + --> $DIR/arbitrary-self-from-method-substs.rs:56:9 + | +LL | impl<R: std::ops::Deref<Target = Self>> Bar<R> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------ + | | | + | | unsatisfied trait bound introduced here + | unsatisfied trait bound introduced here +note: the trait `Deref` must be implemented + --> $SRC_DIR/core/src/ops/deref.rs:LL:COL + = help: items from traits can only be used if the trait is implemented and in scope + = note: the following trait defines an item `get`, perhaps you need to implement it: + candidate #1: `SliceIndex` + +error[E0599]: the method `get` exists for reference `&Rc<Bar<_>>`, but its trait bounds were not satisfied + --> $DIR/arbitrary-self-from-method-substs.rs:103:7 + | +LL | struct Bar<R>(std::marker::PhantomData<R>); + | ------------- doesn't satisfy `Bar<_>: Deref` +... +LL | t.get(); + | ^^^ method cannot be called on `&Rc<Bar<_>>` due to unsatisfied trait bounds + | +note: the following trait bounds were not satisfied: + `<&&Rc<Bar<_>> as Deref>::Target = Bar<&&Rc<Bar<_>>>` + `<&Bar<_> as Deref>::Target = Bar<&Bar<_>>` + `<&Rc<Bar<_>> as Deref>::Target = Bar<&Rc<Bar<_>>>` + `<&mut &Rc<Bar<_>> as Deref>::Target = Bar<&mut &Rc<Bar<_>>>` + `<&mut Bar<_> as Deref>::Target = Bar<&mut Bar<_>>` + `<&mut Rc<Bar<_>> as Deref>::Target = Bar<&mut Rc<Bar<_>>>` + `<Rc<Bar<_>> as Deref>::Target = Bar<Rc<Bar<_>>>` + `Bar<_>: Deref` + --> $DIR/arbitrary-self-from-method-substs.rs:56:9 + | +LL | impl<R: std::ops::Deref<Target = Self>> Bar<R> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------ + | | | + | | unsatisfied trait bound introduced here + | unsatisfied trait bound introduced here +note: the trait `Deref` must be implemented + --> $SRC_DIR/core/src/ops/deref.rs:LL:COL + = help: items from traits can only be used if the trait is implemented and in scope + = note: the following trait defines an item `get`, perhaps you need to implement it: + candidate #1: `SliceIndex` + +error: aborting due to 14 previous errors + +Some errors have detailed explanations: E0271, E0308, E0599, E0801. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/self/arbitrary-self-opaque.stderr b/tests/ui/self/arbitrary-self-opaque.stderr index c75165d9f8e27..0469aca27dc81 100644 --- a/tests/ui/self/arbitrary-self-opaque.stderr +++ b/tests/ui/self/arbitrary-self-opaque.stderr @@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `Bar` LL | fn foo(self: Bar) {} | ^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error: item does not constrain `Bar::{opaque#0}`, but has it in its signature --> $DIR/arbitrary-self-opaque.rs:7:8 diff --git a/tests/ui/self/arbitrary_self_type_infinite_recursion.rs b/tests/ui/self/arbitrary_self_type_infinite_recursion.rs index 6fbf35c0b867b..8cad28533fdd0 100644 --- a/tests/ui/self/arbitrary_self_type_infinite_recursion.rs +++ b/tests/ui/self/arbitrary_self_type_infinite_recursion.rs @@ -1,5 +1,3 @@ -#![feature(arbitrary_self_types)] - struct MySmartPtr<T>(T); impl<T> core::ops::Receiver for MySmartPtr<T> { diff --git a/tests/ui/self/arbitrary_self_type_infinite_recursion.stderr b/tests/ui/self/arbitrary_self_type_infinite_recursion.stderr index 5e652efb36454..213175b2f863b 100644 --- a/tests/ui/self/arbitrary_self_type_infinite_recursion.stderr +++ b/tests/ui/self/arbitrary_self_type_infinite_recursion.stderr @@ -1,5 +1,5 @@ error[E0055]: reached the recursion limit while auto-dereferencing `MySmartPtr<Content>` - --> $DIR/arbitrary_self_type_infinite_recursion.rs:12:19 + --> $DIR/arbitrary_self_type_infinite_recursion.rs:10:19 | LL | fn method(self: MySmartPtr<Self>) { // note self type | ^^^^^^^^^^^^^^^^ deref recursion limit reached @@ -7,7 +7,7 @@ LL | fn method(self: MySmartPtr<Self>) { // note self type = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`arbitrary_self_type_infinite_recursion`) error[E0055]: reached the recursion limit while auto-dereferencing `MySmartPtr<Content>` - --> $DIR/arbitrary_self_type_infinite_recursion.rs:12:19 + --> $DIR/arbitrary_self_type_infinite_recursion.rs:10:19 | LL | fn method(self: MySmartPtr<Self>) { // note self type | ^^^^^^^^^^^^^^^^ deref recursion limit reached @@ -16,7 +16,7 @@ LL | fn method(self: MySmartPtr<Self>) { // note self type = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0307]: invalid `self` parameter type: `MySmartPtr<Content>` - --> $DIR/arbitrary_self_type_infinite_recursion.rs:12:19 + --> $DIR/arbitrary_self_type_infinite_recursion.rs:10:19 | LL | fn method(self: MySmartPtr<Self>) { // note self type | ^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL | fn method(self: MySmartPtr<Self>) { // note self type = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0055]: reached the recursion limit while auto-dereferencing `MySmartPtr<Content>` - --> $DIR/arbitrary_self_type_infinite_recursion.rs:21:5 + --> $DIR/arbitrary_self_type_infinite_recursion.rs:19:5 | LL | p.method(); | ^^^^^^ deref recursion limit reached @@ -33,7 +33,7 @@ LL | p.method(); = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`arbitrary_self_type_infinite_recursion`) error[E0599]: no method named `method` found for struct `MySmartPtr` in the current scope - --> $DIR/arbitrary_self_type_infinite_recursion.rs:21:5 + --> $DIR/arbitrary_self_type_infinite_recursion.rs:19:5 | LL | struct MySmartPtr<T>(T); | -------------------- method `method` not found for this struct diff --git a/tests/ui/self/arbitrary_self_types_by_value_reborrow.rs b/tests/ui/self/arbitrary_self_types_by_value_reborrow.rs index de4db1b9afec7..19904ac7d8e44 100644 --- a/tests/ui/self/arbitrary_self_types_by_value_reborrow.rs +++ b/tests/ui/self/arbitrary_self_types_by_value_reborrow.rs @@ -1,6 +1,5 @@ //@ run-pass -#![feature(arbitrary_self_types)] #![allow(dead_code)] // With arbitrary self types v2, we show an error if there are diff --git a/tests/ui/self/arbitrary_self_types_dispatch_to_vtable.rs b/tests/ui/self/arbitrary_self_types_dispatch_to_vtable.rs index f9e346ea11e21..de5d2e4c87a6a 100644 --- a/tests/ui/self/arbitrary_self_types_dispatch_to_vtable.rs +++ b/tests/ui/self/arbitrary_self_types_dispatch_to_vtable.rs @@ -1,7 +1,6 @@ //@ check-pass #![feature(derive_coerce_pointee)] -#![feature(arbitrary_self_types)] use std::marker::CoercePointee; use std::ops::Receiver; diff --git a/tests/ui/self/arbitrary_self_types_generic_over_receiver.rs b/tests/ui/self/arbitrary_self_types_generic_over_receiver.rs index 8ccda9368addf..1214c3b09f3b6 100644 --- a/tests/ui/self/arbitrary_self_types_generic_over_receiver.rs +++ b/tests/ui/self/arbitrary_self_types_generic_over_receiver.rs @@ -1,5 +1,3 @@ -#![feature(arbitrary_self_types)] - use std::ops::{Receiver, Deref}; struct Foo(u32); diff --git a/tests/ui/self/arbitrary_self_types_generic_over_receiver.stderr b/tests/ui/self/arbitrary_self_types_generic_over_receiver.stderr index 2da3925341e2f..9d4843c9e28f3 100644 --- a/tests/ui/self/arbitrary_self_types_generic_over_receiver.stderr +++ b/tests/ui/self/arbitrary_self_types_generic_over_receiver.stderr @@ -1,5 +1,5 @@ error[E0801]: invalid generic `self` parameter type: `impl Receiver<Target = Self>` - --> $DIR/arbitrary_self_types_generic_over_receiver.rs:7:16 + --> $DIR/arbitrary_self_types_generic_over_receiver.rs:5:16 | LL | fn a(self: impl Receiver<Target=Self>) -> u32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | fn a(self: impl Receiver<Target=Self>) -> u32 { = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) error[E0801]: invalid generic `self` parameter type: `impl Deref<Target = Self>` - --> $DIR/arbitrary_self_types_generic_over_receiver.rs:11:16 + --> $DIR/arbitrary_self_types_generic_over_receiver.rs:9:16 | LL | fn b(self: impl Deref<Target=Self>) -> u32 { | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,14 +17,14 @@ LL | fn b(self: impl Deref<Target=Self>) -> u32 { = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) error[E0277]: the trait bound `Foo: std::ops::Receiver` is not satisfied - --> $DIR/arbitrary_self_types_generic_over_receiver.rs:19:9 + --> $DIR/arbitrary_self_types_generic_over_receiver.rs:17:9 | LL | foo.a(); | ^ the trait `std::ops::Receiver` is not implemented for `Foo` | = note: required for `Foo` to implement `std::ops::Receiver` note: required by a bound in `Foo::a` - --> $DIR/arbitrary_self_types_generic_over_receiver.rs:7:21 + --> $DIR/arbitrary_self_types_generic_over_receiver.rs:5:21 | LL | fn a(self: impl Receiver<Target=Self>) -> u32 { | ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Foo::a` @@ -36,13 +36,13 @@ LL | &mut foo.a(); | ++++ error[E0277]: the trait bound `Foo: Deref` is not satisfied - --> $DIR/arbitrary_self_types_generic_over_receiver.rs:21:9 + --> $DIR/arbitrary_self_types_generic_over_receiver.rs:19:9 | LL | foo.b(); | ^ the trait `Deref` is not implemented for `Foo` | note: required by a bound in `Foo::b` - --> $DIR/arbitrary_self_types_generic_over_receiver.rs:11:21 + --> $DIR/arbitrary_self_types_generic_over_receiver.rs:9:21 | LL | fn b(self: impl Deref<Target=Self>) -> u32 { | ^^^^^^^^^^^^^^^^^^ required by this bound in `Foo::b` diff --git a/tests/ui/self/arbitrary_self_types_generic_receiver.rs b/tests/ui/self/arbitrary_self_types_generic_receiver.rs index 0739fb778b605..14b272299b8c3 100644 --- a/tests/ui/self/arbitrary_self_types_generic_receiver.rs +++ b/tests/ui/self/arbitrary_self_types_generic_receiver.rs @@ -1,5 +1,3 @@ -#![feature(arbitrary_self_types)] - struct PtrA<T>(T); impl<T> core::ops::Receiver for PtrA<T> { diff --git a/tests/ui/self/arbitrary_self_types_generic_receiver.stderr b/tests/ui/self/arbitrary_self_types_generic_receiver.stderr index 788c55ea2f1c3..4f61ba182fbbf 100644 --- a/tests/ui/self/arbitrary_self_types_generic_receiver.stderr +++ b/tests/ui/self/arbitrary_self_types_generic_receiver.stderr @@ -1,5 +1,5 @@ error[E0801]: invalid generic `self` parameter type: `&R` - --> $DIR/arbitrary_self_types_generic_receiver.rs:26:53 + --> $DIR/arbitrary_self_types_generic_receiver.rs:24:53 | LL | fn a<R: core::ops::Receiver<Target=Self>>(self: &R) {} | ^^ @@ -8,7 +8,7 @@ LL | fn a<R: core::ops::Receiver<Target=Self>>(self: &R) {} = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) error[E0801]: invalid generic `self` parameter type: `&mut R` - --> $DIR/arbitrary_self_types_generic_receiver.rs:28:53 + --> $DIR/arbitrary_self_types_generic_receiver.rs:26:53 | LL | fn b<R: core::ops::Receiver<Target=Self>>(self: &mut R) {} | ^^^^^^ @@ -17,7 +17,7 @@ LL | fn b<R: core::ops::Receiver<Target=Self>>(self: &mut R) {} = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) error[E0801]: invalid generic `self` parameter type: `R` - --> $DIR/arbitrary_self_types_generic_receiver.rs:30:53 + --> $DIR/arbitrary_self_types_generic_receiver.rs:28:53 | LL | fn c<R: core::ops::Receiver<Target=Self>>(self: R) {} | ^ @@ -26,7 +26,7 @@ LL | fn c<R: core::ops::Receiver<Target=Self>>(self: R) {} = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) error[E0801]: invalid generic `self` parameter type: `R` - --> $DIR/arbitrary_self_types_generic_receiver.rs:32:45 + --> $DIR/arbitrary_self_types_generic_receiver.rs:30:45 | LL | fn d<R: SomePtr<SomeTarget=Self>>(self: R) {} | ^ @@ -35,7 +35,7 @@ LL | fn d<R: SomePtr<SomeTarget=Self>>(self: R) {} = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) error[E0801]: invalid generic `self` parameter type: `impl SomePtr<SomeTarget = Self>` - --> $DIR/arbitrary_self_types_generic_receiver.rs:34:16 + --> $DIR/arbitrary_self_types_generic_receiver.rs:32:16 | LL | fn e(self: impl SomePtr<SomeTarget=Self>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/self/arbitrary_self_types_lifetime_elision.rs b/tests/ui/self/arbitrary_self_types_lifetime_elision.rs index fd645c1013b64..2e2c5c20b519b 100644 --- a/tests/ui/self/arbitrary_self_types_lifetime_elision.rs +++ b/tests/ui/self/arbitrary_self_types_lifetime_elision.rs @@ -1,7 +1,5 @@ //@ run-pass -#![feature(arbitrary_self_types)] - #[derive(Clone)] struct SmartPtr<'a, T: ?Sized>(&'a T); diff --git a/tests/ui/self/arbitrary_self_types_niche_deshadowing.rs b/tests/ui/self/arbitrary_self_types_niche_deshadowing.rs index 9326eca1f5353..4356bf85fef04 100644 --- a/tests/ui/self/arbitrary_self_types_niche_deshadowing.rs +++ b/tests/ui/self/arbitrary_self_types_niche_deshadowing.rs @@ -3,7 +3,6 @@ #![allow(dead_code)] #![allow(incomplete_features)] -#![feature(arbitrary_self_types)] #![feature(arbitrary_self_types_pointers)] #![feature(pin_ergonomics)] diff --git a/tests/ui/self/arbitrary_self_types_no_generics.rs b/tests/ui/self/arbitrary_self_types_no_generics.rs index 8a6f57418829e..8e083656a06d7 100644 --- a/tests/ui/self/arbitrary_self_types_no_generics.rs +++ b/tests/ui/self/arbitrary_self_types_no_generics.rs @@ -1,7 +1,5 @@ //@ run-pass -#![feature(arbitrary_self_types)] - pub struct A; impl A { diff --git a/tests/ui/self/arbitrary_self_types_nonnull.rs b/tests/ui/self/arbitrary_self_types_nonnull.rs index ab1589b956e5b..cb96e73322a9f 100644 --- a/tests/ui/self/arbitrary_self_types_nonnull.rs +++ b/tests/ui/self/arbitrary_self_types_nonnull.rs @@ -1,5 +1,3 @@ -#![feature(arbitrary_self_types)] - struct A; impl A { diff --git a/tests/ui/self/arbitrary_self_types_nonnull.stderr b/tests/ui/self/arbitrary_self_types_nonnull.stderr index 5ebe58b4e48ec..a8f11113a70bd 100644 --- a/tests/ui/self/arbitrary_self_types_nonnull.stderr +++ b/tests/ui/self/arbitrary_self_types_nonnull.stderr @@ -1,5 +1,5 @@ error[E0307]: invalid `self` parameter type: `NonNull<A>` - --> $DIR/arbitrary_self_types_nonnull.rs:6:16 + --> $DIR/arbitrary_self_types_nonnull.rs:4:16 | LL | fn m(self: std::ptr::NonNull<Self>) {} | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | fn m(self: std::ptr::NonNull<Self>) {} = note: `NonNull` does not implement `Receiver` because it has methods that may shadow the referent; consider wrapping your `NonNull` in a newtype wrapper for which you implement `Receiver` error[E0307]: invalid `self` parameter type: `&NonNull<A>` - --> $DIR/arbitrary_self_types_nonnull.rs:8:16 + --> $DIR/arbitrary_self_types_nonnull.rs:6:16 | LL | fn n(self: &std::ptr::NonNull<Self>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.rs b/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.rs index 26e48f69d23ea..7db92e9ec14ae 100644 --- a/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.rs +++ b/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.rs @@ -1,5 +1,3 @@ -#![feature(arbitrary_self_types)] - use std::rc::Rc; struct Foo; diff --git a/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.stderr b/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.stderr index a30cf605829f8..667ff53bd568b 100644 --- a/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.stderr +++ b/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `frobnicate_ref` found for struct `CppRef` in the current scope - --> $DIR/arbitrary_self_types_not_allow_call_with_no_deref.rs:29:17 + --> $DIR/arbitrary_self_types_not_allow_call_with_no_deref.rs:27:17 | LL | struct CppRef<T>(T); | ---------------- method `frobnicate_ref` not found for this struct @@ -17,7 +17,7 @@ LL | foo_cpp_ref.frobnicate_cpp_ref(); | ++++ error[E0599]: no method named `frobnicate_self` found for struct `CppRef` in the current scope - --> $DIR/arbitrary_self_types_not_allow_call_with_no_deref.rs:32:17 + --> $DIR/arbitrary_self_types_not_allow_call_with_no_deref.rs:30:17 | LL | struct CppRef<T>(T); | ---------------- method `frobnicate_self` not found for this struct diff --git a/tests/ui/self/arbitrary_self_types_pin_getref.rs b/tests/ui/self/arbitrary_self_types_pin_getref.rs index 29dd907f7ff00..c418ba5f34f3e 100644 --- a/tests/ui/self/arbitrary_self_types_pin_getref.rs +++ b/tests/ui/self/arbitrary_self_types_pin_getref.rs @@ -1,10 +1,5 @@ // Confirms that Pin::get_ref can no longer shadow methods in pointees // once arbitrary_self_types is enabled. -// -//@ revisions: default feature -#![cfg_attr(feature, feature(arbitrary_self_types))] - -//@[default] check-pass #![allow(dead_code)] @@ -21,5 +16,5 @@ fn main() { let pinned_a: Pin<&mut A> = pin!(A); let pinned_a: Pin<&A> = pinned_a.as_ref(); let _ = pinned_a.get_ref(); - //[feature]~^ ERROR: multiple applicable items + //~^ ERROR: multiple applicable items } diff --git a/tests/ui/self/arbitrary_self_types_pin_getref.feature.stderr b/tests/ui/self/arbitrary_self_types_pin_getref.stderr similarity index 82% rename from tests/ui/self/arbitrary_self_types_pin_getref.feature.stderr rename to tests/ui/self/arbitrary_self_types_pin_getref.stderr index 52cf69f33a54b..f4bd25a66f788 100644 --- a/tests/ui/self/arbitrary_self_types_pin_getref.feature.stderr +++ b/tests/ui/self/arbitrary_self_types_pin_getref.stderr @@ -1,11 +1,11 @@ error[E0034]: multiple applicable items in scope - --> $DIR/arbitrary_self_types_pin_getref.rs:23:22 + --> $DIR/arbitrary_self_types_pin_getref.rs:18:22 | LL | let _ = pinned_a.get_ref(); | ^^^^^^^ multiple `get_ref` found | note: candidate #1 is defined in an impl for the type `A` - --> $DIR/arbitrary_self_types_pin_getref.rs:17:5 + --> $DIR/arbitrary_self_types_pin_getref.rs:12:5 | LL | fn get_ref(self: &Pin<&A>) {} // note &Pin | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/self/arbitrary_self_types_pointers_and_wrappers.rs b/tests/ui/self/arbitrary_self_types_pointers_and_wrappers.rs index 76d7754384ebe..e82c91b168443 100644 --- a/tests/ui/self/arbitrary_self_types_pointers_and_wrappers.rs +++ b/tests/ui/self/arbitrary_self_types_pointers_and_wrappers.rs @@ -1,5 +1,5 @@ //@ run-pass -#![feature(arbitrary_self_types, unsize, coerce_unsized, dispatch_from_dyn)] +#![feature(unsize, coerce_unsized, dispatch_from_dyn)] #![feature(rustc_attrs)] use std::{ diff --git a/tests/ui/self/arbitrary_self_types_recursive_receiver.rs b/tests/ui/self/arbitrary_self_types_recursive_receiver.rs index 8b1b6a8a105f3..1c27e8d38a94f 100644 --- a/tests/ui/self/arbitrary_self_types_recursive_receiver.rs +++ b/tests/ui/self/arbitrary_self_types_recursive_receiver.rs @@ -1,5 +1,4 @@ //@ run-pass -#![feature(arbitrary_self_types)] // When probing for methods, we step forward through a chain of types. The first // few of those steps can be reached by jumping through the chain of Derefs or the diff --git a/tests/ui/self/arbitrary_self_types_shadowing_val_constptr.rs b/tests/ui/self/arbitrary_self_types_shadowing_val_constptr.rs index 2b718cb0454ce..418c29b5a95c9 100644 --- a/tests/ui/self/arbitrary_self_types_shadowing_val_constptr.rs +++ b/tests/ui/self/arbitrary_self_types_shadowing_val_constptr.rs @@ -1,6 +1,5 @@ //@ run-pass -#![feature(arbitrary_self_types)] #![feature(arbitrary_self_types_pointers)] pub struct A; diff --git a/tests/ui/self/arbitrary_self_types_silly.rs b/tests/ui/self/arbitrary_self_types_silly.rs index 94726bd69cc57..698bb1dd8e324 100644 --- a/tests/ui/self/arbitrary_self_types_silly.rs +++ b/tests/ui/self/arbitrary_self_types_silly.rs @@ -1,5 +1,4 @@ //@ run-pass -#![feature(arbitrary_self_types)] struct Foo; struct Bar; diff --git a/tests/ui/self/arbitrary_self_types_stdlib_pointers.rs b/tests/ui/self/arbitrary_self_types_stdlib_pointers.rs index 4b8a21f764855..fcff235aedd2d 100644 --- a/tests/ui/self/arbitrary_self_types_stdlib_pointers.rs +++ b/tests/ui/self/arbitrary_self_types_stdlib_pointers.rs @@ -1,5 +1,4 @@ //@ run-pass -#![feature(arbitrary_self_types)] #![feature(rustc_attrs)] use std::{ diff --git a/tests/ui/self/arbitrary_self_types_struct_receiver_trait.rs b/tests/ui/self/arbitrary_self_types_struct_receiver_trait.rs index cebf0ea7cba93..38f89ba5b5956 100644 --- a/tests/ui/self/arbitrary_self_types_struct_receiver_trait.rs +++ b/tests/ui/self/arbitrary_self_types_struct_receiver_trait.rs @@ -1,5 +1,4 @@ //@ run-pass -#![feature(arbitrary_self_types)] use std::ops::Receiver; diff --git a/tests/ui/self/arbitrary_self_types_trait_receiver_trait.rs b/tests/ui/self/arbitrary_self_types_trait_receiver_trait.rs index 9c0402da0befe..7d59d8662ff21 100644 --- a/tests/ui/self/arbitrary_self_types_trait_receiver_trait.rs +++ b/tests/ui/self/arbitrary_self_types_trait_receiver_trait.rs @@ -1,5 +1,4 @@ //@ run-pass -#![feature(arbitrary_self_types)] #![allow(unused_allocation)] struct SmartPtr<T: ?Sized>(T); diff --git a/tests/ui/self/arbitrary_self_types_unshadowing.rs b/tests/ui/self/arbitrary_self_types_unshadowing.rs index cd195654cc195..c9e56d6754cf2 100644 --- a/tests/ui/self/arbitrary_self_types_unshadowing.rs +++ b/tests/ui/self/arbitrary_self_types_unshadowing.rs @@ -1,5 +1,3 @@ -#![feature(arbitrary_self_types)] - pub struct A; // The receiver of the potentially shadowed method diff --git a/tests/ui/self/arbitrary_self_types_unshadowing.stderr b/tests/ui/self/arbitrary_self_types_unshadowing.stderr index 3a126c495c94d..bda9468b259b3 100644 --- a/tests/ui/self/arbitrary_self_types_unshadowing.stderr +++ b/tests/ui/self/arbitrary_self_types_unshadowing.stderr @@ -1,101 +1,101 @@ error[E0034]: multiple applicable items in scope - --> $DIR/arbitrary_self_types_unshadowing.rs:42:27 + --> $DIR/arbitrary_self_types_unshadowing.rs:40:27 | LL | assert_eq!(Wrapper(A).f(), 1); | ^ multiple `f` found | note: candidate #1 is defined in an impl for the type `A` - --> $DIR/arbitrary_self_types_unshadowing.rs:8:5 + --> $DIR/arbitrary_self_types_unshadowing.rs:6:5 | LL | pub fn f(self: Wrapper<Self>) -> i32 { 1 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: candidate #2 is defined in an impl for the type `Wrapper<T>` - --> $DIR/arbitrary_self_types_unshadowing.rs:36:5 + --> $DIR/arbitrary_self_types_unshadowing.rs:34:5 | LL | pub fn f(self) -> i32 { 5 } | ^^^^^^^^^^^^^^^^^^^^^ error[E0034]: multiple applicable items in scope - --> $DIR/arbitrary_self_types_unshadowing.rs:44:27 + --> $DIR/arbitrary_self_types_unshadowing.rs:42:27 | LL | assert_eq!(Wrapper(A).g(), 2); | ^ multiple `g` found | note: candidate #1 is defined in an impl for the type `A` - --> $DIR/arbitrary_self_types_unshadowing.rs:9:5 + --> $DIR/arbitrary_self_types_unshadowing.rs:7:5 | LL | pub fn g(self: &Wrapper<Self>) -> i32 { 2 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: candidate #2 is defined in an impl for the type `Wrapper<T>` - --> $DIR/arbitrary_self_types_unshadowing.rs:37:5 + --> $DIR/arbitrary_self_types_unshadowing.rs:35:5 | LL | pub fn g(&self) -> i32 { 6 } | ^^^^^^^^^^^^^^^^^^^^^^ error[E0034]: multiple applicable items in scope - --> $DIR/arbitrary_self_types_unshadowing.rs:46:27 + --> $DIR/arbitrary_self_types_unshadowing.rs:44:27 | LL | assert_eq!(Wrapper(A).h(), 3); | ^ multiple `h` found | note: candidate #1 is defined in an impl for the type `A` - --> $DIR/arbitrary_self_types_unshadowing.rs:10:5 + --> $DIR/arbitrary_self_types_unshadowing.rs:8:5 | LL | pub fn h(self: &mut Wrapper<Self>) -> i32 { 3 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: candidate #2 is defined in an impl for the type `Wrapper<T>` - --> $DIR/arbitrary_self_types_unshadowing.rs:38:5 + --> $DIR/arbitrary_self_types_unshadowing.rs:36:5 | LL | pub fn h(&mut self) -> i32 { 7 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0034]: multiple applicable items in scope - --> $DIR/arbitrary_self_types_unshadowing.rs:49:27 + --> $DIR/arbitrary_self_types_unshadowing.rs:47:27 | LL | assert_eq!(Wrapper(B).f(), 9); | ^ multiple `f` found | note: candidate #1 is defined in an impl for the type `B` - --> $DIR/arbitrary_self_types_unshadowing.rs:17:5 + --> $DIR/arbitrary_self_types_unshadowing.rs:15:5 | LL | pub fn f(self: &Wrapper<Self>) -> i32 { 9 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: candidate #2 is defined in an impl for the type `Wrapper<T>` - --> $DIR/arbitrary_self_types_unshadowing.rs:36:5 + --> $DIR/arbitrary_self_types_unshadowing.rs:34:5 | LL | pub fn f(self) -> i32 { 5 } | ^^^^^^^^^^^^^^^^^^^^^ error[E0034]: multiple applicable items in scope - --> $DIR/arbitrary_self_types_unshadowing.rs:51:27 + --> $DIR/arbitrary_self_types_unshadowing.rs:49:27 | LL | assert_eq!(Wrapper(C).f(), 10); | ^ multiple `f` found | note: candidate #1 is defined in an impl for the type `C` - --> $DIR/arbitrary_self_types_unshadowing.rs:25:5 + --> $DIR/arbitrary_self_types_unshadowing.rs:23:5 | LL | pub fn f(self: &mut Wrapper<Self>) -> i32 { 10 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: candidate #2 is defined in an impl for the type `Wrapper<T>` - --> $DIR/arbitrary_self_types_unshadowing.rs:36:5 + --> $DIR/arbitrary_self_types_unshadowing.rs:34:5 | LL | pub fn f(self) -> i32 { 5 } | ^^^^^^^^^^^^^^^^^^^^^ error[E0034]: multiple applicable items in scope - --> $DIR/arbitrary_self_types_unshadowing.rs:53:27 + --> $DIR/arbitrary_self_types_unshadowing.rs:51:27 | LL | assert_eq!(Wrapper(C).g(), 11); | ^ multiple `g` found | note: candidate #1 is defined in an impl for the type `C` - --> $DIR/arbitrary_self_types_unshadowing.rs:26:5 + --> $DIR/arbitrary_self_types_unshadowing.rs:24:5 | LL | pub fn g(self: &mut Wrapper<Self>) -> i32 { 11 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: candidate #2 is defined in an impl for the type `Wrapper<T>` - --> $DIR/arbitrary_self_types_unshadowing.rs:37:5 + --> $DIR/arbitrary_self_types_unshadowing.rs:35:5 | LL | pub fn g(&self) -> i32 { 6 } | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/self/arbitrary_self_types_unshadowing_ptrs.rs b/tests/ui/self/arbitrary_self_types_unshadowing_ptrs.rs index 62553c2622a7e..e3180190d1c1c 100644 --- a/tests/ui/self/arbitrary_self_types_unshadowing_ptrs.rs +++ b/tests/ui/self/arbitrary_self_types_unshadowing_ptrs.rs @@ -1,5 +1,4 @@ #![feature(arbitrary_self_types_pointers)] -#![feature(arbitrary_self_types)] pub struct A; diff --git a/tests/ui/self/arbitrary_self_types_unshadowing_ptrs.stderr b/tests/ui/self/arbitrary_self_types_unshadowing_ptrs.stderr index 6d453aed0f06d..8ebae45162211 100644 --- a/tests/ui/self/arbitrary_self_types_unshadowing_ptrs.stderr +++ b/tests/ui/self/arbitrary_self_types_unshadowing_ptrs.stderr @@ -1,118 +1,118 @@ error[E0034]: multiple applicable items in scope - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:45:27 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:44:27 | LL | assert_eq!(Wrapper(A).f(), 1); | ^ multiple `f` found | note: candidate #1 is defined in an impl for the type `A` - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:9:5 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:8:5 | LL | pub fn f(self: Wrapper<Self>) -> i32 { 1 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: candidate #2 is defined in an impl for the type `Wrapper<T>` - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:38:5 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:37:5 | LL | pub fn f(self) -> i32 { 5 } | ^^^^^^^^^^^^^^^^^^^^^ error[E0034]: multiple applicable items in scope - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:47:27 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:46:27 | LL | assert_eq!(Wrapper(A).g(), 2); | ^ multiple `g` found | note: candidate #1 is defined in an impl for the type `A` - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:10:5 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:9:5 | LL | pub fn g(self: &Wrapper<Self>) -> i32 { 2 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: candidate #2 is defined in an impl for the type `Wrapper<T>` - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:39:5 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:38:5 | LL | pub fn g(&self) -> i32 { 6 } | ^^^^^^^^^^^^^^^^^^^^^^ error[E0034]: multiple applicable items in scope - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:49:27 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:48:27 | LL | assert_eq!(Wrapper(A).h(), 3); | ^ multiple `h` found | note: candidate #1 is defined in an impl for the type `A` - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:11:5 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:10:5 | LL | pub fn h(self: &mut Wrapper<Self>) -> i32 { 3 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: candidate #2 is defined in an impl for the type `Wrapper<T>` - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:40:5 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:39:5 | LL | pub fn h(&mut self) -> i32 { 7 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0034]: multiple applicable items in scope - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:53:22 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:52:22 | LL | assert_eq!(a_ptr.i(), 4); | ^ multiple `i` found | note: candidate #1 is defined in an impl for the type `A` - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:12:5 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:11:5 | LL | pub fn i(self: *const Wrapper<Self>) -> i32 { 4 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: candidate #2 is defined in an impl for the type `Wrapper<T>` - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:41:5 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:40:5 | LL | pub fn i(self: *const Self) -> i32 { 8 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0034]: multiple applicable items in scope - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:55:27 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:54:27 | LL | assert_eq!(Wrapper(B).f(), 9); | ^ multiple `f` found | note: candidate #1 is defined in an impl for the type `B` - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:19:5 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:18:5 | LL | pub fn f(self: &Wrapper<Self>) -> i32 { 9 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: candidate #2 is defined in an impl for the type `Wrapper<T>` - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:38:5 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:37:5 | LL | pub fn f(self) -> i32 { 5 } | ^^^^^^^^^^^^^^^^^^^^^ error[E0034]: multiple applicable items in scope - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:57:27 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:56:27 | LL | assert_eq!(Wrapper(C).f(), 10); | ^ multiple `f` found | note: candidate #1 is defined in an impl for the type `C` - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:27:5 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:26:5 | LL | pub fn f(self: &mut Wrapper<Self>) -> i32 { 10 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: candidate #2 is defined in an impl for the type `Wrapper<T>` - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:38:5 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:37:5 | LL | pub fn f(self) -> i32 { 5 } | ^^^^^^^^^^^^^^^^^^^^^ error[E0034]: multiple applicable items in scope - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:59:27 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:58:27 | LL | assert_eq!(Wrapper(C).g(), 11); | ^ multiple `g` found | note: candidate #1 is defined in an impl for the type `C` - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:28:5 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:27:5 | LL | pub fn g(self: &mut Wrapper<Self>) -> i32 { 11 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: candidate #2 is defined in an impl for the type `Wrapper<T>` - --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:39:5 + --> $DIR/arbitrary_self_types_unshadowing_ptrs.rs:38:5 | LL | pub fn g(&self) -> i32 { 6 } | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/self/arbitrary_self_types_weak.rs b/tests/ui/self/arbitrary_self_types_weak.rs index 91f2b9e0a95f5..bd036f971e753 100644 --- a/tests/ui/self/arbitrary_self_types_weak.rs +++ b/tests/ui/self/arbitrary_self_types_weak.rs @@ -1,5 +1,3 @@ -#![feature(arbitrary_self_types)] - struct A; impl A { diff --git a/tests/ui/self/arbitrary_self_types_weak.stderr b/tests/ui/self/arbitrary_self_types_weak.stderr index 42d239419ad01..8a4508bbffa62 100644 --- a/tests/ui/self/arbitrary_self_types_weak.stderr +++ b/tests/ui/self/arbitrary_self_types_weak.stderr @@ -1,5 +1,5 @@ error[E0307]: invalid `self` parameter type: `std::rc::Weak<A>` - --> $DIR/arbitrary_self_types_weak.rs:6:16 + --> $DIR/arbitrary_self_types_weak.rs:4:16 | LL | fn m(self: std::rc::Weak<Self>) {} | ^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | fn m(self: std::rc::Weak<Self>) {} = note: `Weak` does not implement `Receiver` because it has methods that may shadow the referent; consider wrapping your `Weak` in a newtype wrapper for which you implement `Receiver` error[E0307]: invalid `self` parameter type: `std::sync::Weak<A>` - --> $DIR/arbitrary_self_types_weak.rs:8:16 + --> $DIR/arbitrary_self_types_weak.rs:6:16 | LL | fn n(self: std::sync::Weak<Self>) {} | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/self/conflicting_inner.rs b/tests/ui/self/conflicting_inner.rs index 1a7037dce7393..74ef8e44daddf 100644 --- a/tests/ui/self/conflicting_inner.rs +++ b/tests/ui/self/conflicting_inner.rs @@ -1,6 +1,4 @@ //@ run-pass -//@ revisions: default feature -#![cfg_attr(feature, feature(arbitrary_self_types))] // This test aims to be like the IndexVec within rustc, and conflicts // over its into_iter(). diff --git a/tests/ui/self/conflicting_inner2.feature.stderr b/tests/ui/self/conflicting_inner2.feature.stderr new file mode 100644 index 0000000000000..de45431dfd52e --- /dev/null +++ b/tests/ui/self/conflicting_inner2.feature.stderr @@ -0,0 +1,10 @@ +warning: the feature `arbitrary_self_types` has been stable since 1.84.0-dev and no longer requires an attribute to enable + --> $DIR/conflicting_inner2.rs:3:30 + | +LL | #![cfg_attr(feature, feature(arbitrary_self_types))] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(stable_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/self/conflicting_inner2.rs b/tests/ui/self/conflicting_inner2.rs index e6a6b5ef793e3..ad51dbf9b476c 100644 --- a/tests/ui/self/conflicting_inner2.rs +++ b/tests/ui/self/conflicting_inner2.rs @@ -1,6 +1,4 @@ //@ run-pass -//@ revisions: default feature -#![cfg_attr(feature, feature(arbitrary_self_types))] use std::pin::Pin; use std::ops::DerefMut; diff --git a/tests/ui/self/dispatch-from-dyn-layout-3.rs b/tests/ui/self/dispatch-from-dyn-layout-3.rs index 6878a4f4ac271..f8b9f528fa2bc 100644 --- a/tests/ui/self/dispatch-from-dyn-layout-3.rs +++ b/tests/ui/self/dispatch-from-dyn-layout-3.rs @@ -4,7 +4,6 @@ // we have impossible-to-satisfy `DispatchFromDyn` predicates. #![feature(dispatch_from_dyn)] -#![feature(arbitrary_self_types)] use std::ops::Deref; use std::ops::DispatchFromDyn; diff --git a/tests/ui/self/dispatch-from-dyn-layout.rs b/tests/ui/self/dispatch-from-dyn-layout.rs index 468dc89a73e61..105486a6b6a44 100644 --- a/tests/ui/self/dispatch-from-dyn-layout.rs +++ b/tests/ui/self/dispatch-from-dyn-layout.rs @@ -4,7 +4,7 @@ // Make sure that object safety checking doesn't freak out when // we have impossible-to-satisfy `DispatchFromDyn` predicates. -#![feature(arbitrary_self_types, dispatch_from_dyn)] +#![feature(dispatch_from_dyn)] use std::ops::{Deref, DispatchFromDyn}; diff --git a/tests/ui/self/dispatch-from-dyn-zst-transmute-zst-nonzst.rs b/tests/ui/self/dispatch-from-dyn-zst-transmute-zst-nonzst.rs index 94b76fe96854e..30bb6d7f2c5d9 100644 --- a/tests/ui/self/dispatch-from-dyn-zst-transmute-zst-nonzst.rs +++ b/tests/ui/self/dispatch-from-dyn-zst-transmute-zst-nonzst.rs @@ -2,7 +2,6 @@ // fields that weren't ZSTs. I don't believe this was possible to abuse, but // it's at least nice to give users better errors. -#![feature(arbitrary_self_types)] #![feature(unsize)] #![feature(dispatch_from_dyn)] diff --git a/tests/ui/self/dispatch-from-dyn-zst-transmute-zst-nonzst.stderr b/tests/ui/self/dispatch-from-dyn-zst-transmute-zst-nonzst.stderr index 91760b9e2eab5..9b903bbba9eaf 100644 --- a/tests/ui/self/dispatch-from-dyn-zst-transmute-zst-nonzst.stderr +++ b/tests/ui/self/dispatch-from-dyn-zst-transmute-zst-nonzst.stderr @@ -1,5 +1,5 @@ error[E0375]: implementing `DispatchFromDyn` does not allow multiple fields to be coerced - --> $DIR/dispatch-from-dyn-zst-transmute-zst-nonzst.rs:17:1 + --> $DIR/dispatch-from-dyn-zst-transmute-zst-nonzst.rs:16:1 | LL | / impl<T, U> DispatchFromDyn<Dispatchable<U, i32>> for Dispatchable<T, ()> LL | | @@ -9,7 +9,7 @@ LL | | U: ?Sized, | |______________^ | note: the trait `DispatchFromDyn` may only be implemented when a single field is being coerced - --> $DIR/dispatch-from-dyn-zst-transmute-zst-nonzst.rs:13:5 + --> $DIR/dispatch-from-dyn-zst-transmute-zst-nonzst.rs:12:5 | LL | _ptr: Box<T>, | ^^^^^^^^^^^^ diff --git a/tests/ui/self/dispatch-from-dyn-zst-transmute.rs b/tests/ui/self/dispatch-from-dyn-zst-transmute.rs index 967958ab48695..e39f8948eed7d 100644 --- a/tests/ui/self/dispatch-from-dyn-zst-transmute.rs +++ b/tests/ui/self/dispatch-from-dyn-zst-transmute.rs @@ -1,4 +1,3 @@ -#![feature(arbitrary_self_types)] #![feature(unsize)] #![feature(dispatch_from_dyn)] diff --git a/tests/ui/self/dispatch-from-dyn-zst-transmute.stderr b/tests/ui/self/dispatch-from-dyn-zst-transmute.stderr index cc8be45e99d8a..afaa6d4e31cd8 100644 --- a/tests/ui/self/dispatch-from-dyn-zst-transmute.stderr +++ b/tests/ui/self/dispatch-from-dyn-zst-transmute.stderr @@ -1,5 +1,5 @@ error[E0375]: implementing `DispatchFromDyn` does not allow multiple fields to be coerced - --> $DIR/dispatch-from-dyn-zst-transmute.rs:17:1 + --> $DIR/dispatch-from-dyn-zst-transmute.rs:16:1 | LL | / impl<'a, T, U> DispatchFromDyn<Foo<'a, U>> for Foo<'a, T> LL | | @@ -9,7 +9,7 @@ LL | | U: ?Sized {} | |_____________^ | note: the trait `DispatchFromDyn` may only be implemented when a single field is being coerced - --> $DIR/dispatch-from-dyn-zst-transmute.rs:13:5 + --> $DIR/dispatch-from-dyn-zst-transmute.rs:12:5 | LL | token: IsSendToken<U>, | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/self/elision/multiple-ref-self-async.rs b/tests/ui/self/elision/multiple-ref-self-async.rs index f63b455901ee0..2fa9a6719ed42 100644 --- a/tests/ui/self/elision/multiple-ref-self-async.rs +++ b/tests/ui/self/elision/multiple-ref-self-async.rs @@ -1,6 +1,5 @@ //@ edition:2018 -#![feature(arbitrary_self_types)] #![allow(non_snake_case)] use std::marker::PhantomData; diff --git a/tests/ui/self/elision/multiple-ref-self-async.stderr b/tests/ui/self/elision/multiple-ref-self-async.stderr index e2abc7c1e7852..241929c311a3e 100644 --- a/tests/ui/self/elision/multiple-ref-self-async.stderr +++ b/tests/ui/self/elision/multiple-ref-self-async.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/multiple-ref-self-async.rs:22:74 + --> $DIR/multiple-ref-self-async.rs:21:74 | LL | async fn wrap_ref_Self_ref_Self(self: Wrap<&Self, &Self>, f: &u8) -> &u8 { | ------------------ --- ^ expected named lifetime parameter @@ -11,7 +11,7 @@ LL | async fn wrap_ref_Self_ref_Self<'a>(self: Wrap<&'a Self, &'a Self>, f: | ++++ ++ ++ ++ ++ error[E0106]: missing lifetime specifier - --> $DIR/multiple-ref-self-async.rs:27:84 + --> $DIR/multiple-ref-self-async.rs:26:84 | LL | async fn box_wrap_ref_Self_ref_Self(self: Box<Wrap<&Self, &Self>>, f: &u32) -> &u32 { | ----------------------- ---- ^ expected named lifetime parameter @@ -23,7 +23,7 @@ LL | async fn box_wrap_ref_Self_ref_Self<'a>(self: Box<Wrap<&'a Self, &'a Se | ++++ ++ ++ ++ ++ error[E0106]: missing lifetime specifier - --> $DIR/multiple-ref-self-async.rs:32:84 + --> $DIR/multiple-ref-self-async.rs:31:84 | LL | async fn pin_wrap_ref_Self_ref_Self(self: Pin<Wrap<&Self, &Self>>, f: &u32) -> &u32 { | ----------------------- ---- ^ expected named lifetime parameter @@ -35,7 +35,7 @@ LL | async fn pin_wrap_ref_Self_ref_Self<'a>(self: Pin<Wrap<&'a Self, &'a Se | ++++ ++ ++ ++ ++ error[E0106]: missing lifetime specifier - --> $DIR/multiple-ref-self-async.rs:37:93 + --> $DIR/multiple-ref-self-async.rs:36:93 | LL | async fn box_box_wrap_ref_Self_ref_Self(self: Box<Box<Wrap<&Self, &Self>>>, f: &u32) -> &u32 { | ---------------------------- ---- ^ expected named lifetime parameter @@ -47,7 +47,7 @@ LL | async fn box_box_wrap_ref_Self_ref_Self<'a>(self: Box<Box<Wrap<&'a Self | ++++ ++ ++ ++ ++ error[E0106]: missing lifetime specifier - --> $DIR/multiple-ref-self-async.rs:42:93 + --> $DIR/multiple-ref-self-async.rs:41:93 | LL | async fn box_pin_wrap_ref_Self_ref_Self(self: Box<Pin<Wrap<&Self, &Self>>>, f: &u32) -> &u32 { | ---------------------------- ---- ^ expected named lifetime parameter diff --git a/tests/ui/self/elision/multiple-ref-self.rs b/tests/ui/self/elision/multiple-ref-self.rs index dd9b138051d0b..a83c7727ec476 100644 --- a/tests/ui/self/elision/multiple-ref-self.rs +++ b/tests/ui/self/elision/multiple-ref-self.rs @@ -1,4 +1,3 @@ -#![feature(arbitrary_self_types)] #![allow(non_snake_case)] use std::marker::PhantomData; diff --git a/tests/ui/self/elision/multiple-ref-self.stderr b/tests/ui/self/elision/multiple-ref-self.stderr index 24d74d352e482..9f18e06e00fb4 100644 --- a/tests/ui/self/elision/multiple-ref-self.stderr +++ b/tests/ui/self/elision/multiple-ref-self.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/multiple-ref-self.rs:20:68 + --> $DIR/multiple-ref-self.rs:19:68 | LL | fn wrap_ref_Self_ref_Self(self: Wrap<&Self, &Self>, f: &u8) -> &u8 { | ------------------ --- ^ expected named lifetime parameter @@ -11,7 +11,7 @@ LL | fn wrap_ref_Self_ref_Self<'a>(self: Wrap<&'a Self, &'a Self>, f: &'a u8 | ++++ ++ ++ ++ ++ error[E0106]: missing lifetime specifier - --> $DIR/multiple-ref-self.rs:25:78 + --> $DIR/multiple-ref-self.rs:24:78 | LL | fn box_wrap_ref_Self_ref_Self(self: Box<Wrap<&Self, &Self>>, f: &u32) -> &u32 { | ----------------------- ---- ^ expected named lifetime parameter @@ -23,7 +23,7 @@ LL | fn box_wrap_ref_Self_ref_Self<'a>(self: Box<Wrap<&'a Self, &'a Self>>, | ++++ ++ ++ ++ ++ error[E0106]: missing lifetime specifier - --> $DIR/multiple-ref-self.rs:30:78 + --> $DIR/multiple-ref-self.rs:29:78 | LL | fn pin_wrap_ref_Self_ref_Self(self: Pin<Wrap<&Self, &Self>>, f: &u32) -> &u32 { | ----------------------- ---- ^ expected named lifetime parameter @@ -35,7 +35,7 @@ LL | fn pin_wrap_ref_Self_ref_Self<'a>(self: Pin<Wrap<&'a Self, &'a Self>>, | ++++ ++ ++ ++ ++ error[E0106]: missing lifetime specifier - --> $DIR/multiple-ref-self.rs:35:87 + --> $DIR/multiple-ref-self.rs:34:87 | LL | fn box_box_wrap_ref_Self_ref_Self(self: Box<Box<Wrap<&Self, &Self>>>, f: &u32) -> &u32 { | ---------------------------- ---- ^ expected named lifetime parameter @@ -47,7 +47,7 @@ LL | fn box_box_wrap_ref_Self_ref_Self<'a>(self: Box<Box<Wrap<&'a Self, &'a | ++++ ++ ++ ++ ++ error[E0106]: missing lifetime specifier - --> $DIR/multiple-ref-self.rs:40:87 + --> $DIR/multiple-ref-self.rs:39:87 | LL | fn box_pin_wrap_ref_Self_ref_Self(self: Box<Pin<Wrap<&Self, &Self>>>, f: &u32) -> &u32 { | ---------------------------- ---- ^ expected named lifetime parameter diff --git a/tests/ui/self/elision/ref-self-async.rs b/tests/ui/self/elision/ref-self-async.rs index 1f3e670d3d1df..74428546e49be 100644 --- a/tests/ui/self/elision/ref-self-async.rs +++ b/tests/ui/self/elision/ref-self-async.rs @@ -1,7 +1,6 @@ //@ edition:2018 #![allow(non_snake_case)] -#![feature(arbitrary_self_types)] use std::marker::PhantomData; use std::ops::Deref; diff --git a/tests/ui/self/elision/ref-self-async.stderr b/tests/ui/self/elision/ref-self-async.stderr index a75ece5f2c768..f2478f361c4f0 100644 --- a/tests/ui/self/elision/ref-self-async.stderr +++ b/tests/ui/self/elision/ref-self-async.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:23:9 + --> $DIR/ref-self-async.rs:22:9 | LL | async fn ref_self(&self, f: &u32) -> &u32 { | - - let's call the lifetime of this reference `'1` @@ -14,7 +14,7 @@ LL | async fn ref_self<'a>(&self, f: &'a u32) -> &'a u32 { | ++++ ++ ++ error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:30:9 + --> $DIR/ref-self-async.rs:29:9 | LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { | - - let's call the lifetime of this reference `'1` @@ -29,7 +29,7 @@ LL | async fn ref_Self<'a>(self: &Self, f: &'a u32) -> &'a u32 { | ++++ ++ ++ error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:35:9 + --> $DIR/ref-self-async.rs:34:9 | LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { | - - let's call the lifetime of this reference `'1` @@ -44,7 +44,7 @@ LL | async fn box_ref_Self<'a>(self: Box<&Self>, f: &'a u32) -> &'a u32 { | ++++ ++ ++ error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:40:9 + --> $DIR/ref-self-async.rs:39:9 | LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { | - - let's call the lifetime of this reference `'1` @@ -59,7 +59,7 @@ LL | async fn pin_ref_Self<'a>(self: Pin<&Self>, f: &'a u32) -> &'a u32 { | ++++ ++ ++ error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:45:9 + --> $DIR/ref-self-async.rs:44:9 | LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { | - - let's call the lifetime of this reference `'1` @@ -74,7 +74,7 @@ LL | async fn box_box_ref_Self<'a>(self: Box<Box<&Self>>, f: &'a u32) -> &'a | ++++ ++ ++ error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:50:9 + --> $DIR/ref-self-async.rs:49:9 | LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { | - - let's call the lifetime of this reference `'1` @@ -89,7 +89,7 @@ LL | async fn box_pin_ref_Self<'a>(self: Box<Pin<&Self>>, f: &'a u32) -> &'a | ++++ ++ ++ error: lifetime may not live long enough - --> $DIR/ref-self-async.rs:55:9 + --> $DIR/ref-self-async.rs:54:9 | LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 { | - - let's call the lifetime of this reference `'1` diff --git a/tests/ui/self/elision/ref-self-multi.rs b/tests/ui/self/elision/ref-self-multi.rs index ed431a9c852dd..860b9214e40f4 100644 --- a/tests/ui/self/elision/ref-self-multi.rs +++ b/tests/ui/self/elision/ref-self-multi.rs @@ -1,4 +1,3 @@ -#![feature(arbitrary_self_types)] #![allow(non_snake_case)] #![allow(unused)] diff --git a/tests/ui/self/elision/ref-self-multi.stderr b/tests/ui/self/elision/ref-self-multi.stderr index 7e0451aa0d5c3..8448658c51bab 100644 --- a/tests/ui/self/elision/ref-self-multi.stderr +++ b/tests/ui/self/elision/ref-self-multi.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/ref-self-multi.rs:18:56 + --> $DIR/ref-self-multi.rs:17:56 | LL | fn ref_box_ref_Self(self: &Box<&Self>, f: &u32) -> &u32 { | ----------- ---- ^ expected named lifetime parameter @@ -11,7 +11,7 @@ LL | fn ref_box_ref_Self<'a>(self: &'a Box<&'a Self>, f: &'a u32) -> &'a u32 | ++++ ++ ++ ++ ++ error[E0106]: missing lifetime specifier - --> $DIR/ref-self-multi.rs:23:63 + --> $DIR/ref-self-multi.rs:22:63 | LL | fn ref_wrap_ref_Self(self: &Wrap<&Self, u32>, f: &u32) -> &u32 { | ----------------- ---- ^ expected named lifetime parameter diff --git a/tests/ui/self/elision/ref-self.fixed b/tests/ui/self/elision/ref-self.fixed index 784ccb9efe2f6..649fff366ead1 100644 --- a/tests/ui/self/elision/ref-self.fixed +++ b/tests/ui/self/elision/ref-self.fixed @@ -1,7 +1,6 @@ //@ run-rustfix //@ edition:2018 -#![feature(arbitrary_self_types)] #![allow(non_snake_case, dead_code)] use std::marker::PhantomData; diff --git a/tests/ui/self/elision/ref-self.rs b/tests/ui/self/elision/ref-self.rs index dbe441879cc5d..af9d7bdbdb2aa 100644 --- a/tests/ui/self/elision/ref-self.rs +++ b/tests/ui/self/elision/ref-self.rs @@ -1,7 +1,6 @@ //@ run-rustfix //@ edition:2018 -#![feature(arbitrary_self_types)] #![allow(non_snake_case, dead_code)] use std::marker::PhantomData; diff --git a/tests/ui/self/elision/ref-self.stderr b/tests/ui/self/elision/ref-self.stderr index 64e7bfc1bb06c..f4540aaacefb1 100644 --- a/tests/ui/self/elision/ref-self.stderr +++ b/tests/ui/self/elision/ref-self.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ref-self.rs:26:9 + --> $DIR/ref-self.rs:25:9 | LL | fn ref_self(&self, f: &u32) -> &u32 { | - - let's call the lifetime of this reference `'1` @@ -14,7 +14,7 @@ LL | fn ref_self<'a>(&self, f: &'a u32) -> &'a u32 { | ++++ ++ ++ error: lifetime may not live long enough - --> $DIR/ref-self.rs:33:9 + --> $DIR/ref-self.rs:32:9 | LL | fn ref_Self(self: &Self, f: &u32) -> &u32 { | - - let's call the lifetime of this reference `'1` @@ -29,7 +29,7 @@ LL | fn ref_Self<'a>(self: &Self, f: &'a u32) -> &'a u32 { | ++++ ++ ++ error: lifetime may not live long enough - --> $DIR/ref-self.rs:38:9 + --> $DIR/ref-self.rs:37:9 | LL | fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { | - - let's call the lifetime of this reference `'1` @@ -44,7 +44,7 @@ LL | fn box_ref_Self<'a>(self: Box<&Self>, f: &'a u32) -> &'a u32 { | ++++ ++ ++ error: lifetime may not live long enough - --> $DIR/ref-self.rs:43:9 + --> $DIR/ref-self.rs:42:9 | LL | fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { | - - let's call the lifetime of this reference `'1` @@ -59,7 +59,7 @@ LL | fn pin_ref_Self<'a>(self: Pin<&Self>, f: &'a u32) -> &'a u32 { | ++++ ++ ++ error: lifetime may not live long enough - --> $DIR/ref-self.rs:48:9 + --> $DIR/ref-self.rs:47:9 | LL | fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { | - - let's call the lifetime of this reference `'1` @@ -74,7 +74,7 @@ LL | fn box_box_ref_Self<'a>(self: Box<Box<&Self>>, f: &'a u32) -> &'a u32 { | ++++ ++ ++ error: lifetime may not live long enough - --> $DIR/ref-self.rs:53:9 + --> $DIR/ref-self.rs:52:9 | LL | fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { | - - let's call the lifetime of this reference `'1` @@ -89,7 +89,7 @@ LL | fn box_pin_ref_Self<'a>(self: Box<Pin<&Self>>, f: &'a u32) -> &'a u32 { | ++++ ++ ++ error: lifetime may not live long enough - --> $DIR/ref-self.rs:58:9 + --> $DIR/ref-self.rs:57:9 | LL | fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 { | - - let's call the lifetime of this reference `'1` @@ -104,7 +104,7 @@ LL | fn wrap_ref_Self_Self<'a>(self: Wrap<&Self, Self>, f: &'a u8) -> &'a u8 | ++++ ++ ++ error: lifetime may not live long enough - --> $DIR/ref-self.rs:63:9 + --> $DIR/ref-self.rs:62:9 | LL | fn ref_box_Self(self: &Box<Self>, f: &u32) -> &u32 { | - - let's call the lifetime of this reference `'1` diff --git a/tests/ui/self/invalid-self-dyn-receiver.rs b/tests/ui/self/invalid-self-dyn-receiver.rs index a989b331b5e0b..a8c91e4da5fea 100644 --- a/tests/ui/self/invalid-self-dyn-receiver.rs +++ b/tests/ui/self/invalid-self-dyn-receiver.rs @@ -2,8 +2,6 @@ // because it satisfies `&dyn Bar: DispatchFromDyn<&dyn Bar>`, but is not a valid receiver // in wfcheck. -#![feature(arbitrary_self_types)] - use std::ops::Deref; trait Foo: Deref<Target = dyn Bar> { diff --git a/tests/ui/self/invalid-self-dyn-receiver.stderr b/tests/ui/self/invalid-self-dyn-receiver.stderr index f77f5686ad282..487bcd2ea11d9 100644 --- a/tests/ui/self/invalid-self-dyn-receiver.stderr +++ b/tests/ui/self/invalid-self-dyn-receiver.stderr @@ -1,5 +1,5 @@ error[E0307]: invalid `self` parameter type: `&dyn Bar` - --> $DIR/invalid-self-dyn-receiver.rs:10:22 + --> $DIR/invalid-self-dyn-receiver.rs:8:22 | LL | fn method(self: &dyn Bar) {} | ^^^^^^^^ diff --git a/tests/ui/span/issue-27522.stderr b/tests/ui/span/issue-27522.stderr index c57a100bbe227..04904b0ddc1c5 100644 --- a/tests/ui/span/issue-27522.stderr +++ b/tests/ui/span/issue-27522.stderr @@ -4,8 +4,8 @@ error[E0307]: invalid `self` parameter type: `&SomeType` LL | fn handler(self: &SomeType); | ^^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr b/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr index c275cdccaa8c1..0cd160663adc2 100644 --- a/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr +++ b/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr @@ -34,8 +34,8 @@ error[E0307]: invalid `self` parameter type: `()` LL | fn bar(self: ()) {} | ^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error: aborting due to 2 previous errors diff --git a/tests/ui/traits/const-traits/auxiliary/minicore.rs b/tests/ui/traits/const-traits/auxiliary/minicore.rs index 08d7817548d7c..eb4b43d74f2e3 100644 --- a/tests/ui/traits/const-traits/auxiliary/minicore.rs +++ b/tests/ui/traits/const-traits/auxiliary/minicore.rs @@ -103,13 +103,6 @@ pub trait FnOnce<Args: Tuple> { #[lang = "tuple_trait"] pub trait Tuple {} -#[lang = "legacy_receiver"] -pub trait LegacyReceiver {} - -impl<T: ?Sized> LegacyReceiver for &T {} - -impl<T: ?Sized> LegacyReceiver for &mut T {} - #[lang = "receiver"] pub trait Receiver { #[lang = "receiver_target"] @@ -410,8 +403,6 @@ impl<T> const Deref for Option<T> { } } -impl<P: LegacyReceiver> LegacyReceiver for Pin<P> {} - impl<T: Clone> Clone for RefCell<T> { fn clone(&self) -> RefCell<T> { RefCell::new(self.borrow().clone()) diff --git a/tests/ui/traits/issue-78372.stderr b/tests/ui/traits/issue-78372.stderr index fbc60ce5d83e6..74c17e9eff70f 100644 --- a/tests/ui/traits/issue-78372.stderr +++ b/tests/ui/traits/issue-78372.stderr @@ -62,8 +62,8 @@ error[E0307]: invalid `self` parameter type: `Smaht<Self, T>` LL | fn foo(self: Smaht<Self, T>); | ^^^^^^^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0377]: the trait `DispatchFromDyn` may only be implemented for a coercion between structures --> $DIR/issue-78372.rs:3:1 diff --git a/tests/ui/type-alias-impl-trait/method_resolution3.rs b/tests/ui/type-alias-impl-trait/method_resolution3.rs index 0e6176bfe03c7..ec37d4dcda9f2 100644 --- a/tests/ui/type-alias-impl-trait/method_resolution3.rs +++ b/tests/ui/type-alias-impl-trait/method_resolution3.rs @@ -5,7 +5,7 @@ //@ revisions: current next //@[next] compile-flags: -Znext-solver -#![feature(type_alias_impl_trait, arbitrary_self_types)] +#![feature(type_alias_impl_trait)] type Foo = impl Copy; diff --git a/tests/ui/type-alias-impl-trait/method_resolution4.rs b/tests/ui/type-alias-impl-trait/method_resolution4.rs index f33b4e473ae86..909d9c44479c7 100644 --- a/tests/ui/type-alias-impl-trait/method_resolution4.rs +++ b/tests/ui/type-alias-impl-trait/method_resolution4.rs @@ -5,7 +5,7 @@ //@ revisions: current next //@[next] compile-flags: -Znext-solver -#![feature(type_alias_impl_trait, arbitrary_self_types)] +#![feature(type_alias_impl_trait)] mod foo { pub type Foo = impl Copy; diff --git a/tests/ui/ufcs/ufcs-explicit-self-bad.stderr b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr index 7b5f7cd9f7033..cc3332be8ca3e 100644 --- a/tests/ui/ufcs/ufcs-explicit-self-bad.stderr +++ b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr @@ -23,8 +23,8 @@ error[E0307]: invalid `self` parameter type: `isize` LL | fn foo(self: isize, x: isize) -> isize { | ^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0307]: invalid `self` parameter type: `Bar<isize>` --> $DIR/ufcs-explicit-self-bad.rs:19:18 @@ -32,8 +32,8 @@ error[E0307]: invalid `self` parameter type: `Bar<isize>` LL | fn foo(self: Bar<isize>, x: isize) -> isize { | ^^^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0307]: invalid `self` parameter type: `&Bar<usize>` --> $DIR/ufcs-explicit-self-bad.rs:23:18 @@ -41,8 +41,8 @@ error[E0307]: invalid `self` parameter type: `&Bar<usize>` LL | fn bar(self: &Bar<usize>, x: isize) -> isize { | ^^^^^^^^^^^ | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` error[E0308]: mismatched `self` parameter type --> $DIR/ufcs-explicit-self-bad.rs:37:21