1
Fork 0

Move /src/test to /tests

This commit is contained in:
Albert Larsan 2023-01-05 09:13:28 +01:00
parent ca855e6e42
commit cf2dff2b1e
No known key found for this signature in database
GPG key ID: 92709B88BB8F13EA
27592 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,7 @@
Each of these needs to be in a separate file,
because the `delay_span_bug` ICE in rustdoc won't be triggerred
if even a single other error was emitted.
However, conceptually they are all testing basically the same thing.
See https://github.com/rust-lang/rust/pull/73566#issuecomment-653689128
for more details.

View file

@ -0,0 +1,7 @@
// edition:2018
// check-pass
/// Should compile fine
pub async fn a() -> u32 {
error::_in::async_fn()
}

View file

@ -0,0 +1,5 @@
// check-pass
// manually desugared version of an `async fn` (but with a closure instead of a generator)
pub fn a() -> impl Fn() -> u32 {
|| content::doesnt::matter()
}

View file

@ -0,0 +1,23 @@
// check-pass
// edition:2018
trait ValidTrait {}
/// This has docs
pub fn extern_fn<const N: usize>() -> impl Iterator<Item = [u8; N]> {
loop {}
}
pub trait Trait<const N: usize> {}
impl Trait<1> for u8 {}
impl Trait<2> for u8 {}
impl<const N: usize> Trait<N> for [u8; N] {}
/// This also has docs
pub fn test<const N: usize>() -> impl Trait<N> where u8: Trait<N> {
loop {}
}
/// Document all the functions
pub async fn a_sink<const N: usize>(v: [u8; N]) -> impl Trait<N> {
loop {}
}

View file

@ -0,0 +1,7 @@
// check-pass
trait ValidTrait {}
/// This has docs
pub fn f() -> impl ValidTrait {
Vec::<DoesNotExist>::new()
}

View file

@ -0,0 +1,6 @@
// check-pass
pub trait ValidTrait {}
/// This returns impl trait
pub fn g() -> impl ValidTrait {
(|| error::_in::impl_trait::alias::nested::closure())()
}

View file

@ -0,0 +1,6 @@
// check-pass
pub trait ValidTrait {}
/// This returns impl trait
pub fn g() -> impl ValidTrait {
error::_in::impl_trait()
}

View file

@ -0,0 +1,28 @@
// edition:2018
// check-pass
mod windows {
pub trait WinFoo {
fn foo(&self) {}
}
impl WinFoo for () {}
}
#[cfg(any(windows, doc))]
use windows::*;
mod unix {
pub trait UnixFoo {
fn foo(&self) {}
}
impl UnixFoo for () {}
}
#[cfg(any(unix, doc))]
use unix::*;
async fn bar() {
().foo()
}

View file

@ -0,0 +1,10 @@
// check-pass
#![feature(type_alias_impl_trait)]
pub trait ValidTrait {}
type ImplTrait = impl ValidTrait;
/// This returns impl trait, but using a type alias
pub fn h() -> ImplTrait {
(|| error::_in::impl_trait::alias::nested::closure())()
}

View file

@ -0,0 +1,10 @@
// check-pass
#![feature(type_alias_impl_trait)]
pub trait ValidTrait {}
type ImplTrait = impl ValidTrait;
/// This returns impl trait, but using a type alias
pub fn h() -> ImplTrait {
error::_in::impl_trait::alias()
}