Skip to content

Commit b9f1365

Browse files
committed
---
yaml --- r: 209195 b: refs/heads/master c: 57c75b6 h: refs/heads/master i: 209193: 6d4dcdf 209191: 1de2532 v: v3
1 parent 0a7b55a commit b9f1365

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 710270d9c0b9b9e65e606e1c6109329c93499837
2+
refs/heads/master: 57c75b6b10c329ed1c9c1957e98a990dd04608f2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
55
refs/heads/try: 7b4ef47b7805a402d756fb8157101f64880a522f

trunk/src/librustc/middle/check_const.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,16 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
205205
ret_ty: Ty<'tcx>)
206206
-> bool {
207207
if let Some(fn_like) = const_eval::lookup_const_fn_by_id(self.tcx, def_id) {
208-
if self.mode != Mode::Var && !self.tcx.sess.features.borrow().const_fn {
208+
if
209+
// we are in a static/const initializer
210+
self.mode != Mode::Var &&
211+
212+
// feature-gate is not enabled
213+
!self.tcx.sess.features.borrow().const_fn &&
214+
215+
// this doesn't come from a macro that has #[allow_internal_unstable]
216+
!self.tcx.sess.codemap().span_allows_unstable(expr.span)
217+
{
209218
self.tcx.sess.span_err(
210219
expr.span,
211220
&format!("const fns are an unstable feature"));

0 commit comments

Comments
 (0)