lifetime elision: add conforming-to-fn tests.
This commit is contained in:
parent
04523404bc
commit
43a2cbdfd3
8 changed files with 341 additions and 0 deletions
39
src/test/ui/self/elision/alias-async.rs
Normal file
39
src/test/ui/self/elision/alias-async.rs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// check-pass
|
||||
// edition:2018
|
||||
|
||||
#![feature(async_await)]
|
||||
|
||||
#![feature(arbitrary_self_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
struct Struct { }
|
||||
|
||||
type Alias = Struct;
|
||||
|
||||
impl Struct {
|
||||
// Test using an alias for `Struct`:
|
||||
|
||||
async fn alias(self: Alias, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_Alias(self: Box<Alias>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn rc_Alias(self: Rc<Alias>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_box_Alias(self: Box<Box<Alias>>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_rc_Alias(self: Box<Rc<Alias>>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
43
src/test/ui/self/elision/assoc-async.rs
Normal file
43
src/test/ui/self/elision/assoc-async.rs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
// check-pass
|
||||
// edition:2018
|
||||
|
||||
#![feature(async_await)]
|
||||
|
||||
#![feature(arbitrary_self_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
trait Trait {
|
||||
type AssocType;
|
||||
}
|
||||
|
||||
struct Struct { }
|
||||
|
||||
impl Trait for Struct {
|
||||
type AssocType = Self;
|
||||
}
|
||||
|
||||
impl Struct {
|
||||
async fn assoc(self: <Struct as Trait>::AssocType, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_AssocType(self: Box<<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn rc_AssocType(self: Rc<<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_box_AssocType(self: Box<Box<<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_rc_AssocType(self: Box<Rc<<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
41
src/test/ui/self/elision/lt-alias-async.rs
Normal file
41
src/test/ui/self/elision/lt-alias-async.rs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
// check-pass
|
||||
// edition:2018
|
||||
|
||||
#![feature(async_await)]
|
||||
|
||||
#![feature(arbitrary_self_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
struct Struct<'a> { x: &'a u32 }
|
||||
|
||||
type Alias<'a> = Struct<'a>;
|
||||
|
||||
impl<'a> Alias<'a> {
|
||||
async fn take_self(self, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Alias(self: Alias<'a>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Box_Alias(self: Box<Alias<'a>>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Box_Box_Alias(self: Box<Box<Alias<'a>>>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Rc_Alias(self: Rc<Alias<'a>>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Box_Rc_Alias(self: Box<Rc<Alias<'a>>>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
53
src/test/ui/self/elision/lt-assoc-async.rs
Normal file
53
src/test/ui/self/elision/lt-assoc-async.rs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
// check-pass
|
||||
// edition:2018
|
||||
|
||||
#![feature(async_await)]
|
||||
|
||||
#![feature(arbitrary_self_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
trait Trait {
|
||||
type AssocType;
|
||||
}
|
||||
|
||||
struct Struct<'a> { x: &'a u32 }
|
||||
|
||||
impl<'a> Trait for Struct<'a> {
|
||||
type AssocType = Self;
|
||||
}
|
||||
|
||||
impl<'a> Struct<'a> {
|
||||
async fn take_self(self, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_AssocType(self: <Struct<'a> as Trait>::AssocType, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Box_AssocType(self: Box<<Struct<'a> as Trait>::AssocType>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Box_Box_AssocType(
|
||||
self: Box<Box<<Struct<'a> as Trait>::AssocType>>,
|
||||
f: &u32
|
||||
) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Rc_AssocType(self: Rc<<Struct<'a> as Trait>::AssocType>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Box_Rc_AssocType(
|
||||
self: Box<Rc<<Struct<'a> as Trait>::AssocType>>,
|
||||
f: &u32
|
||||
) -> &u32 {
|
||||
f
|
||||
}
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
52
src/test/ui/self/elision/lt-self-async.rs
Normal file
52
src/test/ui/self/elision/lt-self-async.rs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
// check-pass
|
||||
// edition:2018
|
||||
|
||||
#![feature(async_await)]
|
||||
|
||||
#![feature(arbitrary_self_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use std::pin::Pin;
|
||||
use std::rc::Rc;
|
||||
|
||||
struct Struct<'a> {
|
||||
x: &'a u32
|
||||
}
|
||||
|
||||
impl<'a> Struct<'a> {
|
||||
async fn take_self(self, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Self(self: Self, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Box_Self(self: Box<Self>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Box_Box_Self(self: Box<Box<Self>>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Rc_Self(self: Rc<Self>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Box_Rc_Self(self: Box<Rc<Self>>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
// N/A
|
||||
//fn take_Pin_Self(self: Pin<Self>, f: &u32) -> &u32 {
|
||||
// f
|
||||
//}
|
||||
|
||||
// N/A
|
||||
//fn take_Box_Pin_Self(self: Box<Pin<Self>>, f: &u32) -> &u32 {
|
||||
// f
|
||||
//}
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
39
src/test/ui/self/elision/lt-struct-async.rs
Normal file
39
src/test/ui/self/elision/lt-struct-async.rs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// check-pass
|
||||
// edition:2018
|
||||
|
||||
#![feature(async_await)]
|
||||
|
||||
#![feature(arbitrary_self_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
struct Struct<'a> { x: &'a u32 }
|
||||
|
||||
impl<'a> Struct<'a> {
|
||||
async fn take_self(self, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Struct(self: Struct<'a>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Box_Struct(self: Box<Struct<'a>>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Box_Box_Struct(self: Box<Box<Struct<'a>>>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Rc_Struct(self: Rc<Struct<'a>>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Box_Rc_Struct(self: Box<Rc<Struct<'a>>>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
39
src/test/ui/self/elision/self-async.rs
Normal file
39
src/test/ui/self/elision/self-async.rs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// check-pass
|
||||
// edition:2018
|
||||
|
||||
#![feature(async_await)]
|
||||
|
||||
#![feature(arbitrary_self_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
struct Struct { }
|
||||
|
||||
impl Struct {
|
||||
async fn take_self(self, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Self(self: Self, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Box_Self(self: Box<Self>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Box_Box_Self(self: Box<Box<Self>>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Rc_Self(self: Rc<Self>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn take_Box_Rc_Self(self: Box<Rc<Self>>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
35
src/test/ui/self/elision/struct-async.rs
Normal file
35
src/test/ui/self/elision/struct-async.rs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
// check-pass
|
||||
// edition:2018
|
||||
|
||||
#![feature(async_await)]
|
||||
|
||||
#![feature(arbitrary_self_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
struct Struct { }
|
||||
|
||||
impl Struct {
|
||||
async fn ref_Struct(self: Struct, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_Struct(self: Box<Struct>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn rc_Struct(self: Rc<Struct>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_box_Struct(self: Box<Box<Struct>>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
|
||||
async fn box_rc_Struct(self: Box<Rc<Struct>>, f: &u32) -> &u32 {
|
||||
f
|
||||
}
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
Loading…
Add table
Add a link
Reference in a new issue