about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-01-31 18:25:08 -0800
committerHuon Wilson <dbau.pp+github@gmail.com>2014-02-02 01:44:50 +1100
commitc594e675eb3db25cd018d58d8fe06ef6ea2c90de (patch)
tree4520d9b24ded21fcff4dfe3712de2665d3ed779f /src
parent449a7a817ff58288084b49665d5186674255c949 (diff)
downloadrust-c594e675eb3db25cd018d58d8fe06ef6ea2c90de.tar.gz
rust-c594e675eb3db25cd018d58d8fe06ef6ea2c90de.zip
librustc: Remove `@str` from the language
Diffstat (limited to 'src')
-rw-r--r--src/librustc/middle/lint.rs2
-rw-r--r--src/librustc/middle/mem_categorization.rs3
-rw-r--r--src/librustc/middle/trans/debuginfo.rs3
-rw-r--r--src/librustc/middle/trans/type_of.rs2
-rw-r--r--src/librustc/middle/typeck/astconv.rs11
-rw-r--r--src/librustdoc/clean.rs7
-rw-r--r--src/libstd/str.rs1
-rw-r--r--src/libsyntax/ext/expand.rs4
-rw-r--r--src/libsyntax/parse/obsolete.rs5
-rw-r--r--src/libsyntax/parse/parser.rs5
-rw-r--r--src/libsyntax/parse/token.rs9
-rw-r--r--src/libsyntax/util/interner.rs2
-rw-r--r--src/test/compile-fail/lint-heap-memory.rs1
13 files changed, 36 insertions, 19 deletions
diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs
index af83bc97adc..33f97b3ba2a 100644
--- a/src/librustc/middle/lint.rs
+++ b/src/librustc/middle/lint.rs
@@ -887,7 +887,7 @@ fn check_heap_type(cx: &Context, span: Span, ty: ty::t) {
         let mut n_uniq = 0;
         ty::fold_ty(cx.tcx, ty, |t| {
             match ty::get(t).sty {
-                ty::ty_box(_) | ty::ty_str(ty::vstore_box) |
+                ty::ty_box(_) |
                 ty::ty_vec(_, ty::vstore_box) |
                 ty::ty_trait(_, _, ty::BoxTraitStore, _, _) => {
                     n_box += 1;
diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs
index d98cf9795b2..9bab74dc56a 100644
--- a/src/librustc/middle/mem_categorization.rs
+++ b/src/librustc/middle/mem_categorization.rs
@@ -179,8 +179,7 @@ pub fn opt_deref_kind(t: ty::t) -> Option<deref_kind> {
 
         ty::ty_box(_) |
         ty::ty_vec(_, ty::vstore_box) |
-        ty::ty_trait(_, _, ty::BoxTraitStore, _, _) |
-        ty::ty_str(ty::vstore_box) => {
+        ty::ty_trait(_, _, ty::BoxTraitStore, _, _) => {
             Some(deref_ptr(gc_ptr))
         }
 
diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs
index 2611076f15d..b89ec9d19df 100644
--- a/src/librustc/middle/trans/debuginfo.rs
+++ b/src/librustc/middle/trans/debuginfo.rs
@@ -2094,8 +2094,7 @@ fn type_metadata(cx: &CrateContext,
                     pointer_type_metadata(cx, t, vec_metadata)
                 }
                 ty::vstore_box => {
-                    let boxed_vec_metadata = boxed_vec_metadata(cx, i8_t, usage_site_span);
-                    pointer_type_metadata(cx, t, boxed_vec_metadata)
+                    fail!("unexpected managed string")
                 }
                 ty::vstore_slice(_region) => {
                     vec_slice_metadata(cx, t, i8_t, usage_site_span)
diff --git a/src/librustc/middle/trans/type_of.rs b/src/librustc/middle/trans/type_of.rs
index 86456187d1a..b440db66a12 100644
--- a/src/librustc/middle/trans/type_of.rs
+++ b/src/librustc/middle/trans/type_of.rs
@@ -222,7 +222,7 @@ pub fn type_of(cx: &CrateContext, t: ty::t) -> Type {
         adt::incomplete_type_of(cx, repr, name)
       }
       ty::ty_str(ty::vstore_box) => {
-          Type::at_box(cx, Type::vec(cx.sess.targ_cfg.arch, &Type::i8())).ptr_to()
+          fail!("unexpected managed string")
       }
       ty::ty_vec(ref mt, ty::vstore_box) => {
           let e_ty = type_of(cx, mt.ty);
diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs
index 9f44aa1a023..9f8b9140417 100644
--- a/src/librustc/middle/typeck/astconv.rs
+++ b/src/librustc/middle/typeck/astconv.rs
@@ -413,8 +413,17 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:RegionScope>(
                 // will run after this as long as the path isn't a trait.
                 let def_map = tcx.def_map.borrow();
                 match def_map.get().find(&id) {
-                    Some(&ast::DefPrimTy(ast::TyStr)) if a_seq_ty.mutbl == ast::MutImmutable => {
+                    Some(&ast::DefPrimTy(ast::TyStr)) if
+                            a_seq_ty.mutbl == ast::MutImmutable => {
                         check_path_args(tcx, path, NO_TPS | NO_REGIONS);
+                        match vst {
+                            ty::vstore_box => {
+                                tcx.sess.span_err(path.span,
+                                                  "managed strings are not \
+                                                   supported")
+                            }
+                            _ => {}
+                        }
                         return ty::mk_str(tcx, vst);
                     }
                     Some(&ast::DefTrait(trait_def_id)) => {
diff --git a/src/librustdoc/clean.rs b/src/librustdoc/clean.rs
index 53bae09f58c..4f7e6df95e1 100644
--- a/src/librustdoc/clean.rs
+++ b/src/librustdoc/clean.rs
@@ -874,11 +874,14 @@ impl Clean<PathSegment> for ast::PathSegment {
 }
 
 fn path_to_str(p: &ast::Path) -> ~str {
-    use syntax::parse::token::interner_get;
+    use syntax::parse::token;
 
     let mut s = ~"";
     let mut first = true;
-    for i in p.segments.iter().map(|x| interner_get(x.identifier.name)) {
+    for i in p.segments.iter().map(|x| {
+            let string = token::get_ident(x.identifier.name);
+            string.get().to_str()
+    }) {
         if !first || p.global {
             s.push_str("::");
         } else {
diff --git a/src/libstd/str.rs b/src/libstd/str.rs
index 5d5beb3609e..0315e560bb7 100644
--- a/src/libstd/str.rs
+++ b/src/libstd/str.rs
@@ -3477,7 +3477,6 @@ mod tests {
                 let e = $e;
                 assert_eq!(s1 + s2, e.to_owned());
                 assert_eq!(s1.to_owned() + s2, e.to_owned());
-                assert_eq!(s1.to_managed() + s2, e.to_owned());
             } }
         );
 
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index f7419e77ff5..d8d98b27793 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -1224,7 +1224,7 @@ mod test {
     fn run_renaming_test(t: &RenamingTest, test_idx: uint) {
         let invalid_name = token::special_idents::invalid.name;
         let (teststr, bound_connections, bound_ident_check) = match *t {
-            (ref str,ref conns, bic) => (str.to_managed(), conns.clone(), bic)
+            (ref str,ref conns, bic) => (str.to_owned(), conns.clone(), bic)
         };
         let cr = expand_crate_str(teststr.to_owned());
         // find the bindings:
@@ -1304,7 +1304,7 @@ foo_module!()
 
         let cxbinds : ~[&ast::Ident] =
             bindings.iter().filter(|b| {
-                let string = token::get_ident(b);
+                let string = token::get_ident(b.name);
                 "xx" == string.get()
             }).collect();
         let cxbind = match cxbinds {
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index 04c73ce71d0..46f1f33143e 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -44,6 +44,7 @@ pub enum ObsoleteSyntax {
     ObsoleteMultipleImport,
     ObsoleteExternModAttributesInParens,
     ObsoleteManagedPattern,
+    ObsoleteManagedString,
 }
 
 impl to_bytes::IterBytes for ObsoleteSyntax {
@@ -149,6 +150,10 @@ impl ParserObsoleteMethods for Parser {
                 "use a nested `match` expression instead of a managed box \
                  pattern"
             ),
+            ObsoleteManagedString => (
+                "managed string",
+                "use `Rc<~str>` instead of a managed string"
+            ),
         };
 
         self.report(sp, kind, kind_str, desc);
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index dc16f32b872..fb679fa0460 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2295,7 +2295,10 @@ impl Parser {
             ex = match e.node {
               ExprVec(..) |
               ExprRepeat(..) => ExprVstore(e, ExprVstoreBox),
-              ExprLit(lit) if lit_is_str(lit) => ExprVstore(e, ExprVstoreBox),
+              ExprLit(lit) if lit_is_str(lit) => {
+                  self.obsolete(self.last_span, ObsoleteManagedString);
+                  ExprVstore(e, ExprVstoreBox)
+              }
               _ => self.mk_unary(UnBox, e)
             };
           }
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index eb2fa151f51..fa53f021cdb 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -544,8 +544,8 @@ pub fn get_ident_interner() -> @IdentInterner {
 /// interner lives for the life of the task, this can be safely treated as an
 /// immortal string, as long as it never crosses between tasks.
 ///
-/// XXX(pcwalton): You must be careful about what you do in the destructors of
-/// objects stored in TLS, because they may run after the interner is
+/// FIXME(pcwalton): You must be careful about what you do in the destructors
+/// of objects stored in TLS, because they may run after the interner is
 /// destroyed. In particular, they must not access string contents. This can
 /// be fixed in the future by just leaking all strings until task death
 /// somehow.
@@ -585,8 +585,9 @@ impl InternedString {
 
 impl BytesContainer for InternedString {
     fn container_as_bytes<'a>(&'a self) -> &'a [u8] {
-        // XXX(pcwalton): This is a workaround for the incorrect signature of
-        // `BytesContainer`, which is itself a workaround for the lack of DST.
+        // FIXME(pcwalton): This is a workaround for the incorrect signature
+        // of `BytesContainer`, which is itself a workaround for the lack of
+        // DST.
         unsafe {
             let this = self.get();
             cast::transmute(this.container_as_bytes())
diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs
index e20efda9c6e..fc3e55dcde2 100644
--- a/src/libsyntax/util/interner.rs
+++ b/src/libsyntax/util/interner.rs
@@ -253,7 +253,7 @@ mod tests {
 
     #[test]
     fn i3 () {
-        let i : Interner<@~str> = Interner::prefill([
+        let i : Interner<RcStr> = Interner::prefill([
             RcStr::new("Alan"),
             RcStr::new("Bob"),
             RcStr::new("Carol")
diff --git a/src/test/compile-fail/lint-heap-memory.rs b/src/test/compile-fail/lint-heap-memory.rs
index 0c19988bef4..5e8c83558fb 100644
--- a/src/test/compile-fail/lint-heap-memory.rs
+++ b/src/test/compile-fail/lint-heap-memory.rs
@@ -25,7 +25,6 @@ fn main() {
     @[1]; //~ ERROR type uses managed
     //~^ ERROR type uses managed
     fn f(_: @Clone) {} //~ ERROR type uses managed
-    //~^ ERROR type uses managed
 
     ~2; //~ ERROR type uses owned
     ~[1]; //~ ERROR type uses owned