Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions tests/ui/abi/invalid-self-parameter-type-56806.next.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
error[E0391]: cycle detected when checking if trait `Trait` is dyn-compatible
--> $DIR/invalid-self-parameter-type-56806.rs:11:1
|
LL | pub trait Trait {
| ^^^^^^^^^^^^^^^
|
= note: ...which requires determining dyn-compatibility of trait `Trait`...
= note: ...which again requires checking if trait `Trait` is dyn-compatible, completing the cycle
note: cycle used when checking that `Trait::dyn_instead_of_self` is well-formed
--> $DIR/invalid-self-parameter-type-56806.rs:12:5
|
LL | fn dyn_instead_of_self(self: Box<dyn Trait>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: for more information, see <https://rustc-dev-guide.rust-lang.org/overview.html#queries> and <https://rustc-dev-guide.rust-lang.org/query.html>

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0391`.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0307]: invalid `self` parameter type: `Box<(dyn Trait + 'static)>`
--> $DIR/invalid-self-parameter-type-56806.rs:3:34
--> $DIR/invalid-self-parameter-type-56806.rs:12:34
|
LL | fn dyn_instead_of_self(self: Box<dyn Trait>);
| ^^^^^^^^^^^^^^
Expand Down
12 changes: 11 additions & 1 deletion tests/ui/abi/invalid-self-parameter-type-56806.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
//@ revisions: old next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver

// https://github.com/rust-lang/rust/issues/56806
//
// This results in a query cycle with the new solver. Let's not
// bother with this when stabilizing the new solver. For more context,
// see https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/dyn.20compatibility.20check.20in.20object.20candidate.20causes.20cycle/with/627370998

pub trait Trait {
fn dyn_instead_of_self(self: Box<dyn Trait>);
//~^ ERROR invalid `self` parameter type
//[old]~^ ERROR: invalid `self` parameter type
//[next]~^^^ ERROR: cycle detected when checking if trait `Trait` is dyn-compatible
}

pub fn main() {}
18 changes: 18 additions & 0 deletions tests/ui/async-await/inference_var_self_argument.next.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
error[E0391]: cycle detected when checking if trait `Foo` is dyn-compatible
--> $DIR/inference_var_self_argument.rs:13:1
|
LL | trait Foo {
| ^^^^^^^^^
|
= note: ...which requires determining dyn-compatibility of trait `Foo`...
= note: ...which again requires checking if trait `Foo` is dyn-compatible, completing the cycle
note: cycle used when checking that `Foo::foo` is well-formed
--> $DIR/inference_var_self_argument.rs:15:5
|
LL | async fn foo(self: &dyn Foo) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: for more information, see <https://rustc-dev-guide.rust-lang.org/overview.html#queries> and <https://rustc-dev-guide.rust-lang.org/query.html>

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0391`.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0307]: invalid `self` parameter type: `&dyn Foo`
--> $DIR/inference_var_self_argument.rs:5:24
--> $DIR/inference_var_self_argument.rs:15:24
|
LL | async fn foo(self: &dyn Foo) {
| ^^^^^^^^
Expand All @@ -8,17 +8,18 @@ LL | async fn foo(self: &dyn Foo) {
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)

error[E0038]: the trait `Foo` is not dyn compatible
--> $DIR/inference_var_self_argument.rs:5:33
--> $DIR/inference_var_self_argument.rs:15:33
|
LL | async fn foo(self: &dyn Foo) {
| ^ `Foo` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
--> $DIR/inference_var_self_argument.rs:5:14
--> $DIR/inference_var_self_argument.rs:15:14
|
LL | trait Foo {
| --- this trait is not dyn compatible...
LL |
LL | async fn foo(self: &dyn Foo) {
| ^^^ ...because method `foo` is `async`
= help: consider moving `foo` to another trait
Expand Down
16 changes: 13 additions & 3 deletions tests/ui/async-await/inference_var_self_argument.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
//! This is a regression test for an ICE.
//@ revisions: old next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@ edition: 2021

// This is a regression test for an ICE.
//
// This results in a query cycle with the new solver. Let's not
// bother with this when stabilizing the new solver. For more context,
// see https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/dyn.20compatibility.20check.20in.20object.20candidate.20causes.20cycle/with/627370998


trait Foo {
//[next]~^ ERROR: cycle detected when checking if trait `Foo` is dyn-compatible
async fn foo(self: &dyn Foo) {
//~^ ERROR: `Foo` is not dyn compatible
//~| ERROR invalid `self` parameter type: `&dyn Foo`
//[old]~^ ERROR: `Foo` is not dyn compatible
//[old]~| ERROR: invalid `self` parameter type: `&dyn Foo`
todo!()
}
}
Expand Down
5 changes: 4 additions & 1 deletion tests/ui/borrowck/alias-liveness/escaping-bounds.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@ check-pass

// Ensure that we don't ICE when an alias that has escaping bound vars is
Expand All @@ -16,7 +19,7 @@ fn foo<'a, 'b, T: Foo>(_: <T as Foo>::Assoc<'a, 'b>) {}

fn test<'b, T: Foo>() {
let y: MentionsLifetimeAndType<'_, for<'a> fn(<T as Foo>::Assoc<'a, 'b>)> =
MentionsLifetimeAndType(&(), foo);
MentionsLifetimeAndType(&(), foo::<T>);
}

fn main() {}
11 changes: 11 additions & 0 deletions tests/ui/delegation/fn-header.next.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0282]: type annotations needed
--> $DIR/fn-header.rs:23:17
|
LL | reuse to_reuse::async_fn;
| ^^^^^^^^ cannot infer type
|
= note: cannot infer type of hidden type of opaque

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0282`.
6 changes: 5 additions & 1 deletion tests/ui/delegation/fn-header.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
//@ check-pass
//@ revisions: old next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@[next] known-bug: trait-system-refactor-initiative#304
//@[old] check-pass
//@ edition:2018
//@ aux-crate:fn_header_aux=fn-header-aux.rs
//@ ignore-backends: gcc
Expand Down
19 changes: 19 additions & 0 deletions tests/ui/delegation/impl-trait.next.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
error[E0282]: type annotations needed
--> $DIR/impl-trait.rs:13:17
|
LL | reuse to_reuse::foo;
| ^^^ cannot infer type
|
= note: cannot infer type of hidden type of opaque

error[E0282]: type annotations needed
--> $DIR/impl-trait.rs:23:21
|
LL | reuse to_reuse::foo;
| ^^^ cannot infer type
|
= note: cannot infer type of hidden type of opaque

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0282`.
6 changes: 5 additions & 1 deletion tests/ui/delegation/impl-trait.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
//@ check-pass
//@ revisions: old next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@[next] known-bug: trait-system-refactor-initiative#304
//@[old] check-pass

#![feature(fn_delegation)]

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
error: concrete type differs from previous defining opaque type use
--> $DIR/incomplete-constraint.rs:15:5
|
LL | new_defining_use(rpit1::<'a, 'b>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&'b ()`, got `&'static ()`
|
note: previous use here
--> $DIR/incomplete-constraint.rs:14:1
|
LL | fn rpit1<'a, 'b: 'b>(x: &'b ()) -> impl Sized + use<'a, 'b> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: concrete type differs from previous defining opaque type use
--> $DIR/incomplete-constraint.rs:21:5
|
LL | new_defining_use(rpit2::<'a>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Inv<'a, 'static>`, got `Inv<'a, 'a>`
|
note: previous use here
--> $DIR/incomplete-constraint.rs:20:1
|
LL | fn rpit2<'a>(_: ()) -> impl Sized + use<'a> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//@ check-pass
// FIXME(-Znext-solver): enable this test
//@ revisions: old next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@[next] known-bug: trait-system-refactor-initiative#227
//@[old] check-pass

// These functions currently do not normalize the opaque type but will do
// so in the future. At this point we've got a new use of the opaque with fully
Expand Down
11 changes: 11 additions & 0 deletions tests/ui/impl-trait/recursive-impl-trait-type-direct.next.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0282]: type annotations needed
--> $DIR/recursive-impl-trait-type-direct.rs:13:14
|
LL | fn test() -> impl Sized {
| ^^^^^^^^^^ cannot infer type
|
= note: cannot infer type of hidden type of opaque

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0282`.
11 changes: 10 additions & 1 deletion tests/ui/impl-trait/recursive-impl-trait-type-direct.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
//@ check-pass
//@ revisions: old next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@[old] check-pass

#![allow(unconditional_recursion)]

// The new solver does not allow unconstrained opaque types and unlike
// the old solver, does not fall back to `()` here.
//
// See https://github.com/rust-lang/trait-system-refactor-initiative/issues/144.

fn test() -> impl Sized {
//[next]~^ ERROR: type annotations needed
test()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
error: item does not constrain `Foo::{opaque#0}`
--> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs:11:4
|
LL | fn foo() -> Foo {
| ^^^
|
= note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
note: this opaque type is supposed to be constrained
--> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs:8:16
|
LL | pub type Foo = impl PartialEq<(Foo, i32)>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0275]: overflow evaluating the requirement `Foo == _`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0275`.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#![feature(type_alias_impl_trait)]

//@ check-pass
//@ revisions: old next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@[next] known-bug: trait-system-refactor-initiative#143
//@[old] check-pass

pub type Foo = impl PartialEq<(Foo, i32)>;

Expand Down
13 changes: 13 additions & 0 deletions tests/ui/implied-bounds/gluon_salsa.next.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
error[E0309]: the associated type `<Q as AsyncQueryFunction<'_>>::SendDb` may not live long enough
--> $DIR/gluon_salsa.rs:46:26
|
LL | pub fn get_async<'a>(&'a mut self) {
| -- ^^^^^^^^^^^^ ...so that the type `QueryTable<'me, Q, <Q as AsyncQueryFunction<'_>>::SendDb>` will meet its required lifetime bounds
| |
| the associated type `<Q as AsyncQueryFunction<'_>>::SendDb` must be valid for the lifetime `'a` as defined here...
|
= help: consider adding an explicit lifetime bound `<Q as AsyncQueryFunction<'_>>::SendDb: 'a`...

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0309`.
17 changes: 16 additions & 1 deletion tests/ui/implied-bounds/gluon_salsa.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
//@ check-pass
//@ revisions: old next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@[old] check-pass

// Related to Bevy regression #115559, found in
// a crater run on #118553.
//
// Normalizing when computing implied bounds and normalizing the
// signature when checking that it is well-formed happen separately.
//
// In the old solver both use the projection_cache so the resulting type
// has the same unconstrained infer var.
//
// The new solver does not have any per-infcx caches, so the unconstrained
// variables differ, causing lexical region error to fail to prove the relevant
// type outlives.

pub trait QueryBase {
type Db;
Expand Down Expand Up @@ -30,6 +44,7 @@ where
// to work we may have to structurally resolve regions as the actually used vars may
// otherwise be semantically equal but structurally different.
pub fn get_async<'a>(&'a mut self) {
//[next]~^ ERROR: the associated type `<Q as AsyncQueryFunction<'_>>::SendDb` may not live long enough
panic!();
}
}
Expand Down
29 changes: 29 additions & 0 deletions tests/ui/transmutability/alignment/align-pass.next.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
error[E0277]: `&[u16; 0]` cannot be safely transmuted into `&[u8; 0]`
--> $DIR/align-pass.rs:25:56
|
LL | assert::is_maybe_transmutable::<&'static [u16; 0], &'static [u8; 0]>();
| ^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
= help: the nightly-only, unstable trait `TransmuteFrom<&'static [u16; 0], Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static [u8; 0]`
note: required by a bound in `is_maybe_transmutable`
--> $DIR/align-pass.rs:13:14
|
LL | pub fn is_maybe_transmutable<Src, Dst>()
LL | where
LL | Dst: TransmuteFrom<Src, {
| ______________^
LL | | Assume {
LL | | alignment: false,
LL | | lifetimes: false,
... |
LL | | }>
| |__________^ required by this bound in `is_maybe_transmutable`
help: consider removing the leading `&`-reference
|
LL - assert::is_maybe_transmutable::<&'static [u16; 0], &'static [u8; 0]>();
LL + assert::is_maybe_transmutable::<&'static [u16; 0], [u8; 0]>();
|

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0277`.
6 changes: 5 additions & 1 deletion tests/ui/transmutability/alignment/align-pass.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
//@ check-pass
//@ revisions: old next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@[next] known-bug: trait-system-refactor-initiative#152
//@[old] check-pass
#![feature(transmutability)]

mod assert {
Expand Down
Loading
Loading