Skip to content

Commit 4085445

Browse files
committed
---
yaml --- r: 225371 b: refs/heads/stable c: 57c75b6 h: refs/heads/master i: 225369: e5336ed 225367: 1dafaae v: v3
1 parent f84770c commit 4085445

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
@@ -29,6 +29,6 @@ refs/heads/tmp: e5d90d98402475b6e154ce216f9efcb80da1a747
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: 1fe32ca12c51afcd761d9962f51a74ff0d07a591
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 710270d9c0b9b9e65e606e1c6109329c93499837
32+
refs/heads/stable: 57c75b6b10c329ed1c9c1957e98a990dd04608f2
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b

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