diff options
Diffstat (limited to 'tests')
4 files changed, 39 insertions, 100 deletions
diff --git a/tests/ui/traits/new-solver/dont-remap-tait-substs.rs b/tests/ui/traits/new-solver/dont-remap-tait-substs.rs index 08c08e83076..028222f4e6d 100644 --- a/tests/ui/traits/new-solver/dont-remap-tait-substs.rs +++ b/tests/ui/traits/new-solver/dont-remap-tait-substs.rs @@ -1,5 +1,5 @@ // compile-flags: -Ztrait-solver=next -// known-bug: #112825 +// check-pass // Makes sure we don't prepopulate the MIR typeck of `define` // with `Foo<T, U> = T`, but instead, `Foo<B, A> = B`, so that diff --git a/tests/ui/traits/new-solver/dont-remap-tait-substs.stderr b/tests/ui/traits/new-solver/dont-remap-tait-substs.stderr deleted file mode 100644 index 769eea7dfd6..00000000000 --- a/tests/ui/traits/new-solver/dont-remap-tait-substs.stderr +++ /dev/null @@ -1,99 +0,0 @@ -error[E0391]: cycle detected when computing type of `Foo::{opaque#0}` - --> $DIR/dont-remap-tait-substs.rs:10:24 - | -LL | type Foo<T: Send, U> = impl NeedsSend<T>; - | ^^^^^^^^^^^^^^^^^ - | -note: ...which requires borrow-checking `define`... - --> $DIR/dont-remap-tait-substs.rs:15:1 - | -LL | fn define<A, B: Send>(a: A, b: B) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which again requires computing type of `Foo::{opaque#0}`, completing the cycle -note: cycle used when checking item types in top-level module - --> $DIR/dont-remap-tait-substs.rs:8:1 - | -LL | / #![feature(type_alias_impl_trait)] -LL | | -LL | | type Foo<T: Send, U> = impl NeedsSend<T>; -LL | | -... | -LL | | -LL | | fn main() {} - | |____________^ - -error[E0391]: cycle detected when computing type of `Foo::{opaque#0}` - --> $DIR/dont-remap-tait-substs.rs:10:24 - | -LL | type Foo<T: Send, U> = impl NeedsSend<T>; - | ^^^^^^^^^^^^^^^^^ - | -note: ...which requires borrow-checking `define`... - --> $DIR/dont-remap-tait-substs.rs:15:1 - | -LL | fn define<A, B: Send>(a: A, b: B) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which again requires computing type of `Foo::{opaque#0}`, completing the cycle -note: cycle used when checking item types in top-level module - --> $DIR/dont-remap-tait-substs.rs:8:1 - | -LL | / #![feature(type_alias_impl_trait)] -LL | | -LL | | type Foo<T: Send, U> = impl NeedsSend<T>; -LL | | -... | -LL | | -LL | | fn main() {} - | |____________^ - -error[E0391]: cycle detected when computing type of `Foo::{opaque#0}` - --> $DIR/dont-remap-tait-substs.rs:10:24 - | -LL | type Foo<T: Send, U> = impl NeedsSend<T>; - | ^^^^^^^^^^^^^^^^^ - | -note: ...which requires borrow-checking `define`... - --> $DIR/dont-remap-tait-substs.rs:15:1 - | -LL | fn define<A, B: Send>(a: A, b: B) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which again requires computing type of `Foo::{opaque#0}`, completing the cycle -note: cycle used when checking item types in top-level module - --> $DIR/dont-remap-tait-substs.rs:8:1 - | -LL | / #![feature(type_alias_impl_trait)] -LL | | -LL | | type Foo<T: Send, U> = impl NeedsSend<T>; -LL | | -... | -LL | | -LL | | fn main() {} - | |____________^ - -error[E0391]: cycle detected when computing type of `Foo::{opaque#0}` - --> $DIR/dont-remap-tait-substs.rs:10:24 - | -LL | type Foo<T: Send, U> = impl NeedsSend<T>; - | ^^^^^^^^^^^^^^^^^ - | -note: ...which requires borrow-checking `define`... - --> $DIR/dont-remap-tait-substs.rs:15:1 - | -LL | fn define<A, B: Send>(a: A, b: B) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which again requires computing type of `Foo::{opaque#0}`, completing the cycle -note: cycle used when checking item types in top-level module - --> $DIR/dont-remap-tait-substs.rs:8:1 - | -LL | / #![feature(type_alias_impl_trait)] -LL | | -LL | | type Foo<T: Send, U> = impl NeedsSend<T>; -LL | | -... | -LL | | -LL | | fn main() {} - | |____________^ - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr b/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr new file mode 100644 index 00000000000..ec1c3231abc --- /dev/null +++ b/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr @@ -0,0 +1,16 @@ +error[E0283]: type annotations needed: cannot satisfy `Foo: Send` + --> $DIR/dont-type_of-tait-in-defining-scope.rs:16:5 + | +LL | needs_send::<Foo>(); + | ^^^^^^^^^^^^^^^^^ + | + = note: cannot satisfy `Foo: Send` +note: required by a bound in `needs_send` + --> $DIR/dont-type_of-tait-in-defining-scope.rs:13:18 + | +LL | fn needs_send<T: Send>() {} + | ^^^^ required by this bound in `needs_send` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.rs b/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.rs new file mode 100644 index 00000000000..5a0dcd0e8cc --- /dev/null +++ b/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.rs @@ -0,0 +1,22 @@ +// revisions: is_send not_send +// compile-flags: -Ztrait-solver=next +//[is_send] check-pass + +#![feature(type_alias_impl_trait)] + +#[cfg(is_send)] +type Foo = impl Send; + +#[cfg(not_send)] +type Foo = impl Sized; + +fn needs_send<T: Send>() {} + +fn test() { + needs_send::<Foo>(); + //[not_send]~^ ERROR type annotations needed: cannot satisfy `Foo: Send` +} + +fn main() { + let _: Foo = (); +} |
