Skip to content

Commit 43f2c37

Browse files
Note discrepancies in constness calculation
1 parent ab36a2f commit 43f2c37

File tree

1 file changed

+5
-0
lines changed
  • compiler/rustc_ty_utils/src

1 file changed

+5
-0
lines changed

compiler/rustc_ty_utils/src/ty.rs

+5
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
137137
let local_did = def_id.as_local();
138138
let hir_id = local_did.map(|def_id| tcx.hir().local_def_id_to_hir_id(def_id));
139139

140+
// FIXME(consts): This is not exactly in line with the constness query.
140141
let constness = match hir_id {
141142
Some(hir_id) => match tcx.hir().get(hir_id) {
142143
hir::Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Fn(..), .. })
@@ -201,6 +202,10 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
201202

202203
_ => hir::Constness::NotConst,
203204
},
205+
// FIXME(consts): It's suspicious that a param-env for a foreign item
206+
// will always have NotConst param-env, though we don't typically use
207+
// that param-env for anything meaningful right now, so it's likely
208+
// not an issue.
204209
None => hir::Constness::NotConst,
205210
};
206211

0 commit comments

Comments
 (0)