mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
Add regression tests
This commit is contained in:
parent
1163aa7e72
commit
2bf63a5011
23
src/test/ui/impl-trait/issues/issue-54895.rs
Normal file
23
src/test/ui/impl-trait/issues/issue-54895.rs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// check-pass
|
||||||
|
|
||||||
|
trait Trait<'a> {
|
||||||
|
type Out;
|
||||||
|
fn call(&'a self) -> Self::Out;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct X(());
|
||||||
|
|
||||||
|
impl<'a> Trait<'a> for X {
|
||||||
|
type Out = ();
|
||||||
|
fn call(&'a self) -> Self::Out {
|
||||||
|
()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn f() -> impl for<'a> Trait<'a, Out = impl Sized + 'a> {
|
||||||
|
X(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let _ = f();
|
||||||
|
}
|
32
src/test/ui/impl-trait/issues/issue-62742.rs
Normal file
32
src/test/ui/impl-trait/issues/issue-62742.rs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
|
fn _alias_check() {
|
||||||
|
WrongImpl::foo(0i32);
|
||||||
|
//~^ ERROR the trait bound `RawImpl<_>: Raw<_>` is not satisfied
|
||||||
|
WrongImpl::<()>::foo(0i32);
|
||||||
|
//~^ ERROR the trait bound `RawImpl<()>: Raw<()>` is not satisfied
|
||||||
|
//~| ERROR trait bounds were not satisfied
|
||||||
|
CorrectImpl::foo(0i32);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait Raw<T: ?Sized> {
|
||||||
|
type Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type WrongImpl<T> = SafeImpl<T, RawImpl<T>>;
|
||||||
|
|
||||||
|
pub type CorrectImpl<T> = SafeImpl<[T], RawImpl<T>>;
|
||||||
|
|
||||||
|
pub struct RawImpl<T>(PhantomData<T>);
|
||||||
|
|
||||||
|
impl<T> Raw<[T]> for RawImpl<T> {
|
||||||
|
type Value = T;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct SafeImpl<T: ?Sized, A: Raw<T>>(PhantomData<(A, T)>);
|
||||||
|
|
||||||
|
impl<T: ?Sized, A: Raw<T>> SafeImpl<T, A> {
|
||||||
|
pub fn foo(value: A::Value) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
54
src/test/ui/impl-trait/issues/issue-62742.stderr
Normal file
54
src/test/ui/impl-trait/issues/issue-62742.stderr
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied
|
||||||
|
--> $DIR/issue-62742.rs:4:5
|
||||||
|
|
|
||||||
|
LL | WrongImpl::foo(0i32);
|
||||||
|
| ^^^^^^^^^ the trait `Raw<_>` is not implemented for `RawImpl<_>`
|
||||||
|
|
|
||||||
|
= help: the following implementations were found:
|
||||||
|
<RawImpl<T> as Raw<[T]>>
|
||||||
|
note: required by a bound in `SafeImpl`
|
||||||
|
--> $DIR/issue-62742.rs:26:35
|
||||||
|
|
|
||||||
|
LL | pub struct SafeImpl<T: ?Sized, A: Raw<T>>(PhantomData<(A, T)>);
|
||||||
|
| ^^^^^^ required by this bound in `SafeImpl`
|
||||||
|
|
||||||
|
error[E0599]: the function or associated item `foo` exists for struct `SafeImpl<(), RawImpl<()>>`, but its trait bounds were not satisfied
|
||||||
|
--> $DIR/issue-62742.rs:6:22
|
||||||
|
|
|
||||||
|
LL | WrongImpl::<()>::foo(0i32);
|
||||||
|
| ^^^ function or associated item cannot be called on `SafeImpl<(), RawImpl<()>>` due to unsatisfied trait bounds
|
||||||
|
...
|
||||||
|
LL | pub struct RawImpl<T>(PhantomData<T>);
|
||||||
|
| -------------------------------------- doesn't satisfy `RawImpl<()>: Raw<()>`
|
||||||
|
...
|
||||||
|
LL | pub struct SafeImpl<T: ?Sized, A: Raw<T>>(PhantomData<(A, T)>);
|
||||||
|
| --------------------------------------------------------------- function or associated item `foo` not found for this
|
||||||
|
|
|
||||||
|
= note: the following trait bounds were not satisfied:
|
||||||
|
`RawImpl<()>: Raw<()>`
|
||||||
|
note: the following trait must be implemented
|
||||||
|
--> $DIR/issue-62742.rs:12:1
|
||||||
|
|
|
||||||
|
LL | / pub trait Raw<T: ?Sized> {
|
||||||
|
LL | | type Value;
|
||||||
|
LL | | }
|
||||||
|
| |_^
|
||||||
|
|
||||||
|
error[E0277]: the trait bound `RawImpl<()>: Raw<()>` is not satisfied
|
||||||
|
--> $DIR/issue-62742.rs:6:5
|
||||||
|
|
|
||||||
|
LL | WrongImpl::<()>::foo(0i32);
|
||||||
|
| ^^^^^^^^^^^^^^^ the trait `Raw<()>` is not implemented for `RawImpl<()>`
|
||||||
|
|
|
||||||
|
= help: the following implementations were found:
|
||||||
|
<RawImpl<T> as Raw<[T]>>
|
||||||
|
note: required by a bound in `SafeImpl`
|
||||||
|
--> $DIR/issue-62742.rs:26:35
|
||||||
|
|
|
||||||
|
LL | pub struct SafeImpl<T: ?Sized, A: Raw<T>>(PhantomData<(A, T)>);
|
||||||
|
| ^^^^^^ required by this bound in `SafeImpl`
|
||||||
|
|
||||||
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
Some errors have detailed explanations: E0277, E0599.
|
||||||
|
For more information about an error, try `rustc --explain E0277`.
|
20
src/test/ui/impl-trait/issues/issue-67830.nll.stderr
Normal file
20
src/test/ui/impl-trait/issues/issue-67830.nll.stderr
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
error: implementation of `FnOnce` is not general enough
|
||||||
|
--> $DIR/issue-67830.rs:23:5
|
||||||
|
|
|
||||||
|
LL | Wrap(|a| Some(a).into_iter())
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
|
||||||
|
|
|
||||||
|
= note: closure with signature `fn(&'2 A) -> std::option::IntoIter<&A>` must implement `FnOnce<(&'1 A,)>`, for any lifetime `'1`...
|
||||||
|
= note: ...but it actually implements `FnOnce<(&'2 A,)>`, for some specific lifetime `'2`
|
||||||
|
|
||||||
|
error: implementation of `FnOnce` is not general enough
|
||||||
|
--> $DIR/issue-67830.rs:23:5
|
||||||
|
|
|
||||||
|
LL | Wrap(|a| Some(a).into_iter())
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
|
||||||
|
|
|
||||||
|
= note: closure with signature `fn(&'2 A) -> std::option::IntoIter<&A>` must implement `FnOnce<(&'1 A,)>`, for any lifetime `'1`...
|
||||||
|
= note: ...but it actually implements `FnOnce<(&'2 A,)>`, for some specific lifetime `'2`
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
26
src/test/ui/impl-trait/issues/issue-67830.rs
Normal file
26
src/test/ui/impl-trait/issues/issue-67830.rs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
trait MyFn<Arg> {
|
||||||
|
type Output;
|
||||||
|
fn call(&self, arg: Arg) -> Self::Output;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Wrap<F>(F);
|
||||||
|
|
||||||
|
impl<A, B, F> MyFn<A> for Wrap<F>
|
||||||
|
where
|
||||||
|
F: Fn(A) -> B
|
||||||
|
{
|
||||||
|
type Output = B;
|
||||||
|
|
||||||
|
fn call(&self, arg: A) -> Self::Output {
|
||||||
|
(self.0)(arg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct A;
|
||||||
|
fn test() -> impl for<'a> MyFn<&'a A, Output=impl Iterator + 'a> {
|
||||||
|
//~^ ERROR implementation of `FnOnce` is not general enough
|
||||||
|
Wrap(|a| Some(a).into_iter())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
15
src/test/ui/impl-trait/issues/issue-67830.stderr
Normal file
15
src/test/ui/impl-trait/issues/issue-67830.stderr
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
error: implementation of `FnOnce` is not general enough
|
||||||
|
--> $DIR/issue-67830.rs:21:66
|
||||||
|
|
|
||||||
|
LL | fn test() -> impl for<'a> MyFn<&'a A, Output=impl Iterator + 'a> {
|
||||||
|
| __________________________________________________________________^
|
||||||
|
LL | |
|
||||||
|
LL | | Wrap(|a| Some(a).into_iter())
|
||||||
|
LL | | }
|
||||||
|
| |_^ implementation of `FnOnce` is not general enough
|
||||||
|
|
|
||||||
|
= note: closure with signature `fn(&'2 A) -> std::option::IntoIter<&A>` must implement `FnOnce<(&'1 A,)>`, for any lifetime `'1`...
|
||||||
|
= note: ...but it actually implements `FnOnce<(&'2 A,)>`, for some specific lifetime `'2`
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
11
src/test/ui/impl-trait/issues/issue-74282.rs
Normal file
11
src/test/ui/impl-trait/issues/issue-74282.rs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
|
type Closure = impl Fn() -> u64;
|
||||||
|
struct Anonymous(Closure);
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let y = || -> Closure { || 3 };
|
||||||
|
Anonymous(|| { //~ ERROR mismatched types
|
||||||
|
3 //~^ ERROR mismatched types
|
||||||
|
})
|
||||||
|
}
|
33
src/test/ui/impl-trait/issues/issue-74282.stderr
Normal file
33
src/test/ui/impl-trait/issues/issue-74282.stderr
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
error[E0308]: mismatched types
|
||||||
|
--> $DIR/issue-74282.rs:8:15
|
||||||
|
|
|
||||||
|
LL | type Closure = impl Fn() -> u64;
|
||||||
|
| ---------------- the expected opaque type
|
||||||
|
...
|
||||||
|
LL | Anonymous(|| {
|
||||||
|
| _______________^
|
||||||
|
LL | | 3
|
||||||
|
LL | | })
|
||||||
|
| |_____^ expected closure, found a different closure
|
||||||
|
|
|
||||||
|
= note: expected opaque type `Closure`
|
||||||
|
found closure `[closure@$DIR/issue-74282.rs:8:15: 10:6]`
|
||||||
|
= note: no two closures, even if identical, have the same type
|
||||||
|
= help: consider boxing your closure and/or using it as a trait object
|
||||||
|
|
||||||
|
error[E0308]: mismatched types
|
||||||
|
--> $DIR/issue-74282.rs:8:5
|
||||||
|
|
|
||||||
|
LL | fn main() {
|
||||||
|
| - expected `()` because of default return type
|
||||||
|
LL | let y = || -> Closure { || 3 };
|
||||||
|
LL | / Anonymous(|| {
|
||||||
|
LL | | 3
|
||||||
|
LL | | })
|
||||||
|
| | ^- help: consider using a semicolon here: `;`
|
||||||
|
| |______|
|
||||||
|
| expected `()`, found struct `Anonymous`
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0308`.
|
21
src/test/ui/impl-trait/issues/issue-77987.rs
Normal file
21
src/test/ui/impl-trait/issues/issue-77987.rs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
|
// check-pass
|
||||||
|
|
||||||
|
trait Foo<T> {}
|
||||||
|
impl<T, U> Foo<T> for U {}
|
||||||
|
|
||||||
|
type Scope = impl Foo<()>;
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
|
fn infer_scope() -> Scope {
|
||||||
|
()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
|
fn ice() -> impl Foo<Scope>
|
||||||
|
{
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
19
src/test/ui/impl-trait/issues/issue-82139.rs
Normal file
19
src/test/ui/impl-trait/issues/issue-82139.rs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
|
trait Trait {
|
||||||
|
type Associated;
|
||||||
|
fn func() -> Self::Associated;
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Bound {}
|
||||||
|
pub struct Struct;
|
||||||
|
|
||||||
|
impl Trait for Struct {
|
||||||
|
type Associated = impl Bound;
|
||||||
|
|
||||||
|
fn func() -> Self::Associated {
|
||||||
|
Some(42).map(|_| j) //~ ERROR cannot find value `j` in this scope
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
9
src/test/ui/impl-trait/issues/issue-82139.stderr
Normal file
9
src/test/ui/impl-trait/issues/issue-82139.stderr
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
error[E0425]: cannot find value `j` in this scope
|
||||||
|
--> $DIR/issue-82139.rs:15:26
|
||||||
|
|
|
||||||
|
LL | Some(42).map(|_| j)
|
||||||
|
| ^ not found in this scope
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0425`.
|
31
src/test/ui/impl-trait/issues/issue-83919.rs
Normal file
31
src/test/ui/impl-trait/issues/issue-83919.rs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
|
// edition:2021
|
||||||
|
|
||||||
|
use std::future::Future;
|
||||||
|
|
||||||
|
trait Foo {
|
||||||
|
type T;
|
||||||
|
type Fut2: Future<Output=Self::T>; // ICE got triggered with traits other than Future here
|
||||||
|
type Fut: Future<Output=Self::Fut2>;
|
||||||
|
fn get_fut(&self) -> Self::Fut;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Implementor;
|
||||||
|
|
||||||
|
impl Foo for Implementor {
|
||||||
|
type T = u64;
|
||||||
|
type Fut2 = impl Future<Output=u64>;
|
||||||
|
type Fut = impl Future<Output=Self::Fut2>;
|
||||||
|
|
||||||
|
fn get_fut(&self) -> Self::Fut {
|
||||||
|
async move {
|
||||||
|
42 //~^ ERROR `{integer}` is not a future
|
||||||
|
// 42 does not impl Future and rustc does actually point out the error,
|
||||||
|
// but rustc used to panic.
|
||||||
|
// Putting a valid Future here always worked fine.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
17
src/test/ui/impl-trait/issues/issue-83919.stderr
Normal file
17
src/test/ui/impl-trait/issues/issue-83919.stderr
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
error[E0277]: `{integer}` is not a future
|
||||||
|
--> $DIR/issue-83919.rs:22:9
|
||||||
|
|
|
||||||
|
LL | / async move {
|
||||||
|
LL | | 42
|
||||||
|
LL | | // 42 does not impl Future and rustc does actually point out the error,
|
||||||
|
LL | | // but rustc used to panic.
|
||||||
|
LL | | // Putting a valid Future here always worked fine.
|
||||||
|
LL | | }
|
||||||
|
| |_________^ `{integer}` is not a future
|
||||||
|
|
|
||||||
|
= help: the trait `Future` is not implemented for `{integer}`
|
||||||
|
= note: {integer} must be a future or must implement `IntoFuture` to be awaited
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0277`.
|
33
src/test/ui/impl-trait/issues/issue-84073.rs
Normal file
33
src/test/ui/impl-trait/issues/issue-84073.rs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
|
pub trait StatefulFuture<S> {}
|
||||||
|
pub struct Never<T>(PhantomData<T>);
|
||||||
|
impl<T> StatefulFuture<T> for Never<T> {}
|
||||||
|
|
||||||
|
pub struct RaceBuilder<F, S> {
|
||||||
|
future: F,
|
||||||
|
_phantom: PhantomData<S>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T, F> RaceBuilder<T, F>
|
||||||
|
where
|
||||||
|
F: StatefulFuture<Option<T>>,
|
||||||
|
{
|
||||||
|
pub fn when(self) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Race<T, R> {
|
||||||
|
race: R,
|
||||||
|
_phantom: PhantomData<T>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T, R> Race<T, R>
|
||||||
|
where
|
||||||
|
R: Fn(RaceBuilder<T, Never<T>>),
|
||||||
|
{
|
||||||
|
pub fn new(race: R) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
Race::new(|race| race.when()); //~ ERROR type annotations needed
|
||||||
|
}
|
9
src/test/ui/impl-trait/issues/issue-84073.stderr
Normal file
9
src/test/ui/impl-trait/issues/issue-84073.stderr
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
error[E0282]: type annotations needed for `RaceBuilder<T, Never<T>>`
|
||||||
|
--> $DIR/issue-84073.rs:32:16
|
||||||
|
|
|
||||||
|
LL | Race::new(|race| race.when());
|
||||||
|
| ^^^^ consider giving this closure parameter the explicit type `RaceBuilder<T, Never<T>>`, where the type parameter `T` is specified
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0282`.
|
12
src/test/ui/impl-trait/issues/issue-86719.rs
Normal file
12
src/test/ui/impl-trait/issues/issue-86719.rs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
|
trait Bar {
|
||||||
|
type E;
|
||||||
|
}
|
||||||
|
impl<S> Bar for S {
|
||||||
|
type E = impl ; //~ ERROR at least one trait must be specified
|
||||||
|
fn foo() -> Self::E { //~ ERROR `foo` is not a member
|
||||||
|
|_| true //~ ERROR type annotations needed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fn main() {}
|
24
src/test/ui/impl-trait/issues/issue-86719.stderr
Normal file
24
src/test/ui/impl-trait/issues/issue-86719.stderr
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
error: at least one trait must be specified
|
||||||
|
--> $DIR/issue-86719.rs:7:14
|
||||||
|
|
|
||||||
|
LL | type E = impl ;
|
||||||
|
| ^^^^
|
||||||
|
|
||||||
|
error[E0407]: method `foo` is not a member of trait `Bar`
|
||||||
|
--> $DIR/issue-86719.rs:8:5
|
||||||
|
|
|
||||||
|
LL | / fn foo() -> Self::E {
|
||||||
|
LL | | |_| true
|
||||||
|
LL | | }
|
||||||
|
| |_____^ not a member of trait `Bar`
|
||||||
|
|
||||||
|
error[E0282]: type annotations needed
|
||||||
|
--> $DIR/issue-86719.rs:9:10
|
||||||
|
|
|
||||||
|
LL | |_| true
|
||||||
|
| ^ consider giving this closure parameter a type
|
||||||
|
|
||||||
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
Some errors have detailed explanations: E0282, E0407.
|
||||||
|
For more information about an error, try `rustc --explain E0282`.
|
48
src/test/ui/impl-trait/issues/issue-86800.rs
Normal file
48
src/test/ui/impl-trait/issues/issue-86800.rs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
|
// edition:2021
|
||||||
|
|
||||||
|
use std::future::Future;
|
||||||
|
|
||||||
|
struct Connection {
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Transaction {
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TestTransaction<'conn> {
|
||||||
|
conn: &'conn Connection
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'conn> Transaction for TestTransaction<'conn> {
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Context {
|
||||||
|
}
|
||||||
|
|
||||||
|
type TransactionResult<O> = Result<O, ()>;
|
||||||
|
|
||||||
|
type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>;
|
||||||
|
//~^ ERROR unconstrained opaque type
|
||||||
|
|
||||||
|
fn execute_transaction_fut<'f, F, O>(
|
||||||
|
f: F,
|
||||||
|
) -> impl FnOnce(&mut dyn Transaction) -> TransactionFuture<O>
|
||||||
|
where
|
||||||
|
F: FnOnce(&mut dyn Transaction) -> TransactionFuture<O> + 'f
|
||||||
|
{
|
||||||
|
f
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Context {
|
||||||
|
async fn do_transaction<O>(
|
||||||
|
&self, f: impl FnOnce(&mut dyn Transaction) -> TransactionFuture<O>
|
||||||
|
) -> TransactionResult<O>
|
||||||
|
{
|
||||||
|
let mut conn = Connection {};
|
||||||
|
let mut transaction = TestTransaction { conn: &mut conn };
|
||||||
|
f(&mut transaction).await
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
10
src/test/ui/impl-trait/issues/issue-86800.stderr
Normal file
10
src/test/ui/impl-trait/issues/issue-86800.stderr
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
error: unconstrained opaque type
|
||||||
|
--> $DIR/issue-86800.rs:25:34
|
||||||
|
|
|
||||||
|
LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: `TransactionFuture` must be used in combination with a concrete type within the same module
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
14
src/test/ui/impl-trait/issues/issue-87340.rs
Normal file
14
src/test/ui/impl-trait/issues/issue-87340.rs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
|
trait X {
|
||||||
|
type I;
|
||||||
|
fn f() -> Self::I;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> X for () {
|
||||||
|
//~^ ERROR `T` is not constrained by the impl trait, self type, or predicates
|
||||||
|
type I = impl Sized;
|
||||||
|
fn f() -> Self::I {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
9
src/test/ui/impl-trait/issues/issue-87340.stderr
Normal file
9
src/test/ui/impl-trait/issues/issue-87340.stderr
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
|
||||||
|
--> $DIR/issue-87340.rs:8:6
|
||||||
|
|
|
||||||
|
LL | impl<T> X for () {
|
||||||
|
| ^ unconstrained type parameter
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0207`.
|
24
src/test/ui/impl-trait/issues/issue-89312.rs
Normal file
24
src/test/ui/impl-trait/issues/issue-89312.rs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
|
// check-pass
|
||||||
|
|
||||||
|
trait T { type Item; }
|
||||||
|
|
||||||
|
type Alias<'a> = impl T<Item = &'a ()>;
|
||||||
|
|
||||||
|
struct S;
|
||||||
|
impl<'a> T for &'a S {
|
||||||
|
type Item = &'a ();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn filter_positive<'a>() -> Alias<'a> {
|
||||||
|
&S
|
||||||
|
}
|
||||||
|
|
||||||
|
fn with_positive(fun: impl Fn(Alias<'_>)) {
|
||||||
|
fun(filter_positive());
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
with_positive(|_| ());
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user