]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/middle/privacy.rs
use slicing sugar
[rust.git] / src / librustc / middle / privacy.rs
index 861c4a2c85e356b52f6750833e6fe10cc4fc4024..aa37c2fe348b586c178e121114ac47d79b41d027 100644 (file)
@@ -615,10 +615,10 @@ fn report_error(&self, result: CheckResult) -> bool {
         match result {
             None => true,
             Some((span, msg, note)) => {
-                self.tcx.sess.span_err(span, msg.index(&FullRange));
+                self.tcx.sess.span_err(span, &msg[]);
                 match note {
                     Some((span, msg)) => {
-                        self.tcx.sess.span_note(span, msg.index(&FullRange))
+                        self.tcx.sess.span_note(span, &msg[])
                     }
                     None => {},
                 }
@@ -720,7 +720,7 @@ fn check_field(&mut self,
             UnnamedField(idx) => format!("field #{} of {} is private",
                                          idx + 1, struct_desc),
         };
-        self.tcx.sess.span_err(span, msg.index(&FullRange));
+        self.tcx.sess.span_err(span, &msg[]);
     }
 
     // Given the ID of a method, checks to ensure it's in scope.
@@ -741,8 +741,8 @@ fn check_static_method(&mut self,
         self.report_error(self.ensure_public(span,
                                              method_id,
                                              None,
-                                             format!("method `{}`",
-                                                     string).index(&FullRange)));
+                                             &format!("method `{}`",
+                                                     string)[]));
     }
 
     // Checks that a path is in scope.
@@ -756,7 +756,7 @@ fn check_path(&mut self, span: Span, path_id: ast::NodeId, path: &ast::Path) {
                 self.ensure_public(span,
                                    def,
                                    Some(origdid),
-                                   format!("{} `{}`", tyname, name).index(&FullRange))
+                                   &format!("{} `{}`", tyname, name)[])
             };
 
             match self.last_private_map[path_id] {