Skip to content

Commit 1ec4caf

Browse files
committed
---
yaml --- r: 218791 b: refs/heads/snap-stage3 c: 57c75b6 h: refs/heads/master i: 218789: 71fa876 218787: f464f5b 218783: c0caa23 v: v3
1 parent 9978f70 commit 1ec4caf

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,6 +1,6 @@
11
---
22
refs/heads/master: c044791d80ea0dc5c4b57b6030a67b69f8510239
3-
refs/heads/snap-stage3: 710270d9c0b9b9e65e606e1c6109329c93499837
3+
refs/heads/snap-stage3: 57c75b6b10c329ed1c9c1957e98a990dd04608f2
44
refs/heads/try: b53c0f93eedcdedd4fd89bccc5a3a09d1c5cd23e
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/snap-stage3/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)