rust/tests/ui/trivial-bounds/trivial-bounds-inconsistent-sized.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
616 B
Rust
Raw Normal View History

2018-05-06 16:54:00 -05:00
// run-pass
// Check tautalogically false `Sized` bounds
#![feature(trivial_bounds)]
#![allow(unused)]
trait A {}
impl A for i32 {}
struct T<X: ?Sized> {
x: X,
}
struct S(str, str) where str: Sized;
//~^ WARNING Sized does not depend on any type or lifetime
2018-05-06 16:54:00 -05:00
2019-05-28 13:46:13 -05:00
fn unsized_local() where for<'a> T<dyn A + 'a>: Sized {
//~^ WARNING Sized does not depend on any type or lifetime
2019-05-28 13:46:13 -05:00
let x: T<dyn A> = *(Box::new(T { x: 1 }) as Box<T<dyn A>>);
2018-05-06 16:54:00 -05:00
}
fn return_str() -> str where str: Sized {
//~^ WARNING Sized does not depend on any type or lifetime
2018-05-06 16:54:00 -05:00
*"Sized".to_string().into_boxed_str()
}
fn main() {}