mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
Make DerefPure dyn-incompatible
Fixes https://github.com/rust-lang/rust/issues/154619. If `DerefPure` were dyn-compatible, a trait object of a subtrait of `DerefPure` could be created by unsize-coercing an existing type that implements `DerefPure`. But then the trait object could have its own non-pure impl of `Deref`/`DerefMut`, which is unsound, since the trait object would implement `DerefPure`. Thus, we make `DerefPure` dyn-incompatible.
This commit is contained in:
@@ -293,6 +293,7 @@ fn deref_mut(&mut self) -> &mut T {
|
||||
/// unchanged.
|
||||
#[unstable(feature = "deref_pure_trait", issue = "87121")]
|
||||
#[lang = "deref_pure"]
|
||||
#[rustc_dyn_incompatible_trait]
|
||||
pub unsafe trait DerefPure: PointeeSized {}
|
||||
|
||||
#[unstable(feature = "deref_pure_trait", issue = "87121")]
|
||||
|
||||
Reference in New Issue
Block a user