Add VecMap::get_value_matching and assert if > 1 element
Otherwise is a bug that we want to uncover.
This commit is contained in:
parent
b2b7c859c1
commit
d71410757d
2 changed files with 25 additions and 6 deletions
|
@ -364,7 +364,7 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
|
|||
let concrete_ty = tcx
|
||||
.mir_borrowck(owner.expect_local())
|
||||
.concrete_opaque_types
|
||||
.get_by(|(key, _)| key.def_id == def_id.to_def_id())
|
||||
.get_value_matching(|(key, _)| key.def_id == def_id.to_def_id())
|
||||
.map(|concrete_ty| *concrete_ty)
|
||||
.unwrap_or_else(|| {
|
||||
tcx.sess.delay_span_bug(
|
||||
|
@ -531,7 +531,7 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> {
|
|||
.tcx
|
||||
.typeck(def_id)
|
||||
.concrete_opaque_types
|
||||
.get_by(|(key, _)| key.def_id == self.def_id)
|
||||
.any_value_matching(|(key, _)| key.def_id == self.def_id)
|
||||
.is_none()
|
||||
{
|
||||
debug!("no constraints in typeck results");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue