File tree 1 file changed +12
-5
lines changed
src/librustc_mir/transform
1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,17 @@ pub enum Candidate {
80
80
Argument { bb : BasicBlock , index : usize } ,
81
81
}
82
82
83
+ impl Candidate {
84
+ /// Returns `true` if we should use the "explicit" rules for promotability for this `Candidate`.
85
+ fn forces_explicit_promotion ( & self ) -> bool {
86
+ match self {
87
+ Candidate :: Ref ( _) |
88
+ Candidate :: Repeat ( _) => false ,
89
+ Candidate :: Argument { .. } => true ,
90
+ }
91
+ }
92
+ }
93
+
83
94
fn args_required_const ( tcx : TyCtxt < ' _ > , def_id : DefId ) -> Option < Vec < usize > > {
84
95
let attrs = tcx. get_attrs ( def_id) ;
85
96
let attr = attrs. iter ( ) . find ( |a| a. check_name ( sym:: rustc_args_required_const) ) ?;
@@ -727,11 +738,7 @@ pub fn validate_candidates(
727
738
} ;
728
739
729
740
candidates. iter ( ) . copied ( ) . filter ( |& candidate| {
730
- validator. explicit = match candidate {
731
- Candidate :: Ref ( _) |
732
- Candidate :: Repeat ( _) => false ,
733
- Candidate :: Argument { .. } => true ,
734
- } ;
741
+ validator. explicit = candidate. forces_explicit_promotion ( ) ;
735
742
736
743
// FIXME(eddyb) also emit the errors for shuffle indices
737
744
// and `#[rustc_args_required_const]` arguments here.
You can’t perform that action at this time.
0 commit comments