Skip to content

Commit af131d5

Browse files
committed
rustc_mir: remove qualify_consts::Qualif::FN_ARGUMENT.
1 parent b4fbebb commit af131d5

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/librustc_mir/transform/qualify_consts.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,13 @@ bitflags::bitflags! {
4141
// Constant containing an ADT that implements Drop.
4242
const NEEDS_DROP = 1 << 1;
4343

44-
// Function argument.
45-
const FN_ARGUMENT = 1 << 2;
46-
4744
// Not constant at all - non-`const fn` calls, asm!,
4845
// pointer comparisons, ptr-to-int casts, etc.
49-
const NOT_CONST = 1 << 3;
46+
const NOT_CONST = 1 << 2;
5047

5148
// Refers to temporaries which cannot be promoted as
5249
// promote_consts decided they weren't simple enough.
53-
const NOT_PROMOTABLE = 1 << 4;
50+
const NOT_PROMOTABLE = 1 << 3;
5451

5552
// Const items can only have MUTABLE_INTERIOR
5653
// and NOT_PROMOTABLE without producing an error.
@@ -136,10 +133,6 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx> {
136133
let mut qualif = self.local_qualif[local]
137134
.unwrap_or(Qualif::NOT_CONST);
138135

139-
if let LocalKind::Arg = kind {
140-
qualif = qualif | Qualif::FN_ARGUMENT;
141-
}
142-
143136
if !self.temp_promotion_state[local].is_promotable() {
144137
qualif = qualif | Qualif::NOT_PROMOTABLE;
145138
}
@@ -498,9 +491,8 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
498491

499492
let mut local_qualif = IndexVec::from_elem(None, &mir.local_decls);
500493
for arg in mir.args_iter() {
501-
let mut qualif = Qualif::NEEDS_DROP;
502-
qualif.restrict(mir.local_decls[arg].ty, tcx, param_env);
503-
local_qualif[arg] = Some(qualif);
494+
let qualif = Qualif::for_ty(mir.local_decls[arg].ty, tcx, param_env);
495+
local_qualif[arg] = Some(Qualif::NOT_PROMOTABLE | qualif);
504496
}
505497

506498
Checker {

0 commit comments

Comments
 (0)