We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
known-bug
1 parent d7c5937 commit 2fc136bCopy full SHA for 2fc136b
tests/ui/type-alias-impl-trait/issue-108425-impl-generics-unsoundness.rs
@@ -0,0 +1,25 @@
1
+// known-bug: #108425
2
+// check-pass
3
+#![feature(type_alias_impl_trait)]
4
+use std::fmt::Display;
5
+
6
+type Opaque<'a> = impl Sized + 'static;
7
+fn define<'a>() -> Opaque<'a> {}
8
9
+trait Trait {
10
+ type Assoc: Display;
11
+}
12
+impl<'a> Trait for Opaque<'a> {
13
+ type Assoc = &'a str;
14
15
16
+// ======= Exploit =======
17
18
+fn extend<T: Trait + 'static>(s: T::Assoc) -> Box<dyn Display> {
19
+ Box::new(s)
20
21
22
+fn main() {
23
+ let val = extend::<Opaque<'_>>(&String::from("blah blah blah"));
24
+ println!("{}", val);
25
0 commit comments