self.associated_item can return none
self.associated_item can return none, replace unwrap with '?' and bubble up None value instead of panicking
This commit is contained in:
parent
2a1dc1eff6
commit
4a08333c4d
@ -290,7 +290,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
||||
// type parameters or early-bound regions.
|
||||
let tcx = self.tcx;
|
||||
let method_item =
|
||||
self.associated_item(trait_def_id, m_name, Namespace::Value).unwrap();
|
||||
self.associated_item(trait_def_id, m_name, Namespace::Value)?;
|
||||
let def_id = method_item.def_id;
|
||||
let generics = tcx.generics_of(def_id);
|
||||
assert_eq!(generics.params.len(), 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user