diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2022-07-26 13:57:19 +0000 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2022-07-26 14:14:21 +0000 |
| commit | 71e162e6caf3aa64f727f3bc2aa8744f771eb12b (patch) | |
| tree | f52d38165b3d4774c94123434567bdaaf98a6505 /compiler/rustc_middle/src | |
| parent | d60ebe366bcc6b51e5ae1337288837a0be60ed36 (diff) | |
| download | rust-71e162e6caf3aa64f727f3bc2aa8744f771eb12b.tar.gz rust-71e162e6caf3aa64f727f3bc2aa8744f771eb12b.zip | |
Fix diagnostics for unfulfilled obligations
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/ty/mod.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 281a1265546..31c523aaca9 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -829,6 +829,14 @@ impl<'tcx> TraitPredicate<'tcx> { pub fn is_const_if_const(self) -> bool { self.constness == BoundConstness::ConstIfConst } + + pub fn is_constness_satisfied_by(self, constness: hir::Constness) -> bool { + match (self.constness, constness) { + (BoundConstness::NotConst, _) + | (BoundConstness::ConstIfConst, hir::Constness::Const) => true, + (BoundConstness::ConstIfConst, hir::Constness::NotConst) => false, + } + } } impl<'tcx> PolyTraitPredicate<'tcx> { |
