about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-11-04 21:52:21 +0000
committerbors <bors@rust-lang.org>2021-11-04 21:52:21 +0000
commit2cff30b17a5409e15134f8634444069fc6f21cb6 (patch)
tree7bd5980739a20bce2ae37563144d9f2c7c4e29fc /src
parent4961b107f204e15b26961eab0685df6be3ab03c6 (diff)
parent8841204cc66f66e0e090b4a0c876e861e4cc75f7 (diff)
Auto merge of #90536 - crlf0710:fix_vtable_hrtb, r=jackh726
Erase regions within `vtable_trait_first_method_offset`

Fixes #90177 .

r? `@jackh726`
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/hrtb/issue-90177.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/ui/hrtb/issue-90177.rs b/src/test/ui/hrtb/issue-90177.rs
new file mode 100644
index 00000000000..b151a9d3ab6
--- /dev/null
+++ b/src/test/ui/hrtb/issue-90177.rs
@@ -0,0 +1,32 @@
+// check-pass
+
+trait Base<'f> {
+    type Assoc;
+
+    fn do_something(&self);
+}
+
+trait ForAnyLifetime: for<'f> Base<'f> {}
+
+impl<T> ForAnyLifetime for T where T: for<'f> Base<'f> {}
+
+trait CanBeDynamic: ForAnyLifetime + for<'f> Base<'f, Assoc = ()> {}
+
+fn foo(a: &dyn CanBeDynamic) {
+    a.do_something();
+}
+
+struct S;
+
+impl<'a> Base<'a> for S {
+    type Assoc = ();
+
+    fn do_something(&self) {}
+}
+
+impl CanBeDynamic for S {}
+
+fn main() {
+    let s = S;
+    foo(&s);
+}