Skip to content

Commit

Permalink
add known-bug test for unsound issue 98117
Browse files Browse the repository at this point in the history
  • Loading branch information
whtahy committed Apr 22, 2023
1 parent 3c5de9a commit 3141262
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/ui/wf/wf-in-where-clause-static.rs
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit 3141262

Please sign in to comment.