Don't CoerceUnsized dyn* to dyn*

This commit is contained in:
Michael Goulet 2022-11-10 23:36:20 +00:00
parent 0af211af67
commit 6e6c49e7ce
3 changed files with 28 additions and 2 deletions

View file

@ -0,0 +1,26 @@
// check-pass
#![feature(dyn_star)]
#![allow(incomplete_features)]
trait AddOne {
fn add1(&mut self) -> usize;
}
impl AddOne for usize {
fn add1(&mut self) -> usize {
*self += 1;
*self
}
}
fn add_one(i: &mut (dyn* AddOne + '_)) -> usize {
i.add1()
}
fn main() {
let mut x = 42usize as dyn* AddOne;
println!("{}", add_one(&mut x));
println!("{}", add_one(&mut x));
}