Allow dropping `dyn Trait` principal by Jules-Bertholet · Pull Request #126660 · rust-lang/rust
rustbot
added
A-coercions
labels
Jun 19, 2024matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request
Oct 18, 2024… r=compiler-errors Allow dropping dyn principal Revival of rust-lang#126660, which was a revival of rust-lang#114679. Fixes rust-lang#126313. Allows dropping principal when coercing trait objects, e.g. `dyn Debug + Send` -> `dyn Send`. cc `@compiler-errors` `@Jules-Bertholet` r? `@lcnr`
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
Oct 18, 2024Rollup merge of rust-lang#131857 - WaffleLapkin:dyn-drop-principal-3, r=compiler-errors Allow dropping dyn principal Revival of rust-lang#126660, which was a revival of rust-lang#114679. Fixes rust-lang#126313. Allows dropping principal when coercing trait objects, e.g. `dyn Debug + Send` -> `dyn Send`. cc `@compiler-errors` `@Jules-Bertholet` r? `@lcnr`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request
Apr 7, 2025…l-with-proj, r=oli-obk Fix trait upcasting to dyn type with no principal when there are projections rust-lang#126660 (which I had originally authored, lol) had a subtle bug that is the moral equivalent of rust-lang#114036, which is that when upcasting from `dyn Principal<Projection = Ty> + AutoTrait` to `dyn AutoTrait`, we were dropping the trait ref for `Principal` but not its projections (if there were any). With debug assertions enabled, this triggers the assertion I luckily added in a2a0cfe, but even without debug assertions this is a logical bug since we had a dyn type with just a projection bound but no principal, so it caused a type mismatch. This does not need an FCP because this should've been covered by the FCP in rust-lang#126660, but we just weren't testing a case when casting from a `dyn` type with projections 😸 Fixes rust-lang#139418 r? `@oli-obk` (or anyone)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request
Apr 7, 2025…l-with-proj, r=oli-obk Fix trait upcasting to dyn type with no principal when there are projections rust-lang#126660 (which I had originally authored, lol) had a subtle bug that is the moral equivalent of rust-lang#114036, which is that when upcasting from `dyn Principal<Projection = Ty> + AutoTrait` to `dyn AutoTrait`, we were dropping the trait ref for `Principal` but not its projections (if there were any). With debug assertions enabled, this triggers the assertion I luckily added in a2a0cfe, but even without debug assertions this is a logical bug since we had a dyn type with just a projection bound but no principal, so it caused a type mismatch. This does not need an FCP because this should've been covered by the FCP in rust-lang#126660, but we just weren't testing a case when casting from a `dyn` type with projections 😸 Fixes rust-lang#139418 r? ``@oli-obk`` (or anyone)
Zalathar added a commit to Zalathar/rust that referenced this pull request
Apr 8, 2025…l-with-proj, r=oli-obk Fix trait upcasting to dyn type with no principal when there are projections rust-lang#126660 (which I had originally authored, lol) had a subtle bug that is the moral equivalent of rust-lang#114036, which is that when upcasting from `dyn Principal<Projection = Ty> + AutoTrait` to `dyn AutoTrait`, we were dropping the trait ref for `Principal` but not its projections (if there were any). With debug assertions enabled, this triggers the assertion I luckily added in a2a0cfe, but even without debug assertions this is a logical bug since we had a dyn type with just a projection bound but no principal, so it caused a type mismatch. This does not need an FCP because this should've been covered by the FCP in rust-lang#126660, but we just weren't testing a case when casting from a `dyn` type with projections 😸 Fixes rust-lang#139418 r? ```@oli-obk``` (or anyone)
Zalathar added a commit to Zalathar/rust that referenced this pull request
Apr 8, 2025…l-with-proj, r=oli-obk Fix trait upcasting to dyn type with no principal when there are projections rust-lang#126660 (which I had originally authored, lol) had a subtle bug that is the moral equivalent of rust-lang#114036, which is that when upcasting from `dyn Principal<Projection = Ty> + AutoTrait` to `dyn AutoTrait`, we were dropping the trait ref for `Principal` but not its projections (if there were any). With debug assertions enabled, this triggers the assertion I luckily added in a2a0cfe, but even without debug assertions this is a logical bug since we had a dyn type with just a projection bound but no principal, so it caused a type mismatch. This does not need an FCP because this should've been covered by the FCP in rust-lang#126660, but we just weren't testing a case when casting from a `dyn` type with projections 😸 Fixes rust-lang#139418 r? ````@oli-obk```` (or anyone)
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
Apr 8, 2025Rollup merge of rust-lang#139421 - compiler-errors:upcast-no-principal-with-proj, r=oli-obk Fix trait upcasting to dyn type with no principal when there are projections rust-lang#126660 (which I had originally authored, lol) had a subtle bug that is the moral equivalent of rust-lang#114036, which is that when upcasting from `dyn Principal<Projection = Ty> + AutoTrait` to `dyn AutoTrait`, we were dropping the trait ref for `Principal` but not its projections (if there were any). With debug assertions enabled, this triggers the assertion I luckily added in a2a0cfe, but even without debug assertions this is a logical bug since we had a dyn type with just a projection bound but no principal, so it caused a type mismatch. This does not need an FCP because this should've been covered by the FCP in rust-lang#126660, but we just weren't testing a case when casting from a `dyn` type with projections 😸 Fixes rust-lang#139418 r? ````@oli-obk```` (or anyone)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters