diff --git a/src/test/ui/type-alias-impl-trait/auto-trait-leakage2.rs b/src/test/ui/type-alias-impl-trait/auto-trait-leakage2.rs new file mode 100644 index 00000000000..745379efa6d --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/auto-trait-leakage2.rs @@ -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) {} + +fn main() { + is_send(m::foo()); + //~^ ERROR: `Rc` cannot be sent between threads safely [E0277] +} diff --git a/src/test/ui/type-alias-impl-trait/auto-trait-leakage2.stderr b/src/test/ui/type-alias-impl-trait/auto-trait-leakage2.stderr new file mode 100644 index 00000000000..d60be4b1ccf --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/auto-trait-leakage2.stderr @@ -0,0 +1,20 @@ +error[E0277]: `Rc` 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` cannot be sent between threads safely + | + = help: within `impl Debug`, the trait `Send` is not implemented for `Rc` + = 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) {} + | ^^^^ required by this bound in `is_send` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`.