diff options
| author | lcnr <rust@lcnr.de> | 2025-08-08 19:18:17 +0200 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2025-08-08 19:24:53 +0200 |
| commit | 4eee55691aeb345cbac0ad558003d5f2ed72b478 (patch) | |
| tree | 6862902d569d970a3d8f4522df0431e3590f05b0 /tests/ui/impl-trait | |
| parent | 8b95291cd4f0a6e838fec89cb2687d81aff237be (diff) | |
| download | rust-4eee55691aeb345cbac0ad558003d5f2ed72b478.tar.gz rust-4eee55691aeb345cbac0ad558003d5f2ed72b478.zip | |
borrowck: defer opaque type errors
Diffstat (limited to 'tests/ui/impl-trait')
| -rw-r--r-- | tests/ui/impl-trait/issues/type-error-post-normalization-test.rs | 24 | ||||
| -rw-r--r-- | tests/ui/impl-trait/issues/type-error-post-normalization-test.stderr | 14 |
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/issues/type-error-post-normalization-test.rs b/tests/ui/impl-trait/issues/type-error-post-normalization-test.rs new file mode 100644 index 00000000000..0108bb23611 --- /dev/null +++ b/tests/ui/impl-trait/issues/type-error-post-normalization-test.rs @@ -0,0 +1,24 @@ +//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes + +// This previously introduced a `{type_error}`` in the MIR body +// during the `PostAnalysisNormalize` pass. While the underlying issue +// #135528 did not get fixed, this reproducer no longer ICEs. + +#![feature(type_alias_impl_trait)] +type Tait = impl Copy; + +fn set(x: &isize) -> isize { + *x +} + +#[define_opaque(Tait)] +fn d(x: Tait) { + set(x); +} + +#[define_opaque(Tait)] +fn other_define() -> Tait { + () //~^ ERROR concrete type differs from previous defining opaque type use +} + +fn main() {} diff --git a/tests/ui/impl-trait/issues/type-error-post-normalization-test.stderr b/tests/ui/impl-trait/issues/type-error-post-normalization-test.stderr new file mode 100644 index 00000000000..7d63c1cfbd6 --- /dev/null +++ b/tests/ui/impl-trait/issues/type-error-post-normalization-test.stderr @@ -0,0 +1,14 @@ +error: concrete type differs from previous defining opaque type use + --> $DIR/type-error-post-normalization-test.rs:20:22 + | +LL | fn other_define() -> Tait { + | ^^^^ expected `&isize`, got `()` + | +note: previous use here + --> $DIR/type-error-post-normalization-test.rs:16:9 + | +LL | set(x); + | ^ + +error: aborting due to 1 previous error + |
