Skip to content

Commit 6bf2c4d

Browse files
committed
implement const iterator using rustc_do_not_const_check
1 parent a64ef7d commit 6bf2c4d

File tree

4 files changed

+101
-1
lines changed

4 files changed

+101
-1
lines changed

compiler/rustc_hir_typeck/src/lib.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ use rustc_middle::ty::{self, Ty, TyCtxt};
6767
use rustc_session::config;
6868
use rustc_session::Session;
6969
use rustc_span::def_id::{DefId, LocalDefId};
70-
use rustc_span::Span;
70+
use rustc_span::{sym, Span};
7171

7272
#[macro_export]
7373
macro_rules! type_error_struct {
@@ -201,6 +201,11 @@ fn typeck_with_fallback<'tcx>(
201201

202202
let typeck_results = Inherited::build(tcx, def_id).enter(|inh| {
203203
let param_env = tcx.param_env(def_id);
204+
let param_env = if tcx.has_attr(def_id.to_def_id(), sym::rustc_do_not_const_check) {
205+
param_env.without_const()
206+
} else {
207+
param_env
208+
};
204209
let mut fcx = FnCtxt::new(&inh, param_env, def_id);
205210

206211
if let Some(hir::FnSig { header, decl, .. }) = fn_sig {

0 commit comments

Comments
 (0)