diff options
| author | whtahy <whtahy@users.noreply.github.com> | 2023-04-22 13:31:00 -0400 |
|---|---|---|
| committer | whtahy <whtahy@users.noreply.github.com> | 2023-04-22 13:31:00 -0400 |
| commit | 314126257d3d20e3e788325f3b88b7e635bd6bb8 (patch) | |
| tree | 878c19c27d5b16ba92eab1d2475e255e8fe07516 | |
| parent | 3c5de9a2e85e4490fad8c30a8078ac7117a01836 (diff) | |
| download | rust-314126257d3d20e3e788325f3b88b7e635bd6bb8.tar.gz rust-314126257d3d20e3e788325f3b88b7e635bd6bb8.zip | |
add known-bug test for unsound issue 98117
| -rw-r--r-- | tests/ui/wf/wf-in-where-clause-static.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/ui/wf/wf-in-where-clause-static.rs b/tests/ui/wf/wf-in-where-clause-static.rs new file mode 100644 index 00000000000..86722afdf9f --- /dev/null +++ b/tests/ui/wf/wf-in-where-clause-static.rs @@ -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); +} |
