mirror of
https://github.com/allankoechke/rust.git
synced 2026-11-30 11:05:36 +00:00
Add a test for suboptimal diagnostics
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
//@ compile-flags: -Znext-solver
|
||||
|
||||
// FIXME: The diagnostics here are suboptimal.
|
||||
// See <https://github.com/rust-lang/rust/issues/163784>.
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
//~^^^^^^ ERROR: overflow evaluating the requirement `X == _`
|
||||
|
||||
// TAIT with self-referencing bounds
|
||||
type X = impl std::ops::Add<Output = X>;
|
||||
|
||||
struct Foo;
|
||||
|
||||
impl Foo {
|
||||
#[define_opaque(X)]
|
||||
pub fn new() -> X {
|
||||
//~^ ERROR: item does not constrain `X::{opaque#0}`
|
||||
0i32
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,18 @@
|
||||
error: item does not constrain `X::{opaque#0}`
|
||||
--> $DIR/overflowing-opaque-incorrectly-unconstrained.rs:16:12
|
||||
|
|
||||
LL | pub fn new() -> X {
|
||||
| ^^^
|
||||
|
|
||||
= note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
|
||||
note: this opaque type is supposed to be constrained
|
||||
--> $DIR/overflowing-opaque-incorrectly-unconstrained.rs:10:10
|
||||
|
|
||||
LL | type X = impl std::ops::Add<Output = X>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0275]: overflow evaluating the requirement `X == _`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0275`.
|
||||
Reference in New Issue
Block a user