Skip to content

Commit 0632e77

Browse files
committed
---
yaml --- r: 211446 b: refs/heads/tmp c: 57c75b6 h: refs/heads/master v: v3
1 parent 596d446 commit 0632e77

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
@@ -32,7 +32,7 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3232
refs/heads/beta: 2d00dc3b85aaf81caa3a4e5764c5e185a4dd0a7c
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
35-
refs/heads/tmp: 710270d9c0b9b9e65e606e1c6109329c93499837
35+
refs/heads/tmp: 57c75b6b10c329ed1c9c1957e98a990dd04608f2
3636
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3737
refs/tags/homu-tmp: 704c2ee730d2e948d11a2edd77e3f35de8329a6e
3838
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412

branches/tmp/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)