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>(
173
173
victim_idx >= other_idx
174
174
}
175
175
( _, CandidateSource :: ParamEnv ( _) ) => true ,
176
+
177
+ (
178
+ CandidateSource :: BuiltinImpl ( BuiltinImplSource :: Object ) ,
179
+ CandidateSource :: BuiltinImpl ( BuiltinImplSource :: Object ) ,
180
+ ) => false ,
181
+ ( _, CandidateSource :: BuiltinImpl ( BuiltinImplSource :: Object ) ) => true ,
182
+
176
183
( CandidateSource :: Impl ( victim_def_id) , CandidateSource :: Impl ( other_def_id) ) => {
177
184
tcx. specializes ( ( other_def_id, victim_def_id) )
178
185
&& other. result . value . certainty == Certainty :: Yes
179
186
}
187
+
180
188
_ => false ,
181
189
}
182
190
}
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