update tests
This commit is contained in:
parent
e3850f404d
commit
28e5c9505c
@ -1,5 +1,5 @@
|
|||||||
error[E0720]: cannot resolve opaque type
|
error[E0720]: cannot resolve opaque type
|
||||||
--> $DIR/recursive-coroutine.rs:5:13
|
--> $DIR/recursive-coroutine.rs:7:13
|
||||||
|
|
|
|
||||||
LL | fn foo() -> impl Coroutine<Yield = (), Return = ()> {
|
LL | fn foo() -> impl Coroutine<Yield = (), Return = ()> {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive opaque type
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive opaque type
|
12
tests/ui/impl-trait/recursive-coroutine.next.stderr
Normal file
12
tests/ui/impl-trait/recursive-coroutine.next.stderr
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
error[E0720]: cannot resolve opaque type
|
||||||
|
--> $DIR/recursive-coroutine.rs:7:13
|
||||||
|
|
|
||||||
|
LL | fn foo() -> impl Coroutine<Yield = (), Return = ()> {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive opaque type
|
||||||
|
...
|
||||||
|
LL | let mut gen = Box::pin(foo());
|
||||||
|
| ------- coroutine captures itself here
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0720`.
|
@ -1,3 +1,5 @@
|
|||||||
|
// revisions: current next
|
||||||
|
//[next] compile-flags: -Ztrait-solver=next
|
||||||
#![feature(coroutines, coroutine_trait)]
|
#![feature(coroutines, coroutine_trait)]
|
||||||
|
|
||||||
use std::ops::{Coroutine, CoroutineState};
|
use std::ops::{Coroutine, CoroutineState};
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
error: opaque type's hidden type cannot be another opaque type from the same scope
|
error: opaque type's hidden type cannot be another opaque type from the same scope
|
||||||
--> $DIR/two_tait_defining_each_other.rs:12:5
|
--> $DIR/two_tait_defining_each_other.rs:16:5
|
||||||
|
|
|
|
||||||
LL | x // A's hidden type is `Bar`, because all the hidden types of `B` are compared with each other
|
LL | x // A's hidden type is `Bar`, because all the hidden types of `B` are compared with each other
|
||||||
| ^ one of the two opaque types used here has to be outside its defining scope
|
| ^ one of the two opaque types used here has to be outside its defining scope
|
||||||
|
|
|
|
||||||
note: opaque type whose hidden type is being assigned
|
note: opaque type whose hidden type is being assigned
|
||||||
--> $DIR/two_tait_defining_each_other.rs:4:10
|
--> $DIR/two_tait_defining_each_other.rs:8:10
|
||||||
|
|
|
|
||||||
LL | type B = impl Foo;
|
LL | type B = impl Foo;
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
note: opaque type being used as hidden type
|
note: opaque type being used as hidden type
|
||||||
--> $DIR/two_tait_defining_each_other.rs:3:10
|
--> $DIR/two_tait_defining_each_other.rs:7:10
|
||||||
|
|
|
|
||||||
LL | type A = impl Foo;
|
LL | type A = impl Foo;
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
@ -1,3 +1,7 @@
|
|||||||
|
// revisions: current next
|
||||||
|
//[next] compile-flags: -Ztrait-solver=next
|
||||||
|
//[next] check-pass
|
||||||
|
|
||||||
#![feature(type_alias_impl_trait)]
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
type A = impl Foo;
|
type A = impl Foo;
|
||||||
@ -10,7 +14,7 @@ fn muh(x: A) -> B {
|
|||||||
return Bar; // B's hidden type is Bar
|
return Bar; // B's hidden type is Bar
|
||||||
}
|
}
|
||||||
x // A's hidden type is `Bar`, because all the hidden types of `B` are compared with each other
|
x // A's hidden type is `Bar`, because all the hidden types of `B` are compared with each other
|
||||||
//~^ ERROR opaque type's hidden type cannot be another opaque type
|
//[current]~^ ERROR opaque type's hidden type cannot be another opaque type
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Bar;
|
struct Bar;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error: unconstrained opaque type
|
error: unconstrained opaque type
|
||||||
--> $DIR/two_tait_defining_each_other2.rs:3:10
|
--> $DIR/two_tait_defining_each_other2.rs:5:10
|
||||||
|
|
|
|
||||||
LL | type A = impl Foo;
|
LL | type A = impl Foo;
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
@ -7,18 +7,18 @@ LL | type A = impl Foo;
|
|||||||
= note: `A` must be used in combination with a concrete type within the same module
|
= note: `A` must be used in combination with a concrete type within the same module
|
||||||
|
|
||||||
error: opaque type's hidden type cannot be another opaque type from the same scope
|
error: opaque type's hidden type cannot be another opaque type from the same scope
|
||||||
--> $DIR/two_tait_defining_each_other2.rs:9:5
|
--> $DIR/two_tait_defining_each_other2.rs:11:5
|
||||||
|
|
|
|
||||||
LL | x // B's hidden type is A (opaquely)
|
LL | x // B's hidden type is A (opaquely)
|
||||||
| ^ one of the two opaque types used here has to be outside its defining scope
|
| ^ one of the two opaque types used here has to be outside its defining scope
|
||||||
|
|
|
|
||||||
note: opaque type whose hidden type is being assigned
|
note: opaque type whose hidden type is being assigned
|
||||||
--> $DIR/two_tait_defining_each_other2.rs:4:10
|
--> $DIR/two_tait_defining_each_other2.rs:6:10
|
||||||
|
|
|
|
||||||
LL | type B = impl Foo;
|
LL | type B = impl Foo;
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
note: opaque type being used as hidden type
|
note: opaque type being used as hidden type
|
||||||
--> $DIR/two_tait_defining_each_other2.rs:3:10
|
--> $DIR/two_tait_defining_each_other2.rs:5:10
|
||||||
|
|
|
|
||||||
LL | type A = impl Foo;
|
LL | type A = impl Foo;
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
@ -0,0 +1,9 @@
|
|||||||
|
error[E0284]: type annotations needed: cannot satisfy `A <: B`
|
||||||
|
--> $DIR/two_tait_defining_each_other2.rs:11:5
|
||||||
|
|
|
||||||
|
LL | x // B's hidden type is A (opaquely)
|
||||||
|
| ^ cannot satisfy `A <: B`
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0284`.
|
@ -1,13 +1,16 @@
|
|||||||
|
// revisions: current next
|
||||||
|
//[next] compile-flags: -Ztrait-solver=next
|
||||||
#![feature(type_alias_impl_trait)]
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
type A = impl Foo; //~ ERROR unconstrained opaque type
|
type A = impl Foo; //[current]~ ERROR unconstrained opaque type
|
||||||
type B = impl Foo;
|
type B = impl Foo;
|
||||||
|
|
||||||
trait Foo {}
|
trait Foo {}
|
||||||
|
|
||||||
fn muh(x: A) -> B {
|
fn muh(x: A) -> B {
|
||||||
x // B's hidden type is A (opaquely)
|
x // B's hidden type is A (opaquely)
|
||||||
//~^ ERROR opaque type's hidden type cannot be another opaque type
|
//[current]~^ ERROR opaque type's hidden type cannot be another opaque type
|
||||||
|
//[next]~^^ ERROR type annotations needed: cannot satisfy `A <: B`
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Bar;
|
struct Bar;
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
error: opaque type's hidden type cannot be another opaque type from the same scope
|
error: opaque type's hidden type cannot be another opaque type from the same scope
|
||||||
--> $DIR/two_tait_defining_each_other3.rs:10:16
|
--> $DIR/two_tait_defining_each_other3.rs:13:16
|
||||||
|
|
|
|
||||||
LL | return x; // B's hidden type is A (opaquely)
|
LL | return x; // B's hidden type is A (opaquely)
|
||||||
| ^ one of the two opaque types used here has to be outside its defining scope
|
| ^ one of the two opaque types used here has to be outside its defining scope
|
||||||
|
|
|
|
||||||
note: opaque type whose hidden type is being assigned
|
note: opaque type whose hidden type is being assigned
|
||||||
--> $DIR/two_tait_defining_each_other3.rs:4:10
|
--> $DIR/two_tait_defining_each_other3.rs:7:10
|
||||||
|
|
|
|
||||||
LL | type B = impl Foo;
|
LL | type B = impl Foo;
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
note: opaque type being used as hidden type
|
note: opaque type being used as hidden type
|
||||||
--> $DIR/two_tait_defining_each_other3.rs:3:10
|
--> $DIR/two_tait_defining_each_other3.rs:6:10
|
||||||
|
|
|
|
||||||
LL | type A = impl Foo;
|
LL | type A = impl Foo;
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
@ -1,3 +1,6 @@
|
|||||||
|
// revisions: current next
|
||||||
|
//[next] compile-flags: -Ztrait-solver=next
|
||||||
|
//[next] check-pass
|
||||||
#![feature(type_alias_impl_trait)]
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
type A = impl Foo;
|
type A = impl Foo;
|
||||||
@ -8,7 +11,7 @@ trait Foo {}
|
|||||||
fn muh(x: A) -> B {
|
fn muh(x: A) -> B {
|
||||||
if false {
|
if false {
|
||||||
return x; // B's hidden type is A (opaquely)
|
return x; // B's hidden type is A (opaquely)
|
||||||
//~^ ERROR opaque type's hidden type cannot be another opaque type
|
//[current]~^ ERROR opaque type's hidden type cannot be another opaque type
|
||||||
}
|
}
|
||||||
Bar // A's hidden type is `Bar`, because all the return types are compared with each other
|
Bar // A's hidden type is `Bar`, because all the return types are compared with each other
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
// check-pass
|
||||||
|
// compile-flags: -Ztrait-solver=next
|
||||||
|
|
||||||
|
fn test<T: Iterator>(x: T::Item) -> impl Sized {
|
||||||
|
x
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
@ -1,7 +1,3 @@
|
|||||||
WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <<LocalTy as Overflow>::Assoc as std::marker::Sized>
|
|
||||||
WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <<LocalTy as Overflow>::Assoc as std::marker::Sized>
|
|
||||||
WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <<LocalTy as Overflow>::Assoc as std::marker::Sized>
|
|
||||||
WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <<LocalTy as Overflow>::Assoc as std::marker::Sized>
|
|
||||||
error[E0119]: conflicting implementations of trait `Trait` for type `<LocalTy as Overflow>::Assoc`
|
error[E0119]: conflicting implementations of trait `Trait` for type `<LocalTy as Overflow>::Assoc`
|
||||||
--> $DIR/trait_ref_is_knowable-norm-overflow.rs:17:1
|
--> $DIR/trait_ref_is_knowable-norm-overflow.rs:17:1
|
||||||
|
|
|
|
||||||
@ -11,7 +7,8 @@ LL | struct LocalTy;
|
|||||||
LL | impl Trait for <LocalTy as Overflow>::Assoc {}
|
LL | impl Trait for <LocalTy as Overflow>::Assoc {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `<LocalTy as Overflow>::Assoc`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `<LocalTy as Overflow>::Assoc`
|
||||||
|
|
|
|
||||||
= note: upstream crates may add a new impl of trait `std::marker::Copy` for type `<LocalTy as Overflow>::Assoc` in future versions
|
= note: downstream crates may implement trait `std::marker::Sized` for type `<LocalTy as Overflow>::Assoc`
|
||||||
|
= note: downstream crates may implement trait `std::marker::Copy` for type `<LocalTy as Overflow>::Assoc`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
// Tests that we properly detect defining usages when using
|
// Tests that we properly detect defining usages when using
|
||||||
// const generics in an associated opaque type
|
// const generics in an associated opaque type
|
||||||
// check-pass
|
|
||||||
|
|
||||||
|
// check-pass
|
||||||
|
// revisions: current next
|
||||||
|
//[next] compile-flags: -Ztrait-solver=next
|
||||||
#![feature(impl_trait_in_assoc_type)]
|
#![feature(impl_trait_in_assoc_type)]
|
||||||
|
|
||||||
trait UnwrapItemsExt<'a, const C: usize> {
|
trait UnwrapItemsExt<'a, const C: usize> {
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
// check-pass
|
// check-pass
|
||||||
|
// revisions: current next
|
||||||
|
//[next] compile-flags: -Ztrait-solver=next
|
||||||
|
|
||||||
#![feature(impl_trait_in_assoc_type)]
|
#![feature(impl_trait_in_assoc_type)]
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0309]: the parameter type `T` may not live long enough
|
error[E0309]: the parameter type `T` may not live long enough
|
||||||
--> $DIR/wf-in-associated-type.rs:36:23
|
--> $DIR/wf-in-associated-type.rs:38:23
|
||||||
|
|
|
|
||||||
LL | impl<'a, T> Trait<'a, T> for () {
|
LL | impl<'a, T> Trait<'a, T> for () {
|
||||||
| -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
|
| -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
|
||||||
@ -12,7 +12,7 @@ LL | impl<'a, T: 'a> Trait<'a, T> for () {
|
|||||||
| ++++
|
| ++++
|
||||||
|
|
||||||
error[E0309]: the parameter type `T` may not live long enough
|
error[E0309]: the parameter type `T` may not live long enough
|
||||||
--> $DIR/wf-in-associated-type.rs:36:23
|
--> $DIR/wf-in-associated-type.rs:38:23
|
||||||
|
|
|
|
||||||
LL | impl<'a, T> Trait<'a, T> for () {
|
LL | impl<'a, T> Trait<'a, T> for () {
|
||||||
| -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
|
| -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
// WF check for impl Trait in associated type position.
|
// WF check for impl Trait in associated type position.
|
||||||
//
|
//
|
||||||
// revisions: pass fail
|
// revisions: pass pass_next fail
|
||||||
// [pass] check-pass
|
// [pass] check-pass
|
||||||
|
// [pass_next] compile-flags: -Ztrait-solver=next
|
||||||
|
// [pass_next] check-pass
|
||||||
// [fail] check-fail
|
// [fail] check-fail
|
||||||
|
|
||||||
#![feature(impl_trait_in_assoc_type)]
|
#![feature(impl_trait_in_assoc_type)]
|
||||||
|
|
||||||
// The hidden type here (`&'a T`) requires proving `T: 'a`.
|
// The hidden type here (`&'a T`) requires proving `T: 'a`.
|
||||||
// We know it holds because of implied bounds from the impl header.
|
// We know it holds because of implied bounds from the impl header.
|
||||||
#[cfg(pass)]
|
#[cfg(any(pass, pass_next))]
|
||||||
mod pass {
|
mod pass {
|
||||||
trait Trait<Req> {
|
trait Trait<Req> {
|
||||||
type Opaque1;
|
type Opaque1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user