diff options
| author | Bryanskiy <ivakin.kir@gmail.com> | 2024-03-22 16:27:26 +0300 |
|---|---|---|
| committer | Bryanskiy <ivakin.kir@gmail.com> | 2024-03-22 17:24:41 +0300 |
| commit | d1ba632f4f65051a6230db59e2ed2e1b1e8f12fc (patch) | |
| tree | d06c7423349728dc11cb2030f859dbf445bcd70d /tests/ui | |
| parent | eff958c59e8c07ba0515e164b825c9001b242294 (diff) | |
| download | rust-d1ba632f4f65051a6230db59e2ed2e1b1e8f12fc.tar.gz rust-d1ba632f4f65051a6230db59e2ed2e1b1e8f12fc.zip | |
Delegation: fix ICE on `bound_vars` divergence
Diffstat (limited to 'tests/ui')
| -rw-r--r-- | tests/ui/delegation/ice-issue-122550.rs | 18 | ||||
| -rw-r--r-- | tests/ui/delegation/ice-issue-122550.stderr | 31 |
2 files changed, 49 insertions, 0 deletions
diff --git a/tests/ui/delegation/ice-issue-122550.rs b/tests/ui/delegation/ice-issue-122550.rs new file mode 100644 index 00000000000..92c0dda9605 --- /dev/null +++ b/tests/ui/delegation/ice-issue-122550.rs @@ -0,0 +1,18 @@ +#![feature(fn_delegation)] +#![allow(incomplete_features)] + +trait Trait { + fn description(&self) -> &str {} + //~^ ERROR mismatched types +} + +struct F; +struct S(F); + +impl S { + reuse <S as Trait>::description { &self.0 } + //~^ ERROR mismatched types + //~| ERROR the trait bound `S: Trait` is not satisfied +} + +fn main() {} diff --git a/tests/ui/delegation/ice-issue-122550.stderr b/tests/ui/delegation/ice-issue-122550.stderr new file mode 100644 index 00000000000..c92170644e7 --- /dev/null +++ b/tests/ui/delegation/ice-issue-122550.stderr @@ -0,0 +1,31 @@ +error[E0308]: mismatched types + --> $DIR/ice-issue-122550.rs:5:35 + | +LL | fn description(&self) -> &str {} + | ^^ expected `&str`, found `()` + +error[E0308]: mismatched types + --> $DIR/ice-issue-122550.rs:13:39 + | +LL | reuse <S as Trait>::description { &self.0 } + | ^^^^^^^ expected `&S`, found `&F` + | + = note: expected reference `&S` + found reference `&F` + +error[E0277]: the trait bound `S: Trait` is not satisfied + --> $DIR/ice-issue-122550.rs:13:12 + | +LL | reuse <S as Trait>::description { &self.0 } + | ^ the trait `Trait` is not implemented for `S` + | +help: this trait has no implementations, consider adding one + --> $DIR/ice-issue-122550.rs:4:1 + | +LL | trait Trait { + | ^^^^^^^^^^^ + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. |
