File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
compiler/rustc_trait_selection/src/solve/eval_ctxt
tests/ui/traits/new-solver Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -173,10 +173,18 @@ fn candidate_should_be_dropped_in_favor_of<'tcx>(
173173 victim_idx >= other_idx
174174 }
175175 ( _, CandidateSource :: ParamEnv ( _) ) => true ,
176+
177+ (
178+ CandidateSource :: BuiltinImpl ( BuiltinImplSource :: Object ) ,
179+ CandidateSource :: BuiltinImpl ( BuiltinImplSource :: Object ) ,
180+ ) => false ,
181+ ( _, CandidateSource :: BuiltinImpl ( BuiltinImplSource :: Object ) ) => true ,
182+
176183 ( CandidateSource :: Impl ( victim_def_id) , CandidateSource :: Impl ( other_def_id) ) => {
177184 tcx. specializes ( ( other_def_id, victim_def_id) )
178185 && other. result . value . certainty == Certainty :: Yes
179186 }
187+
180188 _ => false ,
181189 }
182190}
Original file line number Diff line number Diff line change 1+ // compile-flags: -Ztrait-solver=next
2+ // check-pass
3+
4+ use std:: any:: Any ;
5+
6+ fn needs_usize ( _: & usize ) { }
7+
8+ fn main ( ) {
9+ let x: & dyn Any = & 1usize ;
10+ if let Some ( x) = x. downcast_ref :: < usize > ( ) {
11+ needs_usize ( x) ;
12+ }
13+ }
You can’t perform that action at this time.
0 commit comments