librustc: Remove @str from the language

This commit is contained in:
Patrick Walton
2014-01-31 18:25:08 -08:00
committed by Huon Wilson
parent 449a7a817f
commit c594e675eb
13 changed files with 36 additions and 19 deletions

View File

@@ -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 {

View File

@@ -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);

View File

@@ -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)
};
}

View File

@@ -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())

View File

@@ -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")