Auto merge of #90536 - crlf0710:fix_vtable_hrtb, r=jackh726
Erase regions within `vtable_trait_first_method_offset` Fixes #90177 . r? `@jackh726`
This commit is contained in:
commit
2cff30b17a
2 changed files with 36 additions and 1 deletions
32
src/test/ui/hrtb/issue-90177.rs
Normal file
32
src/test/ui/hrtb/issue-90177.rs
Normal file
|
|
@ -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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue