about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-01-15 16:42:51 -0800
committerHuon Wilson <dbau.pp+github@gmail.com>2014-02-02 01:44:48 +1100
commit8d6ef2e1b198461fde48565c7efdf92a83a33abd (patch)
treede7e49dcfc507f2da3c9ec0da802e78c48e958aa /src/libsyntax
parente68108b3e8b8eaef62bb7b7340a77b96fcfc51cd (diff)
downloadrust-8d6ef2e1b198461fde48565c7efdf92a83a33abd.tar.gz
rust-8d6ef2e1b198461fde48565c7efdf92a83a33abd.zip
libsyntax: De-`@str` pathnames
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/codemap.rs6
-rw-r--r--src/libsyntax/ext/quote.rs31
-rw-r--r--src/libsyntax/ext/source_util.rs2
-rw-r--r--src/libsyntax/parse/comments.rs2
-rw-r--r--src/libsyntax/parse/mod.rs28
-rw-r--r--src/libsyntax/print/pprust.rs2
6 files changed, 32 insertions, 39 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index 16b31f0a415..3002bc3d40e 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -183,7 +183,7 @@ pub struct ExpnInfo {
     callee: NameAndSpan
 }
 
-pub type FileName = @str;
+pub type FileName = ~str;
 
 pub struct FileLines
 {
@@ -301,7 +301,7 @@ impl CodeMap {
     pub fn lookup_char_pos_adj(&self, pos: BytePos) -> LocWithOpt {
         let loc = self.lookup_char_pos(pos);
         LocWithOpt {
-            filename: loc.file.name,
+            filename: loc.file.name.to_str(),
             line: loc.line,
             col: loc.col,
             file: Some(loc.file)
@@ -324,7 +324,7 @@ impl CodeMap {
 
     pub fn span_to_filename(&self, sp: Span) -> FileName {
         let lo = self.lookup_char_pos(sp.lo);
-        lo.file.name
+        lo.file.name.to_str()
     }
 
     pub fn span_to_lines(&self, sp: Span) -> @FileLines {
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index 11f61c340fc..bd1ac616f52 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -250,7 +250,7 @@ pub mod rt {
 
         fn parse_item(&self, s: ~str) -> @ast::Item {
             let res = parse::parse_item_from_source_str(
-                @"<quote expansion>",
+                "<quote expansion>".to_str(),
                 s,
                 self.cfg(),
                 self.parse_sess());
@@ -264,28 +264,25 @@ pub mod rt {
         }
 
         fn parse_stmt(&self, s: ~str) -> @ast::Stmt {
-            parse::parse_stmt_from_source_str(
-                @"<quote expansion>",
-                s,
-                self.cfg(),
-                ~[],
-                self.parse_sess())
+            parse::parse_stmt_from_source_str("<quote expansion>".to_str(),
+                                              s,
+                                              self.cfg(),
+                                              ~[],
+                                              self.parse_sess())
         }
 
         fn parse_expr(&self, s: ~str) -> @ast::Expr {
-            parse::parse_expr_from_source_str(
-                @"<quote expansion>",
-                s,
-                self.cfg(),
-                self.parse_sess())
+            parse::parse_expr_from_source_str("<quote expansion>".to_str(),
+                                              s,
+                                              self.cfg(),
+                                              self.parse_sess())
         }
 
         fn parse_tts(&self, s: ~str) -> ~[ast::TokenTree] {
-            parse::parse_tts_from_source_str(
-                @"<quote expansion>",
-                s,
-                self.cfg(),
-                self.parse_sess())
+            parse::parse_tts_from_source_str("<quote expansion>".to_str(),
+                                             s,
+                                             self.cfg(),
+                                             self.parse_sess())
         }
     }
 
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs
index 1367ab0677e..a248cd84f71 100644
--- a/src/libsyntax/ext/source_util.rs
+++ b/src/libsyntax/ext/source_util.rs
@@ -114,7 +114,7 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
         Some(src) => {
             // Add this input file to the code map to make it available as
             // dependency information
-            let filename = file.display().to_str().to_managed();
+            let filename = file.display().to_str();
             let interned = token::intern_and_get_ident(src);
             cx.parse_sess.cm.new_filemap(filename, src);
 
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs
index bbd0e00f4dd..7165e7b404f 100644
--- a/src/libsyntax/parse/comments.rs
+++ b/src/libsyntax/parse/comments.rs
@@ -347,7 +347,7 @@ pub struct Literal {
 // probably not a good thing.
 pub fn gather_comments_and_literals(span_diagnostic:
                                         @diagnostic::SpanHandler,
-                                    path: @str,
+                                    path: ~str,
                                     srdr: &mut io::Reader)
                                  -> (~[Comment], ~[Literal]) {
     let src = str::from_utf8_owned(srdr.read_to_end()).unwrap();
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index e7bc5ff3df3..76ccc53b846 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -89,7 +89,7 @@ pub fn parse_crate_attrs_from_file(
     return inner;
 }
 
-pub fn parse_crate_from_source_str(name: @str,
+pub fn parse_crate_from_source_str(name: ~str,
                                    source: ~str,
                                    cfg: ast::CrateConfig,
                                    sess: @ParseSess)
@@ -101,7 +101,7 @@ pub fn parse_crate_from_source_str(name: @str,
     maybe_aborted(p.parse_crate_mod(),p)
 }
 
-pub fn parse_crate_attrs_from_source_str(name: @str,
+pub fn parse_crate_attrs_from_source_str(name: ~str,
                                          source: ~str,
                                          cfg: ast::CrateConfig,
                                          sess: @ParseSess)
@@ -114,7 +114,7 @@ pub fn parse_crate_attrs_from_source_str(name: @str,
     return inner;
 }
 
-pub fn parse_expr_from_source_str(name: @str,
+pub fn parse_expr_from_source_str(name: ~str,
                                   source: ~str,
                                   cfg: ast::CrateConfig,
                                   sess: @ParseSess)
@@ -123,7 +123,7 @@ pub fn parse_expr_from_source_str(name: @str,
     maybe_aborted(p.parse_expr(), p)
 }
 
-pub fn parse_item_from_source_str(name: @str,
+pub fn parse_item_from_source_str(name: ~str,
                                   source: ~str,
                                   cfg: ast::CrateConfig,
                                   sess: @ParseSess)
@@ -133,7 +133,7 @@ pub fn parse_item_from_source_str(name: @str,
     maybe_aborted(p.parse_item(attrs),p)
 }
 
-pub fn parse_meta_from_source_str(name: @str,
+pub fn parse_meta_from_source_str(name: ~str,
                                   source: ~str,
                                   cfg: ast::CrateConfig,
                                   sess: @ParseSess)
@@ -142,7 +142,7 @@ pub fn parse_meta_from_source_str(name: @str,
     maybe_aborted(p.parse_meta_item(),p)
 }
 
-pub fn parse_stmt_from_source_str(name: @str,
+pub fn parse_stmt_from_source_str(name: ~str,
                                   source: ~str,
                                   cfg: ast::CrateConfig,
                                   attrs: ~[ast::Attribute],
@@ -157,7 +157,7 @@ pub fn parse_stmt_from_source_str(name: @str,
     maybe_aborted(p.parse_stmt(attrs),p)
 }
 
-pub fn parse_tts_from_source_str(name: @str,
+pub fn parse_tts_from_source_str(name: ~str,
                                  source: ~str,
                                  cfg: ast::CrateConfig,
                                  sess: @ParseSess)
@@ -176,7 +176,7 @@ pub fn parse_tts_from_source_str(name: @str,
 // Create a new parser from a source string
 pub fn new_parser_from_source_str(sess: @ParseSess,
                                   cfg: ast::CrateConfig,
-                                  name: @str,
+                                  name: ~str,
                                   source: ~str)
                                   -> Parser {
     filemap_to_parser(sess,string_to_filemap(sess,source,name),cfg)
@@ -241,21 +241,17 @@ pub fn file_to_filemap(sess: @ParseSess, path: &Path, spanopt: Option<Span>)
     };
     match str::from_utf8_owned(bytes) {
         Some(s) => {
-            return string_to_filemap(sess,
-                                     s,
-                                     path.as_str().unwrap().to_managed());
-        }
-        None => {
-            err(format!("{} is not UTF-8 encoded", path.display()))
+            return string_to_filemap(sess, s, path.as_str().unwrap().to_str())
         }
+        None => err(format!("{} is not UTF-8 encoded", path.display())),
     }
     unreachable!()
 }
 
 // given a session and a string, add the string to
 // the session's codemap and return the new filemap
-pub fn string_to_filemap(sess: @ParseSess, source: ~str, path: @str)
-    -> @FileMap {
+pub fn string_to_filemap(sess: @ParseSess, source: ~str, path: ~str)
+                         -> @FileMap {
     sess.cm.new_filemap(path, source)
 }
 
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 32b0766249e..8bf439818a2 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -117,7 +117,7 @@ pub fn print_crate(cm: @CodeMap,
                    intr: @IdentInterner,
                    span_diagnostic: @diagnostic::SpanHandler,
                    crate: &ast::Crate,
-                   filename: @str,
+                   filename: ~str,
                    input: &mut io::Reader,
                    out: ~io::Writer,
                    ann: @PpAnn,