]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_typeck/coherence/unsafety.rs
rollup merge of #21438: taralx/kill-racycell
[rust.git] / src / librustc_typeck / coherence / unsafety.rs
index e30d0a29938aa91090365b87c7cc8fd1c5bbd2c1..867dea9588568b515c68d7f699b258505e9da37c 100644 (file)
@@ -37,8 +37,7 @@ fn visit_item(&mut self, item: &'v ast::Item) {
                         match unsafety {
                             ast::Unsafety::Normal => { /* OK */ }
                             ast::Unsafety::Unsafe => {
-                                self.tcx.sess.span_err(
-                                    item.span,
+                                span_err!(self.tcx.sess, item.span, E0197,
                                     "inherent impls cannot be declared as unsafe");
                             }
                         }
@@ -49,24 +48,21 @@ fn visit_item(&mut self, item: &'v ast::Item) {
                         match (trait_def.unsafety, unsafety, polarity) {
                             (ast::Unsafety::Unsafe,
                              ast::Unsafety::Unsafe, ast::ImplPolarity::Negative) => {
-                                self.tcx.sess.span_err(
-                                    item.span,
-                                    format!("negative implementations are not unsafe").as_slice());
+                                span_err!(self.tcx.sess, item.span, E0198,
+                                    "negative implementations are not unsafe");
                             }
 
                             (ast::Unsafety::Normal, ast::Unsafety::Unsafe, _) => {
-                                self.tcx.sess.span_err(
-                                    item.span,
-                                    format!("implementing the trait `{}` is not unsafe",
-                                            trait_ref.user_string(self.tcx)).as_slice());
+                                span_err!(self.tcx.sess, item.span, E0199,
+                                    "implementing the trait `{}` is not unsafe",
+                                            trait_ref.user_string(self.tcx));
                             }
 
                             (ast::Unsafety::Unsafe,
                              ast::Unsafety::Normal, ast::ImplPolarity::Positive) => {
-                                self.tcx.sess.span_err(
-                                    item.span,
-                                    format!("the trait `{}` requires an `unsafe impl` declaration",
-                                            trait_ref.user_string(self.tcx)).as_slice());
+                                span_err!(self.tcx.sess, item.span, E0200,
+                                    "the trait `{}` requires an `unsafe impl` declaration",
+                                            trait_ref.user_string(self.tcx));
                             }
 
                             (ast::Unsafety::Unsafe,