Note discrepancies in constness calculation

This commit is contained in:
Michael Goulet 2022-10-19 19:05:15 +00:00
parent ab36a2fe16
commit 43f2c37f93

View File

@ -137,6 +137,7 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
let local_did = def_id.as_local();
let hir_id = local_did.map(|def_id| tcx.hir().local_def_id_to_hir_id(def_id));
// FIXME(consts): This is not exactly in line with the constness query.
let constness = match hir_id {
Some(hir_id) => match tcx.hir().get(hir_id) {
hir::Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Fn(..), .. })
@ -201,6 +202,10 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
_ => hir::Constness::NotConst,
},
// FIXME(consts): It's suspicious that a param-env for a foreign item
// will always have NotConst param-env, though we don't typically use
// that param-env for anything meaningful right now, so it's likely
// not an issue.
None => hir::Constness::NotConst,
};