Auto merge of #96178 - Dylan-DPC:rollup-6z8pcob, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #96032 (Update books)
 - #96136 (Reword clarification on lifetime for ptr->ref safety docs)
 - #96143 (Fix snapshot --bless not working anymore in htmldocck)
 - #96148 (Use revisions instead of nll compare mode for `/self/` ui tests)
 - #96156 (Replace u8to64_le macro with u64::from_le_bytes)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2022-04-18 18:29:46 +00:00
commit 8305398d7a
46 changed files with 387 additions and 237 deletions

View File

@ -295,7 +295,7 @@ pub const fn to_raw_parts(self) -> (*const (), <T as super::Pointee>::Metadata)
///
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
/// In particular, for the duration of this lifetime, the memory the pointer points to must
/// In particular, while this reference exists, the memory the pointer points to must
/// not get mutated (except inside `UnsafeCell`).
///
/// This applies even if the result of this method is unused!
@ -358,7 +358,7 @@ pub const fn to_raw_parts(self) -> (*const (), <T as super::Pointee>::Metadata)
///
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
/// In particular, for the duration of this lifetime, the memory the pointer points to must
/// In particular, while this reference exists, the memory the pointer points to must
/// not get mutated (except inside `UnsafeCell`).
///
/// This applies even if the result of this method is unused!
@ -1188,7 +1188,7 @@ pub const fn as_ptr(self) -> *const T {
///
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
/// In particular, for the duration of this lifetime, the memory the pointer points to must
/// In particular, while this reference exists, the memory the pointer points to must
/// not get mutated (except inside `UnsafeCell`).
///
/// This applies even if the result of this method is unused!

View File

@ -302,7 +302,7 @@ pub const fn to_raw_parts(self) -> (*mut (), <T as super::Pointee>::Metadata) {
///
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
/// In particular, for the duration of this lifetime, the memory the pointer points to must
/// In particular, while this reference exists, the memory the pointer points to must
/// not get mutated (except inside `UnsafeCell`).
///
/// This applies even if the result of this method is unused!
@ -368,7 +368,7 @@ pub const fn to_raw_parts(self) -> (*mut (), <T as super::Pointee>::Metadata) {
///
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
/// In particular, for the duration of this lifetime, the memory the pointer points to must
/// In particular, while this reference exists, the memory the pointer points to must
/// not get mutated (except inside `UnsafeCell`).
///
/// This applies even if the result of this method is unused!
@ -550,7 +550,7 @@ pub const fn wrapping_offset(self, count: isize) -> *mut T
///
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
/// In particular, for the duration of this lifetime, the memory the pointer points to must
/// In particular, while this reference exists, the memory the pointer points to must
/// not get accessed (read or written) through any other pointer.
///
/// This applies even if the result of this method is unused!
@ -615,7 +615,7 @@ pub const fn wrapping_offset(self, count: isize) -> *mut T
///
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
/// In particular, for the duration of this lifetime, the memory the pointer points to must
/// In particular, while this reference exists, the memory the pointer points to must
/// not get accessed (read or written) through any other pointer.
///
/// This applies even if the result of this method is unused!
@ -1461,7 +1461,7 @@ pub const fn as_mut_ptr(self) -> *mut T {
///
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
/// In particular, for the duration of this lifetime, the memory the pointer points to must
/// In particular, while this reference exists, the memory the pointer points to must
/// not get mutated (except inside `UnsafeCell`).
///
/// This applies even if the result of this method is unused!
@ -1513,7 +1513,7 @@ pub const fn as_mut_ptr(self) -> *mut T {
///
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
/// In particular, for the duration of this lifetime, the memory the pointer points to must
/// In particular, while this reference exists, the memory the pointer points to must
/// not get accessed (read or written) through any other pointer.
///
/// This applies even if the result of this method is unused!

View File

@ -114,7 +114,7 @@ pub const fn dangling() -> Self {
///
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
/// In particular, for the duration of this lifetime, the memory the pointer points to must
/// In particular, while this reference exists, the memory the pointer points to must
/// not get mutated (except inside `UnsafeCell`).
///
/// This applies even if the result of this method is unused!
@ -148,7 +148,7 @@ pub const fn dangling() -> Self {
///
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
/// In particular, for the duration of this lifetime, the memory the pointer points to must
/// In particular, while this reference exists, the memory the pointer points to must
/// not get accessed (read or written) through any other pointer.
///
/// This applies even if the result of this method is unused!
@ -350,7 +350,7 @@ pub const fn as_ptr(self) -> *mut T {
///
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
/// In particular, for the duration of this lifetime, the memory the pointer points to must
/// In particular, while this reference exists, the memory the pointer points to must
/// not get mutated (except inside `UnsafeCell`).
///
/// This applies even if the result of this method is unused!
@ -400,7 +400,7 @@ pub const fn as_ptr(self) -> *mut T {
///
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
/// In particular, for the duration of this lifetime, the memory the pointer points to must
/// In particular, while this reference exists, the memory the pointer points to must
/// not get accessed (read or written) through any other pointer.
///
/// This applies even if the result of this method is unused!
@ -580,7 +580,7 @@ pub const fn as_mut_ptr(self) -> *mut T {
///
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
/// In particular, for the duration of this lifetime, the memory the pointer points to must
/// In particular, while this reference exists, the memory the pointer points to must
/// not get mutated (except inside `UnsafeCell`).
///
/// This applies even if the result of this method is unused!
@ -626,7 +626,7 @@ pub const fn as_mut_ptr(self) -> *mut T {
///
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
/// In particular, for the duration of this lifetime, the memory the pointer points to must
/// In particular, while this reference exists, the memory the pointer points to must
/// not get accessed (read or written) through any other pointer.
///
/// This applies even if the result of this method is unused!

View File

@ -15,28 +15,6 @@ fn hash<H: Hasher>(&self, state: &mut H) {
}
}
macro_rules! u8to64_le {
($buf:expr, $i:expr) => {
$buf[0 + $i] as u64
| ($buf[1 + $i] as u64) << 8
| ($buf[2 + $i] as u64) << 16
| ($buf[3 + $i] as u64) << 24
| ($buf[4 + $i] as u64) << 32
| ($buf[5 + $i] as u64) << 40
| ($buf[6 + $i] as u64) << 48
| ($buf[7 + $i] as u64) << 56
};
($buf:expr, $i:expr, $len:expr) => {{
let mut t = 0;
let mut out = 0;
while t < $len {
out |= ($buf[t + $i] as u64) << t * 8;
t += 1;
}
out
}};
}
fn hash_with<H: Hasher, T: Hash>(mut st: H, x: &T) -> u64 {
x.hash(&mut st);
st.finish()
@ -123,7 +101,7 @@ fn test_siphash_1_3() {
let mut state_inc = SipHasher13::new_with_keys(k0, k1);
while t < 64 {
let vec = u8to64_le!(vecs[t], 0);
let vec = u64::from_le_bytes(vecs[t]);
let out = hash_with(SipHasher13::new_with_keys(k0, k1), &Bytes(&buf));
assert_eq!(vec, out);
@ -217,7 +195,7 @@ fn test_siphash_2_4() {
let mut state_inc = SipHasher::new_with_keys(k0, k1);
while t < 64 {
let vec = u8to64_le!(vecs[t], 0);
let vec = u64::from_le_bytes(vecs[t]);
let out = hash_with(SipHasher::new_with_keys(k0, k1), &Bytes(&buf));
assert_eq!(vec, out);

@ -1 +1 @@
Subproject commit ea90bbaf53ba64ef4e2da9ac2352b298aec6bec8
Subproject commit 765318b844569a642ceef7bf1adab9639cbf6af3

@ -1 +1 @@
Subproject commit 11f1165e8a2f5840467e748c8108dc53c948ee9a
Subproject commit c7d8467ca9158da58ef295ae65dbf00a308752d9

@ -1 +1 @@
Subproject commit c97d14fa6fed0baa9255432b8a93cb70614f80e3
Subproject commit b5f6c2362baf932db9440fbfcb509b309237ee85

@ -1 +1 @@
Subproject commit ec954f35eedf592cd173b21c05a7f80a65b61d8a
Subproject commit c2a98d9fc5d29c481d42052fbeccfde15ed03116

@ -1 +1 @@
Subproject commit 155126b1d2e2cb01ddb1d7ba9489b90d7cd173ad
Subproject commit eeb5a83c15b6ae60df3e4f19207376b22c6fbc4c

View File

@ -423,8 +423,12 @@ def check_snapshot(snapshot_name, actual_tree, normalize_to_text):
else:
actual_str = flatten(actual_tree)
# Conditions:
# 1. Is --bless
# 2. Are actual and expected tree different
# 3. Are actual and expected text different
if not expected_str \
or (not normalize_to_text and
or (not normalize_to_text and \
not compare_tree(make_xml(actual_str), make_xml(expected_str), stderr)) \
or (normalize_to_text and actual_str != expected_str):

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:8:52
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:11:52
|
LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
| ---- ---- ^ ...but data from `f` is returned here
@ -7,7 +7,7 @@ LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
| this parameter and the return type are declared with different lifetimes...
error[E0623]: lifetime mismatch
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:11:82
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:82
|
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
| ---- ----------------- ^ ...but data from `f` is returned here
@ -15,7 +15,7 @@ LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (
| this parameter and the return type are declared with different lifetimes...
error[E0623]: lifetime mismatch
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:17:64
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:22:64
|
LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
| ------ --- ^^^ ...but data from `arg` is returned here

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:8:52
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:11:52
|
LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
| - - ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
@ -8,7 +8,7 @@ LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
| let's call the lifetime of this reference `'2`
error: lifetime may not live long enough
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:11:75
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:75
|
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
| - - ^^^^^^^^^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
@ -17,7 +17,7 @@ LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (
| let's call the lifetime of this reference `'2`
error: lifetime may not live long enough
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:17:64
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:22:64
|
LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
| -- - ^^^ associated function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a`

View File

@ -1,4 +1,7 @@
// edition:2018
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
use std::pin::Pin;
@ -6,15 +9,19 @@
impl Foo {
async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
//~^ ERROR lifetime mismatch
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ lifetime may not live long enough
async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
//~^ ERROR lifetime mismatch
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ lifetime may not live long enough
}
type Alias<T> = Pin<T>;
impl Foo {
async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg } //~ ERROR E0623
async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
//[base]~^ ERROR E0623
//[nll]~^^ lifetime may not live long enough
}
fn main() {}

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:6:46
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:10:46
|
LL | fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
| ---- ---- ^ ...but data from `f` is returned here
@ -13,7 +13,7 @@ LL | fn a<'a>(self: Pin<&'a Foo>, f: &'a Foo) -> &Foo { f }
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:8:76
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:14:76
|
LL | fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
| ---- ----------------- ^ ...but data from `f` is returned here
@ -27,7 +27,7 @@ LL | fn c<'a>(self: Pin<&'a Self>, f: &'a Foo, g: &Foo) -> (Pin<&Foo>, &Foo)
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:13:58
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:21:58
|
LL | fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
| ------ --- ^^^ ...but data from `arg` is returned here

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:6:46
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:10:46
|
LL | fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
| - - ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
@ -8,7 +8,7 @@ LL | fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
| let's call the lifetime of this reference `'2`
error: lifetime may not live long enough
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:8:69
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:14:69
|
LL | fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
| - - ^^^^^^^^^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
@ -17,7 +17,7 @@ LL | fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self,
| let's call the lifetime of this reference `'2`
error: lifetime may not live long enough
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:13:58
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:21:58
|
LL | fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
| -- ---- has type `Pin<&'1 Foo>` ^^^ associated function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a`

View File

@ -1,16 +1,26 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
use std::pin::Pin;
struct Foo;
impl Foo {
fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f } //~ ERROR E0623
fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
//[base]~^ ERROR E0623
//[nll]~^^ lifetime may not live long enough
fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } //~ ERROR E0623
fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
//[base]~^ ERROR E0623
//[nll]~^^ lifetime may not live long enough
}
type Alias<T> = Pin<T>;
impl Foo {
fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg } //~ ERROR E0623
fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
//[base]~^ ERROR E0623
//[nll]~^^ lifetime may not live long enough
}
fn main() {}

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:13:9
--> $DIR/lt-ref-self-async.rs:16: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:19:9
--> $DIR/lt-ref-self-async.rs:24: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:23:9
--> $DIR/lt-ref-self-async.rs:30: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:27:9
--> $DIR/lt-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/lt-ref-self-async.rs:31:9
--> $DIR/lt-ref-self-async.rs:42: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:35:9
--> $DIR/lt-ref-self-async.rs:48: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-async.rs:13:9
--> $DIR/lt-ref-self-async.rs:16:9
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -9,7 +9,7 @@ LL | f
| ^ associated 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-async.rs:19:9
--> $DIR/lt-ref-self-async.rs:24:9
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -19,7 +19,7 @@ LL | f
| ^ associated 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-async.rs:23:9
--> $DIR/lt-ref-self-async.rs:30:9
|
LL | async 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
| ^ associated 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-async.rs:27:9
--> $DIR/lt-ref-self-async.rs:36:9
|
LL | async 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
| ^ associated 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-async.rs:31:9
--> $DIR/lt-ref-self-async.rs:42:9
|
LL | async 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
| ^ associated 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-async.rs:35:9
--> $DIR/lt-ref-self-async.rs:48:9
|
LL | async 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,7 @@
// edition:2018
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
#![allow(non_snake_case)]
@ -10,29 +13,41 @@ impl<'a> Struct<'a> {
// Test using `&self` sugar:
async fn ref_self(&self, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
// Test using `&Self` explicitly:
async fn ref_Self(self: &Self, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
}

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self.rs:11:9
--> $DIR/lt-ref-self.rs:15:9
|
LL | fn ref_self(&self, f: &u32) -> &u32 {
| ---- ----
@ -15,7 +15,7 @@ LL | fn ref_self<'a>(&'a self, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self.rs:17:9
--> $DIR/lt-ref-self.rs:23:9
|
LL | fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ---- ----
@ -31,7 +31,7 @@ LL | fn ref_Self<'a>(self: &'a Self, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self.rs:21:9
--> $DIR/lt-ref-self.rs:29:9
|
LL | fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ---- ----
@ -47,7 +47,7 @@ LL | fn box_ref_Self<'a>(self: Box<&'a Self>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self.rs:25:9
--> $DIR/lt-ref-self.rs:35:9
|
LL | fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ---- ----
@ -63,7 +63,7 @@ LL | fn pin_ref_Self<'a>(self: Pin<&'a Self>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self.rs:29:9
--> $DIR/lt-ref-self.rs:41:9
|
LL | fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ---- ----
@ -79,7 +79,7 @@ LL | fn box_box_ref_Self<'a>(self: Box<Box<&'a Self>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self.rs:33:9
--> $DIR/lt-ref-self.rs:47:9
|
LL | 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:11:9
--> $DIR/lt-ref-self.rs:15:9
|
LL | fn ref_self(&self, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -9,7 +9,7 @@ LL | f
| ^ associated 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:17:9
--> $DIR/lt-ref-self.rs:23: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
| ^ associated 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:21:9
--> $DIR/lt-ref-self.rs:29: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
| ^ associated 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:25:9
--> $DIR/lt-ref-self.rs:35: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
| ^ associated 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:29:9
--> $DIR/lt-ref-self.rs:41: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
| ^ associated 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:33:9
--> $DIR/lt-ref-self.rs:47: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,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
#![allow(non_snake_case)]
use std::pin::Pin;
@ -8,29 +12,41 @@ impl<'a> Struct<'a> {
// Test using `&self` sugar:
fn ref_self(&self, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
// Test using `&Self` explicitly:
fn ref_Self(self: &Self, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
}

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:13:9
--> $DIR/ref-mut-self-async.rs:16: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:19:9
--> $DIR/ref-mut-self-async.rs:24: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:23:9
--> $DIR/ref-mut-self-async.rs:30: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:27:9
--> $DIR/ref-mut-self-async.rs:36: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:31:9
--> $DIR/ref-mut-self-async.rs:42: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:35:9
--> $DIR/ref-mut-self-async.rs:48: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-async.rs:13:9
--> $DIR/ref-mut-self-async.rs:16:9
|
LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -9,7 +9,7 @@ LL | f
| ^ associated 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-async.rs:19:9
--> $DIR/ref-mut-self-async.rs:24:9
|
LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -19,7 +19,7 @@ LL | f
| ^ associated 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-async.rs:23:9
--> $DIR/ref-mut-self-async.rs:30:9
|
LL | async 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
| ^ associated 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-async.rs:27:9
--> $DIR/ref-mut-self-async.rs:36:9
|
LL | async 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
| ^ associated 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-async.rs:31:9
--> $DIR/ref-mut-self-async.rs:42:9
|
LL | async 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
| ^ associated 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-async.rs:35:9
--> $DIR/ref-mut-self-async.rs:48:9
|
LL | async 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,7 @@
// edition:2018
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
#![allow(non_snake_case)]
@ -10,29 +13,41 @@ impl Struct {
// Test using `&mut self` sugar:
async fn ref_self(&mut self, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
// Test using `&mut Self` explicitly:
async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
}

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self.rs:11:9
--> $DIR/ref-mut-self.rs:15:9
|
LL | fn ref_self(&mut self, f: &u32) -> &u32 {
| ---- ----
@ -15,7 +15,7 @@ LL | fn ref_self<'a>(&'a mut self, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self.rs:17:9
--> $DIR/ref-mut-self.rs:23:9
|
LL | fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
| ---- ----
@ -31,7 +31,7 @@ LL | fn ref_Self<'a>(self: &'a mut Self, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self.rs:21:9
--> $DIR/ref-mut-self.rs:29:9
|
LL | fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
| ---- ----
@ -47,7 +47,7 @@ LL | fn box_ref_Self<'a>(self: Box<&'a mut Self>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self.rs:25:9
--> $DIR/ref-mut-self.rs:35:9
|
LL | fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
| ---- ----
@ -63,7 +63,7 @@ LL | fn pin_ref_Self<'a>(self: Pin<&'a mut Self>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self.rs:29:9
--> $DIR/ref-mut-self.rs:41:9
|
LL | fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
| ---- ----
@ -79,7 +79,7 @@ LL | fn box_box_ref_Self<'a>(self: Box<Box<&'a mut Self>>, f: &'a u32) -> &u
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self.rs:33:9
--> $DIR/ref-mut-self.rs:47:9
|
LL | 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:11:9
--> $DIR/ref-mut-self.rs:15: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
| ^ associated 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:17:9
--> $DIR/ref-mut-self.rs:23: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
| ^ associated 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:21:9
--> $DIR/ref-mut-self.rs:29: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
| ^ associated 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:25:9
--> $DIR/ref-mut-self.rs:35: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
| ^ associated 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:29:9
--> $DIR/ref-mut-self.rs:41: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
| ^ associated 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:33:9
--> $DIR/ref-mut-self.rs:47: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,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
#![allow(non_snake_case)]
use std::pin::Pin;
@ -8,29 +12,41 @@ impl Struct {
// Test using `&mut self` sugar:
fn ref_self(&mut self, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
// Test using `&mut Self` explicitly:
fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
}

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:13:9
--> $DIR/ref-mut-struct-async.rs:16: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:17:9
--> $DIR/ref-mut-struct-async.rs:22: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:21:9
--> $DIR/ref-mut-struct-async.rs:28: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:25:9
--> $DIR/ref-mut-struct-async.rs:34: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:29:9
--> $DIR/ref-mut-struct-async.rs:40: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-async.rs:13:9
--> $DIR/ref-mut-struct-async.rs:16:9
|
LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -9,7 +9,7 @@ LL | f
| ^ associated 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-async.rs:17:9
--> $DIR/ref-mut-struct-async.rs:22:9
|
LL | async 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
| ^ associated 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-async.rs:21:9
--> $DIR/ref-mut-struct-async.rs:28:9
|
LL | async 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
| ^ associated 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-async.rs:25:9
--> $DIR/ref-mut-struct-async.rs:34:9
|
LL | async 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
| ^ associated 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-async.rs:29:9
--> $DIR/ref-mut-struct-async.rs:40:9
|
LL | async 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,7 @@
// edition:2018
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
#![allow(non_snake_case)]
@ -10,23 +13,33 @@ impl Struct {
// Test using `&mut Struct` explicitly:
async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
}

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct.rs:11:9
--> $DIR/ref-mut-struct.rs:15:9
|
LL | fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
| ---- ----
@ -15,7 +15,7 @@ LL | fn ref_Struct<'a>(self: &'a mut Struct, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct.rs:15:9
--> $DIR/ref-mut-struct.rs:21:9
|
LL | fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
| ---- ----
@ -31,7 +31,7 @@ LL | fn box_ref_Struct<'a>(self: Box<&'a mut Struct>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct.rs:19:9
--> $DIR/ref-mut-struct.rs:27:9
|
LL | fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
| ---- ----
@ -47,7 +47,7 @@ LL | fn pin_ref_Struct<'a>(self: Pin<&'a mut Struct>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct.rs:23:9
--> $DIR/ref-mut-struct.rs:33:9
|
LL | fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
| ---- ----
@ -63,7 +63,7 @@ LL | fn box_box_ref_Struct<'a>(self: Box<Box<&'a mut Struct>>, f: &'a u32) -
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct.rs:27:9
--> $DIR/ref-mut-struct.rs:39:9
|
LL | 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:11:9
--> $DIR/ref-mut-struct.rs:15: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
| ^ associated 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:15:9
--> $DIR/ref-mut-struct.rs:21: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
| ^ associated 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:19:9
--> $DIR/ref-mut-struct.rs:27: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
| ^ associated 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:23:9
--> $DIR/ref-mut-struct.rs:33: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
| ^ associated 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:27:9
--> $DIR/ref-mut-struct.rs:39: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,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
#![allow(non_snake_case)]
use std::pin::Pin;
@ -8,23 +12,33 @@ impl Struct {
// Test using `&mut Struct` explicitly:
fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
}

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:23:9
--> $DIR/ref-self-async.rs:26: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:34: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:40: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:46: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:52: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:58: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:64:9
|
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
| --- ---

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:23:9
--> $DIR/ref-self-async.rs:26:9
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -9,7 +9,7 @@ LL | f
| ^ associated 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-self-async.rs:29:9
--> $DIR/ref-self-async.rs:34:9
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -19,7 +19,7 @@ LL | f
| ^ associated 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-self-async.rs:33:9
--> $DIR/ref-self-async.rs:40:9
|
LL | async 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
| ^ associated 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-self-async.rs:37:9
--> $DIR/ref-self-async.rs:46:9
|
LL | async 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
| ^ associated 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-self-async.rs:41:9
--> $DIR/ref-self-async.rs:52:9
|
LL | async 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
| ^ associated 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-self-async.rs:45:9
--> $DIR/ref-self-async.rs:58:9
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -59,7 +59,7 @@ LL | f
| ^ associated 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-self-async.rs:49:9
--> $DIR/ref-self-async.rs:64:9
|
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
| - - let's call the lifetime of this reference `'1`

View File

@ -1,4 +1,7 @@
// edition:2018
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
#![allow(non_snake_case)]
#![feature(arbitrary_self_types)]
@ -20,33 +23,47 @@ impl Struct {
// Test using `&self` sugar:
async fn ref_self(&self, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
// Test using `&Self` explicitly:
async fn ref_Self(self: &Self, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
}

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/ref-self.rs:21:9
--> $DIR/ref-self.rs:25:9
|
LL | fn ref_self(&self, f: &u32) -> &u32 {
| ---- ----
@ -15,7 +15,7 @@ LL | fn ref_self<'a>(&'a self, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/ref-self.rs:27:9
--> $DIR/ref-self.rs:33:9
|
LL | fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ---- ----
@ -31,7 +31,7 @@ LL | fn ref_Self<'a>(self: &'a Self, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/ref-self.rs:31:9
--> $DIR/ref-self.rs:39:9
|
LL | fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ---- ----
@ -47,7 +47,7 @@ LL | fn box_ref_Self<'a>(self: Box<&'a Self>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/ref-self.rs:35:9
--> $DIR/ref-self.rs:45:9
|
LL | fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ---- ----
@ -63,7 +63,7 @@ LL | fn pin_ref_Self<'a>(self: Pin<&'a Self>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/ref-self.rs:39:9
--> $DIR/ref-self.rs:51:9
|
LL | fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ---- ----
@ -79,7 +79,7 @@ LL | fn box_box_ref_Self<'a>(self: Box<Box<&'a Self>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/ref-self.rs:43:9
--> $DIR/ref-self.rs:57:9
|
LL | fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ---- ----
@ -95,7 +95,7 @@ LL | fn box_pin_ref_Self<'a>(self: Box<Pin<&'a Self>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/ref-self.rs:47:9
--> $DIR/ref-self.rs:63:9
|
LL | fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
| --- ---

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/ref-self.rs:21:9
--> $DIR/ref-self.rs:25:9
|
LL | fn ref_self(&self, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -9,7 +9,7 @@ LL | f
| ^ associated 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-self.rs:27:9
--> $DIR/ref-self.rs:33: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
| ^ associated 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-self.rs:31:9
--> $DIR/ref-self.rs:39: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
| ^ associated 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-self.rs:35:9
--> $DIR/ref-self.rs:45: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
| ^ associated 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-self.rs:39:9
--> $DIR/ref-self.rs:51: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
| ^ associated 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-self.rs:43:9
--> $DIR/ref-self.rs:57:9
|
LL | fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -59,7 +59,7 @@ LL | f
| ^ associated 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-self.rs:47:9
--> $DIR/ref-self.rs:63:9
|
LL | fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
| - - let's call the lifetime of this reference `'1`

View File

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
@ -18,33 +22,47 @@ impl Struct {
// Test using `&self` sugar:
fn ref_self(&self, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
// Test using `&Self` explicitly:
fn ref_Self(self: &Self, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
}

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:13:9
--> $DIR/ref-struct-async.rs:16: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:17:9
--> $DIR/ref-struct-async.rs:22: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:21:9
--> $DIR/ref-struct-async.rs:28: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:25:9
--> $DIR/ref-struct-async.rs:34: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:29:9
--> $DIR/ref-struct-async.rs:40: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-async.rs:13:9
--> $DIR/ref-struct-async.rs:16:9
|
LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
| - - let's call the lifetime of this reference `'1`
@ -9,7 +9,7 @@ LL | f
| ^ associated 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-async.rs:17:9
--> $DIR/ref-struct-async.rs:22:9
|
LL | async 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
| ^ associated 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-async.rs:21:9
--> $DIR/ref-struct-async.rs:28:9
|
LL | async 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
| ^ associated 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-async.rs:25:9
--> $DIR/ref-struct-async.rs:34:9
|
LL | async 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
| ^ associated 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-async.rs:29:9
--> $DIR/ref-struct-async.rs:40:9
|
LL | async 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,7 @@
// edition:2018
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
#![allow(non_snake_case)]
@ -10,23 +13,33 @@ impl Struct {
// Test using `&Struct` explicitly:
async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
}

View File

@ -1,5 +1,5 @@
error[E0623]: lifetime mismatch
--> $DIR/ref-struct.rs:11:9
--> $DIR/ref-struct.rs:15:9
|
LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
| ---- ----
@ -15,7 +15,7 @@ LL | fn ref_Struct<'a>(self: &'a Struct, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/ref-struct.rs:15:9
--> $DIR/ref-struct.rs:21:9
|
LL | fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
| ---- ----
@ -31,7 +31,7 @@ LL | fn box_ref_Struct<'a>(self: Box<&'a Struct>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/ref-struct.rs:19:9
--> $DIR/ref-struct.rs:27:9
|
LL | fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
| ---- ----
@ -47,7 +47,7 @@ LL | fn pin_ref_Struct<'a>(self: Pin<&'a Struct>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/ref-struct.rs:23:9
--> $DIR/ref-struct.rs:33:9
|
LL | fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
| ---- ----
@ -63,7 +63,7 @@ LL | fn box_box_ref_Struct<'a>(self: Box<Box<&'a Struct>>, f: &'a u32) -> &u
| ++++ ++ ++
error[E0623]: lifetime mismatch
--> $DIR/ref-struct.rs:27:9
--> $DIR/ref-struct.rs:39:9
|
LL | 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:11:9
--> $DIR/ref-struct.rs:15: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
| ^ associated 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:15:9
--> $DIR/ref-struct.rs:21: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
| ^ associated 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:19:9
--> $DIR/ref-struct.rs:27: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
| ^ associated 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:23:9
--> $DIR/ref-struct.rs:33: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
| ^ associated 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:27:9
--> $DIR/ref-struct.rs:39: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,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
#![allow(non_snake_case)]
use std::pin::Pin;
@ -8,23 +12,33 @@ impl Struct {
// Test using `&Struct` explicitly:
fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
f
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
}