]> git.lizzy.rs Git - rust.git/commitdiff
add call to tcx.sess.delay_span_bug
authorjsirs <44773712+jsirs@users.noreply.github.com>
Mon, 5 Nov 2018 15:30:01 +0000 (17:30 +0200)
committerGitHub <noreply@github.com>
Mon, 5 Nov 2018 15:30:01 +0000 (17:30 +0200)
add call to tcx.sess.delay_span_bug before returning none to make sure error is presented to user

src/librustc_typeck/check/method/mod.rs

index 3fd61dbb97d94463e01aaf4701c536c8681b05fe..637f3eaae9a6ac91e0f3e5874cd420354699f697 100644 (file)
@@ -289,8 +289,14 @@ pub fn lookup_method_in_trait(&self,
         // 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);