Skip to content

Commit 4a08333

Browse files
authored
self.associated_item can return none
self.associated_item can return none, replace unwrap with '?' and bubble up None value instead of panicking
1 parent 2a1dc1e commit 4a08333

File tree

1 file changed

+1
-1
lines changed
  • src/librustc_typeck/check/method

1 file changed

+1
-1
lines changed

src/librustc_typeck/check/method/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
290290
// type parameters or early-bound regions.
291291
let tcx = self.tcx;
292292
let method_item =
293-
self.associated_item(trait_def_id, m_name, Namespace::Value).unwrap();
293+
self.associated_item(trait_def_id, m_name, Namespace::Value)?;
294294
let def_id = method_item.def_id;
295295
let generics = tcx.generics_of(def_id);
296296
assert_eq!(generics.params.len(), 0);

0 commit comments

Comments
 (0)