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 that shouldn't leak TAIT test
- Loading branch information
1 parent
5ac46d7
commit d0e08df
Showing
2 changed files
with
39 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,19 @@ | ||
#![feature(type_alias_impl_trait)] | ||
#![allow(dead_code)] | ||
|
||
mod m { | ||
use std::rc::Rc; | ||
|
||
type Foo = impl std::fmt::Debug; | ||
|
||
pub fn foo() -> Foo { | ||
Rc::new(22_u32) | ||
} | ||
} | ||
|
||
fn is_send<T: Send>(_: T) {} | ||
|
||
fn main() { | ||
is_send(m::foo()); | ||
//~^ ERROR: `Rc<u32>` cannot be sent between threads safely [E0277] | ||
} |
20 changes: 20 additions & 0 deletions
20
src/test/ui/type-alias-impl-trait/auto-trait-leakage2.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,20 @@ | ||
error[E0277]: `Rc<u32>` cannot be sent between threads safely | ||
--> $DIR/auto-trait-leakage2.rs:17:5 | ||
| | ||
LL | type Foo = impl std::fmt::Debug; | ||
| -------------------- within this `impl Debug` | ||
... | ||
LL | is_send(m::foo()); | ||
| ^^^^^^^ `Rc<u32>` cannot be sent between threads safely | ||
| | ||
= help: within `impl Debug`, the trait `Send` is not implemented for `Rc<u32>` | ||
= note: required because it appears within the type `impl Debug` | ||
note: required by a bound in `is_send` | ||
--> $DIR/auto-trait-leakage2.rs:14:15 | ||
| | ||
LL | fn is_send<T: Send>(_: T) {} | ||
| ^^^^ required by this bound in `is_send` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |