Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add auto trait leakage TAIT test that should work but currently doesn't
- Loading branch information
1 parent
d0e08df
commit c85529e
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
22 changes: 22 additions & 0 deletions
22
src/test/ui/type-alias-impl-trait/auto-trait-leakage3.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |