Skip to content

Commit 3063977

Browse files
authored
add call to tcx.sess.delay_span_bug
add call to tcx.sess.delay_span_bug before returning none to make sure error is presented to user
1 parent 87c22f2 commit 3063977

File tree

1 file changed

+8
-2
lines changed
  • src/librustc_typeck/check/method

1 file changed

+8
-2
lines changed

src/librustc_typeck/check/method/mod.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
289289
// Trait must have a method named `m_name` and it should not have
290290
// type parameters or early-bound regions.
291291
let tcx = self.tcx;
292-
let method_item =
293-
self.associated_item(trait_def_id, m_name, Namespace::Value)?;
292+
let method_item = match self.associated_item(trait_def_id, m_name, Namespace::Value) {
293+
Some(method_item) => method_item,
294+
None => {
295+
tcx.sess.delay_span_bug(span,
296+
"operator trait does not have corresponding operator method");
297+
return None;
298+
}
299+
};
294300
let def_id = method_item.def_id;
295301
let generics = tcx.generics_of(def_id);
296302
assert_eq!(generics.params.len(), 0);

0 commit comments

Comments
 (0)