add known-bug test for unsound issue 98117
This commit is contained in:
parent
3c5de9a2e8
commit
314126257d
23
tests/ui/wf/wf-in-where-clause-static.rs
Normal file
23
tests/ui/wf/wf-in-where-clause-static.rs
Normal file
@ -0,0 +1,23 @@
|
||||
// check-pass
|
||||
// known-bug: #98117
|
||||
|
||||
// Should fail. Functions are responsible for checking the well-formedness of
|
||||
// their own where clauses, so this should fail and require an explicit bound
|
||||
// `T: 'static`.
|
||||
|
||||
use std::fmt::Display;
|
||||
|
||||
trait Static: 'static {}
|
||||
impl<T> Static for &'static T {}
|
||||
|
||||
fn foo<S: Display>(x: S) -> Box<dyn Display>
|
||||
where
|
||||
&'static S: Static,
|
||||
{
|
||||
Box::new(x)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let s = foo(&String::from("blah blah blah"));
|
||||
println!("{}", s);
|
||||
}
|
Loading…
Reference in New Issue
Block a user