summaryrefslogtreecommitdiffstats
path: root/src/test/ui/issues/issue-35139.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/issues/issue-35139.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-35139.rs b/src/test/ui/issues/issue-35139.rs
new file mode 100644
index 000000000..e462f3543
--- /dev/null
+++ b/src/test/ui/issues/issue-35139.rs
@@ -0,0 +1,26 @@
+use std::fmt;
+
+pub trait MethodType {
+ type GetProp: ?Sized;
+}
+
+pub struct MTFn;
+
+impl<'a> MethodType for MTFn { //~ ERROR E0207
+ type GetProp = dyn fmt::Debug + 'a;
+}
+
+fn bad(a: Box<<MTFn as MethodType>::GetProp>) -> Box<dyn fmt::Debug+'static> {
+ a
+}
+
+fn dangling(a: &str) -> Box<dyn fmt::Debug> {
+ bad(Box::new(a))
+}
+
+fn main() {
+ let mut s = "hello".to_string();
+ let x = dangling(&s);
+ s = String::new();
+ println!("{:?}", x);
+}