Skip to content

Commit

Permalink
Note discrepancies in constness calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Oct 20, 2022
1 parent ab36a2f commit 43f2c37
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compiler/rustc_ty_utils/src/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(..), .. })
Expand Down Expand Up @@ -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,
};

Expand Down

0 comments on commit 43f2c37

Please sign in to comment.