Use the constness from the param env instead of having a separate dimension for it
This breaks a ~const test that will be fixed in a follow up commit of this PR
This commit is contained in:
parent
19f2101272
commit
d51068ca28
12 changed files with 25 additions and 142 deletions
|
@ -69,6 +69,16 @@ impl PredicateObligation<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl TraitObligation<'tcx> {
|
||||
/// Returns `true` if the trait predicate is considered `const` in its ParamEnv.
|
||||
pub fn is_const(&self) -> bool {
|
||||
match (self.predicate.skip_binder().constness, self.param_env.constness()) {
|
||||
(ty::BoundConstness::ConstIfConst, hir::Constness::Const) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// `PredicateObligation` is used a lot. Make sure it doesn't unintentionally get bigger.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
static_assert_size!(PredicateObligation<'_>, 32);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue