File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
src/librustc_mir/transform Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,17 @@ pub enum Candidate {
8080 Argument { bb : BasicBlock , index : usize } ,
8181}
8282
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+
8394fn args_required_const ( tcx : TyCtxt < ' _ > , def_id : DefId ) -> Option < Vec < usize > > {
8495 let attrs = tcx. get_attrs ( def_id) ;
8596 let attr = attrs. iter ( ) . find ( |a| a. check_name ( sym:: rustc_args_required_const) ) ?;
@@ -727,11 +738,7 @@ pub fn validate_candidates(
727738 } ;
728739
729740 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 ( ) ;
735742
736743 // FIXME(eddyb) also emit the errors for shuffle indices
737744 // and `#[rustc_args_required_const]` arguments here.
You can’t perform that action at this time.
0 commit comments