Rollup merge of #131857 - WaffleLapkin:dyn-drop-principal-3, r=compiler-errors
Allow dropping dyn principal Revival of #126660, which was a revival of #114679. Fixes #126313. Allows dropping principal when coercing trait objects, e.g. `dyn Debug + Send` -> `dyn Send`. cc `@compiler-errors` `@Jules-Bertholet` r? `@lcnr`
This commit is contained in:
commit
13b398401f
14 changed files with 167 additions and 35 deletions
|
@ -785,7 +785,8 @@ where
|
|||
let mut responses = vec![];
|
||||
// If the principal def ids match (or are both none), then we're not doing
|
||||
// trait upcasting. We're just removing auto traits (or shortening the lifetime).
|
||||
if a_data.principal_def_id() == b_data.principal_def_id() {
|
||||
let b_principal_def_id = b_data.principal_def_id();
|
||||
if a_data.principal_def_id() == b_principal_def_id || b_principal_def_id.is_none() {
|
||||
responses.extend(self.consider_builtin_upcast_to_principal(
|
||||
goal,
|
||||
CandidateSource::BuiltinImpl(BuiltinImplSource::Misc),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue