Skip to content

Commit a8f9302

Browse files
committed
avoid features_untracked
1 parent 691a7f8 commit a8f9302

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/librustc/ty/constness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
6666
}
6767
} else {
6868
// users enabling the `const_fn` feature gate can do what they want
69-
!self.sess.features_untracked().const_fn
69+
!self.features().const_fn
7070
}
7171
}
7272
}

src/librustc_mir/transform/qualify_consts.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
357357
TerminatorKind::FalseUnwind { .. } => None,
358358

359359
TerminatorKind::Return => {
360-
if !self.tcx.sess.features_untracked().const_let {
360+
if !self.tcx.features().const_let {
361361
// Check for unused values. This usually means
362362
// there are extra statements in the AST.
363363
for temp in mir.temps_iter() {
@@ -464,7 +464,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> {
464464
LocalKind::ReturnPointer => {
465465
self.not_const();
466466
}
467-
LocalKind::Var if !self.tcx.sess.features_untracked().const_let => {
467+
LocalKind::Var if !self.tcx.features().const_let => {
468468
if self.mode != Mode::Fn {
469469
emit_feature_err(&self.tcx.sess.parse_sess, "const_let",
470470
self.span, GateIssue::Language,
@@ -558,7 +558,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> {
558558
Mode::Fn => {},
559559
_ => {
560560
if let ty::RawPtr(_) = base_ty.sty {
561-
if !this.tcx.sess.features_untracked().const_raw_ptr_deref {
561+
if !this.tcx.features().const_raw_ptr_deref {
562562
emit_feature_err(
563563
&this.tcx.sess.parse_sess, "const_raw_ptr_deref",
564564
this.span, GateIssue::Language,
@@ -581,7 +581,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> {
581581
match this.mode {
582582
Mode::Fn => this.not_const(),
583583
Mode::ConstFn => {
584-
if !this.tcx.sess.features_untracked().const_fn_union {
584+
if !this.tcx.features().const_fn_union {
585585
emit_feature_err(
586586
&this.tcx.sess.parse_sess, "const_fn_union",
587587
this.span, GateIssue::Language,
@@ -807,7 +807,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> {
807807
if let Mode::Fn = self.mode {
808808
// in normal functions, mark such casts as not promotable
809809
self.add(Qualif::NOT_CONST);
810-
} else if !self.tcx.sess.features_untracked().const_raw_ptr_to_usize_cast {
810+
} else if !self.tcx.features().const_raw_ptr_to_usize_cast {
811811
// in const fn and constants require the feature gate
812812
// FIXME: make it unsafe inside const fn and constants
813813
emit_feature_err(
@@ -834,7 +834,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> {
834834
if let Mode::Fn = self.mode {
835835
// raw pointer operations are not allowed inside promoteds
836836
self.add(Qualif::NOT_CONST);
837-
} else if !self.tcx.sess.features_untracked().const_compare_raw_pointers {
837+
} else if !self.tcx.features().const_compare_raw_pointers {
838838
// require the feature gate inside constants and const fn
839839
// FIXME: make it unsafe to use these operations
840840
emit_feature_err(
@@ -933,7 +933,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> {
933933
if self.mode != Mode::Fn {
934934
is_const_fn = true;
935935
// const eval transmute calls only with the feature gate
936-
if !self.tcx.sess.features_untracked().const_transmute {
936+
if !self.tcx.features().const_transmute {
937937
emit_feature_err(
938938
&self.tcx.sess.parse_sess, "const_transmute",
939939
self.span, GateIssue::Language,
@@ -971,7 +971,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> {
971971
// FIXME: cannot allow this inside `allow_internal_unstable` because
972972
// that would make `panic!` insta stable in constants, since the
973973
// macro is marked with the attr
974-
if self.tcx.sess.features_untracked().const_panic {
974+
if self.tcx.features().const_panic {
975975
is_const_fn = true;
976976
} else {
977977
// don't allow panics in constants without the feature gate
@@ -1158,7 +1158,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> {
11581158
if let (Mode::ConstFn, &Place::Local(index)) = (self.mode, dest) {
11591159
if self.mir.local_kind(index) == LocalKind::Var &&
11601160
self.const_fn_arg_vars.insert(index) &&
1161-
!self.tcx.sess.features_untracked().const_let {
1161+
!self.tcx.features().const_let {
11621162

11631163
// Direct use of an argument is permitted.
11641164
match *rvalue {

0 commit comments

Comments
 (0)