Skip to content

Commit

Permalink
add call to tcx.sess.delay_span_bug
Browse files Browse the repository at this point in the history
add call to tcx.sess.delay_span_bug before returning none to make sure error is presented to user
  • Loading branch information
jsirs committed Nov 5, 2018
1 parent 87c22f2 commit 3063977
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/librustc_typeck/check/method/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
// Trait must have a method named `m_name` and it should not have
// type parameters or early-bound regions.
let tcx = self.tcx;
let method_item =
self.associated_item(trait_def_id, m_name, Namespace::Value)?;
let method_item = match self.associated_item(trait_def_id, m_name, Namespace::Value) {
Some(method_item) => method_item,
None => {
tcx.sess.delay_span_bug(span,
"operator trait does not have corresponding operator method");
return None;
}
};
let def_id = method_item.def_id;
let generics = tcx.generics_of(def_id);
assert_eq!(generics.params.len(), 0);
Expand Down

0 comments on commit 3063977

Please sign in to comment.