diff options
| author | Michael Goulet <michael@errs.io> | 2025-01-14 17:54:53 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-01-14 17:59:54 +0000 |
| commit | bf545ce2fee9f1fef0fd9e63e46b5aab5de61465 (patch) | |
| tree | 7b1423cdd6d7222976a0fb7038845c7554c7ee8d /compiler/rustc_trait_selection/src/solve | |
| parent | 2ae9916816a448fcaab3b2da461de754eda0055a (diff) | |
| download | rust-bf545ce2fee9f1fef0fd9e63e46b5aab5de61465.tar.gz rust-bf545ce2fee9f1fef0fd9e63e46b5aab5de61465.zip | |
Prefer lower TraitUpcasting candidates
Diffstat (limited to 'compiler/rustc_trait_selection/src/solve')
| -rw-r--r-- | compiler/rustc_trait_selection/src/solve/select.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/select.rs b/compiler/rustc_trait_selection/src/solve/select.rs index 1661852903c..b0b6274907d 100644 --- a/compiler/rustc_trait_selection/src/solve/select.rs +++ b/compiler/rustc_trait_selection/src/solve/select.rs @@ -117,6 +117,10 @@ fn candidate_should_be_dropped_in_favor_of<'tcx>( CandidateSource::BuiltinImpl(BuiltinImplSource::Object(a)), CandidateSource::BuiltinImpl(BuiltinImplSource::Object(b)), ) => a >= b, + ( + CandidateSource::BuiltinImpl(BuiltinImplSource::TraitUpcasting(a)), + CandidateSource::BuiltinImpl(BuiltinImplSource::TraitUpcasting(b)), + ) => a >= b, // Prefer dyn candidates over non-dyn candidates. This is necessary to // handle the unsoundness between `impl<T: ?Sized> Any for T` and `dyn Any: Any`. ( |
