Rollup merge of #64325 - cramertj:nested-self-types, r=mikeyhew

Stabilize nested self receivers in 1.41.0

Previously, only `Self`, `&Self`, `&mut Self`, `Arc<Self>`, `Rc<Self>`,
and `Box<Self>` were available as stable method receivers.

This commit stabilizes nested uses of all the above types.
However, nested receivers remain non-object-safe.
This commit is contained in:
Tyler Mandry 2019-11-27 15:28:29 -06:00 committed by GitHub
commit cb2deb8a9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 215 additions and 320 deletions

View File

@ -2,7 +2,7 @@ use crate::check::{Inherited, FnCtxt};
use crate::constrained_generic_params::{identify_constrained_generic_params, Parameter};
use crate::hir::def_id::DefId;
use rustc::traits::{self, ObligationCauseCode};
use rustc::traits::{self, ObligationCause, ObligationCauseCode};
use rustc::ty::{self, Ty, TyCtxt, GenericParamDefKind, TypeFoldable, ToPredicate};
use rustc::ty::subst::{Subst, InternalSubsts};
use rustc::util::nodemap::{FxHashSet, FxHashMap};
@ -895,6 +895,11 @@ fn receiver_is_valid<'fcx, 'tcx>(
// The first type is `receiver_ty`, which we know its not equal to `self_ty`; skip it.
autoderef.next();
let receiver_trait_def_id = fcx.tcx.require_lang_item(
lang_items::ReceiverTraitLangItem,
None,
);
// Keep dereferencing `receiver_ty` until we get to `self_ty`.
loop {
if let Some((potential_self_ty, _)) = autoderef.next() {
@ -911,6 +916,19 @@ fn receiver_is_valid<'fcx, 'tcx>(
}
break
} else {
// Without `feature(arbitrary_self_types)`, we require that each step in the
// deref chain implement `receiver`
if !arbitrary_self_types_enabled
&& !receiver_is_implemented(
fcx,
receiver_trait_def_id,
cause.clone(),
potential_self_ty,
)
{
return false
}
}
} else {
debug!("receiver_is_valid: type `{:?}` does not deref to `{:?}`",
@ -919,45 +937,44 @@ fn receiver_is_valid<'fcx, 'tcx>(
// unecessary errors (#58712).
return receiver_ty.references_error();
}
// Without the `arbitrary_self_types` feature, `receiver_ty` must directly deref to
// `self_ty`. Enforce this by only doing one iteration of the loop.
if !arbitrary_self_types_enabled {
return false
}
}
// Without `feature(arbitrary_self_types)`, we require that `receiver_ty` implements `Receiver`.
if !arbitrary_self_types_enabled {
let trait_def_id = match fcx.tcx.lang_items().receiver_trait() {
Some(did) => did,
None => {
debug!("receiver_is_valid: missing Receiver trait");
return false
}
};
let trait_ref = ty::TraitRef{
def_id: trait_def_id,
substs: fcx.tcx.mk_substs_trait(receiver_ty, &[]),
};
let obligation = traits::Obligation::new(
cause,
fcx.param_env,
trait_ref.to_predicate()
);
if !fcx.predicate_must_hold_modulo_regions(&obligation) {
debug!("receiver_is_valid: type `{:?}` does not implement `Receiver` trait",
receiver_ty);
return false
}
if !arbitrary_self_types_enabled
&& !receiver_is_implemented(fcx, receiver_trait_def_id, cause.clone(), receiver_ty)
{
return false
}
true
}
fn receiver_is_implemented(
fcx: &FnCtxt<'_, 'tcx>,
receiver_trait_def_id: DefId,
cause: ObligationCause<'tcx>,
receiver_ty: Ty<'tcx>,
) -> bool {
let trait_ref = ty::TraitRef{
def_id: receiver_trait_def_id,
substs: fcx.tcx.mk_substs_trait(receiver_ty, &[]),
};
let obligation = traits::Obligation::new(
cause,
fcx.param_env,
trait_ref.to_predicate()
);
if fcx.predicate_must_hold_modulo_regions(&obligation) {
true
} else {
debug!("receiver_is_implemented: type `{:?}` does not implement `Receiver` trait",
receiver_ty);
false
}
}
fn check_variances_for_type_defn<'tcx>(
tcx: TyCtxt<'tcx>,
item: &hir::Item,

View File

@ -1,5 +1,5 @@
error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/arbitrary-self-types-not-object-safe.rs:34:32
--> $DIR/arbitrary-self-types-not-object-safe.rs:33:32
|
LL | fn foo(self: &Rc<Self>) -> usize;
| --- method `foo`'s `self` parameter cannot be dispatched on
@ -8,7 +8,7 @@ LL | let x = Rc::new(5usize) as Rc<dyn Foo>;
| ^^^^^^^^^^^ the trait `Foo` cannot be made into an object
error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/arbitrary-self-types-not-object-safe.rs:34:13
--> $DIR/arbitrary-self-types-not-object-safe.rs:33:13
|
LL | fn foo(self: &Rc<Self>) -> usize;
| --- method `foo`'s `self` parameter cannot be dispatched on

View File

@ -1,5 +1,5 @@
error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/arbitrary-self-types-not-object-safe.rs:34:13
--> $DIR/arbitrary-self-types-not-object-safe.rs:33:13
|
LL | fn foo(self: &Rc<Self>) -> usize;
| --- method `foo`'s `self` parameter cannot be dispatched on

View File

@ -1,7 +1,6 @@
// revisions: curr object_safe_for_dispatch
#![cfg_attr(object_safe_for_dispatch, feature(object_safe_for_dispatch))]
#![feature(arbitrary_self_types)]
use std::rc::Rc;

View File

@ -1,5 +1,5 @@
error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/arbitrary-self-types-not-object-safe.rs:31:32
--> $DIR/arbitrary-self-types-not-object-safe.rs:29:32
|
LL | fn foo(self: &Rc<Self>) -> usize;
| --- method `foo`'s `self` parameter cannot be dispatched on
@ -8,7 +8,7 @@ LL | let x = Rc::new(5usize) as Rc<dyn Foo>;
| ^^^^^^^^^^^ the trait `Foo` cannot be made into an object
error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/arbitrary-self-types-not-object-safe.rs:31:13
--> $DIR/arbitrary-self-types-not-object-safe.rs:29:13
|
LL | fn foo(self: &Rc<Self>) -> usize;
| --- method `foo`'s `self` parameter cannot be dispatched on

View File

@ -0,0 +1,36 @@
// run-pass
use {
std::{
rc::Rc,
sync::Arc,
},
};
#[derive(Default)]
struct Ty;
trait Trait {
fn receive_trait(self: &Arc<Rc<Box<Self>>>) -> u32;
}
const TRAIT_MAGIC: u32 = 42;
const INHERENT_MAGIC: u32 = 1995;
impl Trait for Ty {
fn receive_trait(self: &Arc<Rc<Box<Self>>>) -> u32 {
TRAIT_MAGIC
}
}
impl Ty {
fn receive_inherent(self: &Arc<Rc<Box<Self>>>) -> u32 {
INHERENT_MAGIC
}
}
fn main() {
let ty = <Arc<Rc<Box<Ty>>>>::default();
assert_eq!(TRAIT_MAGIC, ty.receive_trait());
assert_eq!(INHERENT_MAGIC, ty.receive_inherent());
}

View File

@ -1,5 +1,4 @@
// run-pass
#![feature(arbitrary_self_types)]
use std::rc::Rc;

View File

@ -1,5 +1,4 @@
// run-pass
#![feature(arbitrary_self_types)]
use std::rc::Rc;

View File

@ -1,5 +1,4 @@
// run-pass
#![feature(arbitrary_self_types)]
use std::rc::Rc;

View File

@ -1,7 +1,6 @@
// check-pass
// edition:2018
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::rc::Rc;

View File

@ -1,6 +1,5 @@
// check-pass
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::rc::Rc;

View File

@ -1,7 +1,6 @@
// check-pass
// edition:2018
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::rc::Rc;

View File

@ -1,6 +1,5 @@
// check-pass
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::rc::Rc;

View File

@ -1,7 +1,6 @@
// check-pass
// edition:2018
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::rc::Rc;

View File

@ -1,6 +1,5 @@
// check-pass
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::rc::Rc;

View File

@ -1,7 +1,6 @@
// check-pass
// edition:2018
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::rc::Rc;

View File

@ -1,6 +1,5 @@
// check-pass
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::rc::Rc;

View File

@ -1,5 +1,5 @@
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/lt-ref-self-async.rs:13:42
--> $DIR/lt-ref-self-async.rs:12:42
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
| ^^^^
@ -7,7 +7,7 @@ LL | async fn ref_self(&self, f: &u32) -> &u32 {
= note: hidden type `impl std::future::Future` captures lifetime '_#23r
error: lifetime may not live long enough
--> $DIR/lt-ref-self-async.rs:14:9
--> $DIR/lt-ref-self-async.rs:13:9
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
| -
@ -18,7 +18,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/lt-ref-self-async.rs:19:48
--> $DIR/lt-ref-self-async.rs:18:48
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ^^^^
@ -26,7 +26,7 @@ LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
= note: hidden type `impl std::future::Future` captures lifetime '_#23r
error: lifetime may not live long enough
--> $DIR/lt-ref-self-async.rs:20:9
--> $DIR/lt-ref-self-async.rs:19:9
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| -
@ -37,7 +37,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/lt-ref-self-async.rs:23:57
--> $DIR/lt-ref-self-async.rs:22:57
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ^^^^
@ -45,7 +45,7 @@ LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
= note: hidden type `impl std::future::Future` captures lifetime '_#23r
error: lifetime may not live long enough
--> $DIR/lt-ref-self-async.rs:24:9
--> $DIR/lt-ref-self-async.rs:23:9
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| -
@ -56,7 +56,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/lt-ref-self-async.rs:27:57
--> $DIR/lt-ref-self-async.rs:26:57
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ^^^^
@ -64,7 +64,7 @@ LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
= note: hidden type `impl std::future::Future` captures lifetime '_#23r
error: lifetime may not live long enough
--> $DIR/lt-ref-self-async.rs:28:9
--> $DIR/lt-ref-self-async.rs:27:9
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| -
@ -75,7 +75,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/lt-ref-self-async.rs:31:66
--> $DIR/lt-ref-self-async.rs:30:66
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ^^^^
@ -83,7 +83,7 @@ LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
= note: hidden type `impl std::future::Future` captures lifetime '_#23r
error: lifetime may not live long enough
--> $DIR/lt-ref-self-async.rs:32:9
--> $DIR/lt-ref-self-async.rs:31:9
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| -
@ -94,7 +94,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/lt-ref-self-async.rs:35:62
--> $DIR/lt-ref-self-async.rs:34:62
|
LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ^^^^
@ -102,7 +102,7 @@ LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
= note: hidden type `impl std::future::Future` captures lifetime '_#23r
error: lifetime may not live long enough
--> $DIR/lt-ref-self-async.rs:36:9
--> $DIR/lt-ref-self-async.rs:35:9
|
LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| -

View File

@ -1,6 +1,5 @@
// edition:2018
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::pin::Pin;

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:14:9
--> $DIR/lt-ref-self-async.rs:13:9
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
| ----- ----
@ -9,7 +9,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:20:9
--> $DIR/lt-ref-self-async.rs:19:9
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ----- ----
@ -19,7 +19,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:24:9
--> $DIR/lt-ref-self-async.rs:23:9
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ----- ----
@ -29,7 +29,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:28:9
--> $DIR/lt-ref-self-async.rs:27:9
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ----- ----
@ -39,7 +39,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:32:9
--> $DIR/lt-ref-self-async.rs:31:9
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ----- ----
@ -49,7 +49,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:36:9
--> $DIR/lt-ref-self-async.rs:35:9
|
LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ----- ----

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/lt-ref-self.rs:12:9
--> $DIR/lt-ref-self.rs:11:9
|
LL | fn ref_self(&self, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -9,7 +9,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: lifetime may not live long enough
--> $DIR/lt-ref-self.rs:18:9
--> $DIR/lt-ref-self.rs:17:9
|
LL | fn ref_Self(self: &Self, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -19,7 +19,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: lifetime may not live long enough
--> $DIR/lt-ref-self.rs:22:9
--> $DIR/lt-ref-self.rs:21:9
|
LL | fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -29,7 +29,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: lifetime may not live long enough
--> $DIR/lt-ref-self.rs:26:9
--> $DIR/lt-ref-self.rs:25:9
|
LL | fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -39,7 +39,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: lifetime may not live long enough
--> $DIR/lt-ref-self.rs:30:9
--> $DIR/lt-ref-self.rs:29:9
|
LL | fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -49,7 +49,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: lifetime may not live long enough
--> $DIR/lt-ref-self.rs:34:9
--> $DIR/lt-ref-self.rs:33:9
|
LL | fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`

View File

@ -1,4 +1,3 @@
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::pin::Pin;

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self.rs:12:9
--> $DIR/lt-ref-self.rs:11:9
|
LL | fn ref_self(&self, f: &u32) -> &u32 {
| ---- ----
@ -9,7 +9,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self.rs:18:9
--> $DIR/lt-ref-self.rs:17:9
|
LL | fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ---- ----
@ -19,7 +19,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self.rs:22:9
--> $DIR/lt-ref-self.rs:21:9
|
LL | fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ---- ----
@ -29,7 +29,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self.rs:26:9
--> $DIR/lt-ref-self.rs:25:9
|
LL | fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ---- ----
@ -39,7 +39,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self.rs:30:9
--> $DIR/lt-ref-self.rs:29:9
|
LL | fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ---- ----
@ -49,7 +49,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self.rs:34:9
--> $DIR/lt-ref-self.rs:33:9
|
LL | fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ---- ----

View File

@ -1,7 +1,6 @@
// check-pass
// edition:2018
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::pin::Pin;

View File

@ -1,6 +1,5 @@
// check-pass
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::pin::Pin;

View File

@ -1,7 +1,6 @@
// check-pass
// edition:2018
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::rc::Rc;

View File

@ -1,6 +1,5 @@
// check-pass
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::rc::Rc;

View File

@ -1,7 +1,6 @@
// edition:2018
// check-pass
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::pin::Pin;

View File

@ -1,6 +1,5 @@
// check-pass
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::pin::Pin;

View File

@ -1,7 +1,6 @@
// edition:2018
// check-pass
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::pin::Pin;

View File

@ -1,6 +1,5 @@
// check-pass
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::pin::Pin;

View File

@ -1,7 +1,6 @@
// edition:2018
// check-pass
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::pin::Pin;

View File

@ -1,6 +1,5 @@
// check-pass
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::pin::Pin;

View File

@ -1,5 +1,5 @@
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-self-async.rs:13:46
--> $DIR/ref-mut-self-async.rs:12:46
|
LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
| ^^^^
@ -7,7 +7,7 @@ LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-mut-self-async.rs:14:9
--> $DIR/ref-mut-self-async.rs:13:9
|
LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
| -
@ -18,7 +18,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-self-async.rs:19:52
--> $DIR/ref-mut-self-async.rs:18:52
|
LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
| ^^^^
@ -26,7 +26,7 @@ LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-mut-self-async.rs:20:9
--> $DIR/ref-mut-self-async.rs:19:9
|
LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
| -
@ -37,7 +37,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-self-async.rs:23:61
--> $DIR/ref-mut-self-async.rs:22:61
|
LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
| ^^^^
@ -45,7 +45,7 @@ LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-mut-self-async.rs:24:9
--> $DIR/ref-mut-self-async.rs:23:9
|
LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
| -
@ -56,7 +56,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-self-async.rs:27:61
--> $DIR/ref-mut-self-async.rs:26:61
|
LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
| ^^^^
@ -64,7 +64,7 @@ LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-mut-self-async.rs:28:9
--> $DIR/ref-mut-self-async.rs:27:9
|
LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
| -
@ -75,7 +75,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-self-async.rs:31:70
--> $DIR/ref-mut-self-async.rs:30:70
|
LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
| ^^^^
@ -83,7 +83,7 @@ LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-mut-self-async.rs:32:9
--> $DIR/ref-mut-self-async.rs:31:9
|
LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
| -
@ -94,7 +94,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-self-async.rs:35:70
--> $DIR/ref-mut-self-async.rs:34:70
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
| ^^^^
@ -102,7 +102,7 @@ LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-mut-self-async.rs:36:9
--> $DIR/ref-mut-self-async.rs:35:9
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
| -

View File

@ -1,6 +1,5 @@
// edition:2018
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::pin::Pin;

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:14:9
--> $DIR/ref-mut-self-async.rs:13:9
|
LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
| --------- ----
@ -9,7 +9,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:20:9
--> $DIR/ref-mut-self-async.rs:19:9
|
LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
| --------- ----
@ -19,7 +19,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:24:9
--> $DIR/ref-mut-self-async.rs:23:9
|
LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
| --------- ----
@ -29,7 +29,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:28:9
--> $DIR/ref-mut-self-async.rs:27:9
|
LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
| --------- ----
@ -39,7 +39,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:32:9
--> $DIR/ref-mut-self-async.rs:31:9
|
LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
| --------- ----
@ -49,7 +49,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:36:9
--> $DIR/ref-mut-self-async.rs:35:9
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
| --------- ----

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/ref-mut-self.rs:12:9
--> $DIR/ref-mut-self.rs:11:9
|
LL | fn ref_self(&mut self, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -9,7 +9,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: lifetime may not live long enough
--> $DIR/ref-mut-self.rs:18:9
--> $DIR/ref-mut-self.rs:17:9
|
LL | fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -19,7 +19,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: lifetime may not live long enough
--> $DIR/ref-mut-self.rs:22:9
--> $DIR/ref-mut-self.rs:21:9
|
LL | fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -29,7 +29,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: lifetime may not live long enough
--> $DIR/ref-mut-self.rs:26:9
--> $DIR/ref-mut-self.rs:25:9
|
LL | fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -39,7 +39,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: lifetime may not live long enough
--> $DIR/ref-mut-self.rs:30:9
--> $DIR/ref-mut-self.rs:29:9
|
LL | fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -49,7 +49,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: lifetime may not live long enough
--> $DIR/ref-mut-self.rs:34:9
--> $DIR/ref-mut-self.rs:33:9
|
LL | fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`

View File

@ -1,4 +1,3 @@
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::pin::Pin;

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self.rs:12:9
--> $DIR/ref-mut-self.rs:11:9
|
LL | fn ref_self(&mut self, f: &u32) -> &u32 {
| ---- ----
@ -9,7 +9,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self.rs:18:9
--> $DIR/ref-mut-self.rs:17:9
|
LL | fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
| ---- ----
@ -19,7 +19,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self.rs:22:9
--> $DIR/ref-mut-self.rs:21:9
|
LL | fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
| ---- ----
@ -29,7 +29,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self.rs:26:9
--> $DIR/ref-mut-self.rs:25:9
|
LL | fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
| ---- ----
@ -39,7 +39,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self.rs:30:9
--> $DIR/ref-mut-self.rs:29:9
|
LL | fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
| ---- ----
@ -49,7 +49,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self.rs:34:9
--> $DIR/ref-mut-self.rs:33:9
|
LL | fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
| ---- ----

View File

@ -1,5 +1,5 @@
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-struct-async.rs:13:56
--> $DIR/ref-mut-struct-async.rs:12:56
|
LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
| ^^^^
@ -7,7 +7,7 @@ LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-mut-struct-async.rs:14:9
--> $DIR/ref-mut-struct-async.rs:13:9
|
LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
| -
@ -18,7 +18,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-struct-async.rs:17:65
--> $DIR/ref-mut-struct-async.rs:16:65
|
LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
| ^^^^
@ -26,7 +26,7 @@ LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-mut-struct-async.rs:18:9
--> $DIR/ref-mut-struct-async.rs:17:9
|
LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
| -
@ -37,7 +37,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-struct-async.rs:21:65
--> $DIR/ref-mut-struct-async.rs:20:65
|
LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
| ^^^^
@ -45,7 +45,7 @@ LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-mut-struct-async.rs:22:9
--> $DIR/ref-mut-struct-async.rs:21:9
|
LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
| -
@ -56,7 +56,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-struct-async.rs:25:74
--> $DIR/ref-mut-struct-async.rs:24:74
|
LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
| ^^^^
@ -64,7 +64,7 @@ LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-mut-struct-async.rs:26:9
--> $DIR/ref-mut-struct-async.rs:25:9
|
LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
| -
@ -75,7 +75,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-struct-async.rs:29:74
--> $DIR/ref-mut-struct-async.rs:28:74
|
LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
| ^^^^
@ -83,7 +83,7 @@ LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-mut-struct-async.rs:30:9
--> $DIR/ref-mut-struct-async.rs:29:9
|
LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
| -

View File

@ -1,6 +1,5 @@
// edition:2018
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::pin::Pin;

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:14:9
--> $DIR/ref-mut-struct-async.rs:13:9
|
LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
| ----------- ----
@ -9,7 +9,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:18:9
--> $DIR/ref-mut-struct-async.rs:17:9
|
LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
| ----------- ----
@ -19,7 +19,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:22:9
--> $DIR/ref-mut-struct-async.rs:21:9
|
LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
| ----------- ----
@ -29,7 +29,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:26:9
--> $DIR/ref-mut-struct-async.rs:25:9
|
LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
| ----------- ----
@ -39,7 +39,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:30:9
--> $DIR/ref-mut-struct-async.rs:29:9
|
LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
| ----------- ----

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/ref-mut-struct.rs:12:9
--> $DIR/ref-mut-struct.rs:11:9
|
LL | fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -9,7 +9,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: lifetime may not live long enough
--> $DIR/ref-mut-struct.rs:16:9
--> $DIR/ref-mut-struct.rs:15:9
|
LL | fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -19,7 +19,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: lifetime may not live long enough
--> $DIR/ref-mut-struct.rs:20:9
--> $DIR/ref-mut-struct.rs:19:9
|
LL | fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -29,7 +29,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: lifetime may not live long enough
--> $DIR/ref-mut-struct.rs:24:9
--> $DIR/ref-mut-struct.rs:23:9
|
LL | fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -39,7 +39,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: lifetime may not live long enough
--> $DIR/ref-mut-struct.rs:28:9
--> $DIR/ref-mut-struct.rs:27:9
|
LL | fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`

View File

@ -1,4 +1,3 @@
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::pin::Pin;

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct.rs:12:9
--> $DIR/ref-mut-struct.rs:11:9
|
LL | fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
| ---- ----
@ -9,7 +9,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct.rs:16:9
--> $DIR/ref-mut-struct.rs:15:9
|
LL | fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
| ---- ----
@ -19,7 +19,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct.rs:20:9
--> $DIR/ref-mut-struct.rs:19:9
|
LL | fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
| ---- ----
@ -29,7 +29,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct.rs:24:9
--> $DIR/ref-mut-struct.rs:23:9
|
LL | fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
| ---- ----
@ -39,7 +39,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct.rs:28:9
--> $DIR/ref-mut-struct.rs:27:9
|
LL | fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
| ---- ----

View File

@ -1,136 +1,13 @@
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-self-async.rs:22:42
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
| ^^^^
|
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:23:9
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
| -
| |
| lifetime `'_` defined here
| lifetime `'_` defined here
LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-self-async.rs:28:48
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ^^^^
|
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:29:9
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| -
| |
| lifetime `'_` defined here
| lifetime `'_` defined here
LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-self-async.rs:32:57
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ^^^^
|
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:33:9
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| -
| |
| lifetime `'_` defined here
| lifetime `'_` defined here
LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-self-async.rs:36:57
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ^^^^
|
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:37:9
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| -
| |
| lifetime `'_` defined here
| lifetime `'_` defined here
LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-self-async.rs:40:66
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ^^^^
|
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:41:9
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| -
| |
| lifetime `'_` defined here
| lifetime `'_` defined here
LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-self-async.rs:44:66
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ^^^^
|
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:45:9
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| -
| |
| lifetime `'_` defined here
| lifetime `'_` defined here
LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-self-async.rs:48:69
error[E0658]: `Wrap<&Struct, Struct>` cannot be used as the type of `self` without the `arbitrary_self_types` feature
--> $DIR/ref-self-async.rs:47:39
|
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
| ^^^
| ^^^^^^^^^^^^^^^^^
|
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
= note: for more information, see https://github.com/rust-lang/rust/issues/44874
= help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable
= 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`)
error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:49:9
|
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
| -
| |
| lifetime `'_` defined here
| lifetime `'_` defined here
LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error: aborting due to previous error
error: aborting due to 14 previous errors
For more information about this error, try `rustc --explain E0700`.
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,6 +1,5 @@
// edition:2018
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::marker::PhantomData;

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:23:9
--> $DIR/ref-self-async.rs:22:9
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
| ----- ----
@ -9,7 +9,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:29:9
--> $DIR/ref-self-async.rs:28:9
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ----- ----
@ -19,7 +19,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:33:9
--> $DIR/ref-self-async.rs:32:9
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ----- ----
@ -29,7 +29,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:37:9
--> $DIR/ref-self-async.rs:36:9
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ----- ----
@ -39,7 +39,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:41:9
--> $DIR/ref-self-async.rs:40:9
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ----- ----
@ -49,7 +49,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:45:9
--> $DIR/ref-self-async.rs:44:9
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ----- ----
@ -59,7 +59,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:49:9
--> $DIR/ref-self-async.rs:48:9
|
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
| ----- ---

View File

@ -1,5 +1,5 @@
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-struct-async.rs:13:52
--> $DIR/ref-struct-async.rs:12:52
|
LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
| ^^^^
@ -7,7 +7,7 @@ LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-struct-async.rs:14:9
--> $DIR/ref-struct-async.rs:13:9
|
LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
| -
@ -18,7 +18,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-struct-async.rs:17:61
--> $DIR/ref-struct-async.rs:16:61
|
LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
| ^^^^
@ -26,7 +26,7 @@ LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-struct-async.rs:18:9
--> $DIR/ref-struct-async.rs:17:9
|
LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
| -
@ -37,7 +37,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-struct-async.rs:21:61
--> $DIR/ref-struct-async.rs:20:61
|
LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
| ^^^^
@ -45,7 +45,7 @@ LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-struct-async.rs:22:9
--> $DIR/ref-struct-async.rs:21:9
|
LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
| -
@ -56,7 +56,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-struct-async.rs:25:70
--> $DIR/ref-struct-async.rs:24:70
|
LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
| ^^^^
@ -64,7 +64,7 @@ LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-struct-async.rs:26:9
--> $DIR/ref-struct-async.rs:25:9
|
LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
| -
@ -75,7 +75,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-struct-async.rs:29:66
--> $DIR/ref-struct-async.rs:28:66
|
LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
| ^^^^
@ -83,7 +83,7 @@ LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
= note: hidden type `impl std::future::Future` captures lifetime '_#15r
error: lifetime may not live long enough
--> $DIR/ref-struct-async.rs:30:9
--> $DIR/ref-struct-async.rs:29:9
|
LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
| -

View File

@ -1,6 +1,5 @@
// edition:2018
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::pin::Pin;

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:14:9
--> $DIR/ref-struct-async.rs:13:9
|
LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
| ------- ----
@ -9,7 +9,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:18:9
--> $DIR/ref-struct-async.rs:17:9
|
LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
| ------- ----
@ -19,7 +19,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:22:9
--> $DIR/ref-struct-async.rs:21:9
|
LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
| ------- ----
@ -29,7 +29,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:26:9
--> $DIR/ref-struct-async.rs:25:9
|
LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
| ------- ----
@ -39,7 +39,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:30:9
--> $DIR/ref-struct-async.rs:29:9
|
LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
| ------- ----

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/ref-struct.rs:12:9
--> $DIR/ref-struct.rs:11:9
|
LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -9,7 +9,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: lifetime may not live long enough
--> $DIR/ref-struct.rs:16:9
--> $DIR/ref-struct.rs:15:9
|
LL | fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -19,7 +19,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: lifetime may not live long enough
--> $DIR/ref-struct.rs:20:9
--> $DIR/ref-struct.rs:19:9
|
LL | fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -29,7 +29,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: lifetime may not live long enough
--> $DIR/ref-struct.rs:24:9
--> $DIR/ref-struct.rs:23:9
|
LL | fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -39,7 +39,7 @@ LL | f
| ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
error: lifetime may not live long enough
--> $DIR/ref-struct.rs:28:9
--> $DIR/ref-struct.rs:27:9
|
LL | fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`

View File

@ -1,4 +1,3 @@
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::pin::Pin;

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/ref-struct.rs:12:9
--> $DIR/ref-struct.rs:11:9
|
LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
| ---- ----
@ -9,7 +9,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-struct.rs:16:9
--> $DIR/ref-struct.rs:15:9
|
LL | fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
| ---- ----
@ -19,7 +19,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-struct.rs:20:9
--> $DIR/ref-struct.rs:19:9
|
LL | fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
| ---- ----
@ -29,7 +29,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-struct.rs:24:9
--> $DIR/ref-struct.rs:23:9
|
LL | fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
| ---- ----
@ -39,7 +39,7 @@ LL | f
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
--> $DIR/ref-struct.rs:28:9
--> $DIR/ref-struct.rs:27:9
|
LL | fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
| ---- ----

View File

@ -1,7 +1,6 @@
// check-pass
// edition:2018
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::rc::Rc;

View File

@ -1,6 +1,5 @@
// check-pass
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::rc::Rc;

View File

@ -1,7 +1,6 @@
// check-pass
// edition:2018
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::rc::Rc;

View File

@ -1,6 +1,5 @@
// check-pass
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
use std::rc::Rc;