implement const iterator using rustc_do_not_const_check
This commit is contained in:
parent
a64ef7d07d
commit
6bf2c4d739
4 changed files with 101 additions and 1 deletions
|
|
@ -67,7 +67,7 @@ use rustc_middle::ty::{self, Ty, TyCtxt};
|
|||
use rustc_session::config;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::def_id::{DefId, LocalDefId};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::{sym, Span};
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! type_error_struct {
|
||||
|
|
@ -201,6 +201,11 @@ fn typeck_with_fallback<'tcx>(
|
|||
|
||||
let typeck_results = Inherited::build(tcx, def_id).enter(|inh| {
|
||||
let param_env = tcx.param_env(def_id);
|
||||
let param_env = if tcx.has_attr(def_id.to_def_id(), sym::rustc_do_not_const_check) {
|
||||
param_env.without_const()
|
||||
} else {
|
||||
param_env
|
||||
};
|
||||
let mut fcx = FnCtxt::new(&inh, param_env, def_id);
|
||||
|
||||
if let Some(hir::FnSig { header, decl, .. }) = fn_sig {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue