1
Fork 0

Lazily resolve type-alias-impl-trait defining uses

by using an opaque type obligation to bubble up comparisons between opaque types and other types

Also uses proper obligation causes so that the body id works, because out of some reason nll uses body ids for logic instead of just diagnostics.
This commit is contained in:
Oli Scherer 2021-08-20 14:47:12 +00:00 committed by Oli Scherer
parent 8d2b598459
commit 0f6e06b7c0
284 changed files with 2646 additions and 2097 deletions

View file

@ -44,6 +44,15 @@ where
self.0.iter().find(|(key, _)| k == key.borrow()).map(|elem| &elem.1)
}
/// Gets a mutable reference to the value in the entry.
pub fn get_mut<Q: ?Sized>(&mut self, k: &Q) -> Option<&mut V>
where
K: Borrow<Q>,
Q: Eq,
{
self.0.iter_mut().find(|(key, _)| k == key.borrow()).map(|elem| &mut elem.1)
}
/// Returns the any value corresponding to the supplied predicate filter.
///
/// The supplied predicate will be applied to each (key, value) pair and it will return a
@ -63,7 +72,7 @@ where
// This should return just one element, otherwise it's a bug
assert!(
filter.next().is_none(),
"Collection {:?} should have just one matching element",
"Collection {:#?} should have just one matching element",
self
);
Some(value)