Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Prepare test for old solver
  • Loading branch information
oli-obk committed Oct 30, 2025
commit bc4d612d46f8cfc63a4718109450572b071fb2d8
18 changes: 16 additions & 2 deletions tests/ui/consts/trait_alias.fail.stderr
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
error[E0277]: the trait bound `T: [const] Baz` is not satisfied
--> $DIR/trait_alias.rs:22:11
--> $DIR/trait_alias.rs:23:11
|
LL | x.baz();
| ^^^

error: aborting due to 1 previous error
error[E0277]: the trait bound `(): const Foo` is not satisfied
--> $DIR/trait_alias.rs:28:19
|
LL | const _: () = foo(&());
| --- ^^^
| |
| required by a bound introduced by this call
|
note: required by a bound in `foo`
--> $DIR/trait_alias.rs:19:17
|
LL | const fn foo<T: [const] Foo>(x: &T) {
| ^^^^^^^^^^^ required by this bound in `foo`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.
9 changes: 9 additions & 0 deletions tests/ui/consts/trait_alias.next_fail.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0277]: the trait bound `T: [const] Baz` is not satisfied
--> $DIR/trait_alias.rs:23:11
|
LL | x.baz();
| ^^^

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0277`.
17 changes: 17 additions & 0 deletions tests/ui/consts/trait_alias.pass.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
error[E0277]: the trait bound `(): const Foo` is not satisfied
--> $DIR/trait_alias.rs:28:19
|
LL | const _: () = foo(&());
| --- ^^^
| |
| required by a bound introduced by this call
|
note: required by a bound in `foo`
--> $DIR/trait_alias.rs:19:17
|
LL | const fn foo<T: [const] Foo>(x: &T) {
| ^^^^^^^^^^^ required by this bound in `foo`

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0277`.
12 changes: 7 additions & 5 deletions tests/ui/consts/trait_alias.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#![feature(trait_alias, const_trait_impl)]
//@ revisions: pass fail
//@ compile-flags: -Znext-solver
//@[pass] check-pass
//@ revisions: next_pass next_fail pass fail
//@[next_pass] compile-flags: -Znext-solver
//@[next_fail] compile-flags: -Znext-solver
//@[next_pass] check-pass

const trait Bar {
fn bar(&self) {}
Expand All @@ -17,13 +18,14 @@ const trait Foo = [const] Bar + Baz;

const fn foo<T: [const] Foo>(x: &T) {
x.bar();
#[cfg(fail)]
#[cfg(any(fail, next_fail))]
{
x.baz();
//[fail]~^ ERROR: the trait bound `T: [const] Baz` is not satisfied
//[fail,next_fail]~^ ERROR: the trait bound `T: [const] Baz` is not satisfied
}
}

const _: () = foo(&());
//[fail,pass]~^ ERROR: `(): const Foo` is not satisfied

fn main() {}