diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2021-08-27 22:03:39 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2021-08-27 22:03:39 -0300 |
| commit | c85529e6288028ecf62635ff001caf0603d67ac2 (patch) | |
| tree | e236efae9ee9d9e6246e6e5f0f2e084339c8b21b /src/test | |
| parent | d0e08dffcf2353af76de298cd9cb4b9d55f66199 (diff) | |
| download | rust-c85529e6288028ecf62635ff001caf0603d67ac2.tar.gz rust-c85529e6288028ecf62635ff001caf0603d67ac2.zip | |
Add auto trait leakage TAIT test that should work but currently doesn't
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/type-alias-impl-trait/auto-trait-leakage3.rs | 21 | ||||
| -rw-r--r-- | src/test/ui/type-alias-impl-trait/auto-trait-leakage3.stderr | 22 |
2 files changed, 43 insertions, 0 deletions
diff --git a/src/test/ui/type-alias-impl-trait/auto-trait-leakage3.rs b/src/test/ui/type-alias-impl-trait/auto-trait-leakage3.rs new file mode 100644 index 00000000000..5fb7a9473d3 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/auto-trait-leakage3.rs @@ -0,0 +1,21 @@ +#![feature(type_alias_impl_trait)] +#![allow(dead_code)] + +// FIXME This should compile, but it currently doesn't + +mod m { + type Foo = impl std::fmt::Debug; + //~^ ERROR: cycle detected when computing type of `m::Foo::{opaque#0}` [E0391] + + pub fn foo() -> Foo { + 22_u32 + } + + pub fn bar() { + is_send(foo()); + } + + fn is_send<T: Send>(_: T) {} +} + +fn main() {} diff --git a/src/test/ui/type-alias-impl-trait/auto-trait-leakage3.stderr b/src/test/ui/type-alias-impl-trait/auto-trait-leakage3.stderr new file mode 100644 index 00000000000..ac7bbd272c7 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/auto-trait-leakage3.stderr @@ -0,0 +1,22 @@ +error[E0391]: cycle detected when computing type of `m::Foo::{opaque#0}` + --> $DIR/auto-trait-leakage3.rs:7:16 + | +LL | type Foo = impl std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^ + | +note: ...which requires type-checking `m::bar`... + --> $DIR/auto-trait-leakage3.rs:14:5 + | +LL | pub fn bar() { + | ^^^^^^^^^^^^ + = note: ...which requires evaluating trait selection obligation `impl std::fmt::Debug: std::marker::Send`... + = note: ...which again requires computing type of `m::Foo::{opaque#0}`, completing the cycle +note: cycle used when checking item types in module `m` + --> $DIR/auto-trait-leakage3.rs:6:1 + | +LL | mod m { + | ^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0391`. |
