1
Illegal sized bounds: only suggest mutability change if needed by sulami · Pull...
source link: https://github.com/rust-lang/rust/pull/105491
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
In a scenario like
struct Type;
pub trait Trait {
fn function(&mut self)
where
Self: Sized;
}
impl Trait for Type {
fn function(&mut self) {}
}
fn main() {
(&mut Type as &mut dyn Trait).function();
}
the problem is Sized, not the mutability of self. Thus don't emit the "you need &T instead of &mut T" note, or the other way around, as all it does is just invert the mutability of whatever was supplied.
Fixes #103622.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK