Skip to content

Commit 458f5a2

Browse files
committed
Properly prevent the promotion of unstable const fns
1 parent af2be23 commit 458f5a2

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

Diff for: src/librustc_mir/transform/qualify_consts.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
127127
mir: &'a Mir<'tcx>,
128128
mode: Mode)
129129
-> Qualifier<'a, 'tcx, 'tcx> {
130+
assert!(def_id.is_local());
130131
let mut rpo = traversal::reverse_postorder(mir);
131132
let temps = promote_consts::collect_temps(mir, &mut rpo);
132133
rpo.reset();
@@ -915,9 +916,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> {
915916
.iter()
916917
.any(|&(ref sym, _)| sym == feature_name) &&
917918

918-
// this doesn't come from a crate with the feature-gate enabled,
919-
self.def_id.is_local() &&
920-
921919
// this doesn't come from a macro that has #[allow_internal_unstable]
922920
!self.span.allows_unstable()
923921
{

Diff for: src/librustc_passes/rvalue_promotion.rs

-3
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,6 @@ impl<'a, 'gcx> CheckCrateVisitor<'a, 'gcx> {
189189
.iter()
190190
.any(|&(ref sym, _)| sym == feature_name) ||
191191

192-
// this comes from a crate with the feature-gate enabled,
193-
!def_id.is_local() ||
194-
195192
// this comes from a macro that has #[allow_internal_unstable]
196193
span.allows_unstable();
197194
if !stable_check {

0 commit comments

Comments
 (0)