add red test

This commit is contained in:
qaijuang
2026-05-17 16:12:19 -04:00
parent ba0949ab74
commit 7442ae735d
3 changed files with 87 additions and 2 deletions
@@ -12,6 +12,26 @@ LL | impl AsExpression<Text> for &'_ str {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for that trait implementation, expected `Text`, found `Integer`
error: aborting due to 1 previous error
error[E0277]: the trait bound `X: A` is not satisfied
--> $DIR/as_expression.rs:60:5
|
LL | X.start().foo().finish();
| ^^^^^^^^^ unsatisfied trait bound
|
help: the trait `A` is not implemented for `X`
--> $DIR/as_expression.rs:70:1
|
LL | struct X;
| ^^^^^^^^
note: required by a bound in `Ext::foo`
--> $DIR/as_expression.rs:79:23
|
LL | fn foo(self) -> Self
| --- required by a bound in this associated function
LL | where
LL | Self: Sized + A;
| ^ required by this bound in `Ext::foo`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.
@@ -22,6 +22,26 @@ LL | where
LL | T: AsExpression<Self::SqlType>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Foo::check`
error: aborting due to 1 previous error
error[E0277]: the trait bound `X: A` is not satisfied
--> $DIR/as_expression.rs:60:15
|
LL | X.start().foo().finish();
| ^^^ unsatisfied trait bound
|
help: the trait `A` is not implemented for `X`
--> $DIR/as_expression.rs:70:1
|
LL | struct X;
| ^^^^^^^^
note: required by a bound in `Ext::foo`
--> $DIR/as_expression.rs:79:23
|
LL | fn foo(self) -> Self
| --- required by a bound in this associated function
LL | where
LL | Self: Sized + A;
| ^ required by this bound in `Ext::foo`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.
@@ -55,4 +55,49 @@ impl<T> Foo for T where T: Expression {}
fn main() {
SelectInt.check("bar");
//~^ ERROR the trait bound `&str: AsExpression<Integer>` is not satisfied
// Regression test for https://github.com/rust-lang/rust/issues/156475.
X.start().foo().finish();
//~^ ERROR the trait bound `X: A` is not satisfied
}
trait A {}
trait B {}
#[diagnostic::do_not_recommend]
impl<T: B> A for T {}
struct X;
trait Start {
fn start(self) -> Self;
}
trait Ext {
fn foo(self) -> Self
where
Self: Sized + A;
}
trait Finish {
fn finish(self);
}
impl<T> Start for T {
fn start(self) -> Self {
self
}
}
impl<T> Ext for T {
fn foo(self) -> Self
where
Self: Sized + A,
{
self
}
}
impl<T> Finish for T {
fn finish(self) {}
}