We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3c5de9a commit 3141262Copy full SHA for 3141262
tests/ui/wf/wf-in-where-clause-static.rs
@@ -0,0 +1,23 @@
1
+// check-pass
2
+// known-bug: #98117
3
+
4
+// Should fail. Functions are responsible for checking the well-formedness of
5
+// their own where clauses, so this should fail and require an explicit bound
6
+// `T: 'static`.
7
8
+use std::fmt::Display;
9
10
+trait Static: 'static {}
11
+impl<T> Static for &'static T {}
12
13
+fn foo<S: Display>(x: S) -> Box<dyn Display>
14
+where
15
+ &'static S: Static,
16
+{
17
+ Box::new(x)
18
+}
19
20
+fn main() {
21
+ let s = foo(&String::from("blah blah blah"));
22
+ println!("{}", s);
23
0 commit comments