librustc: Remove ~"string"
and &"string"
from the language
This commit is contained in:
parent
a3f9f37014
commit
4baff4e15f
11 changed files with 58 additions and 72 deletions
|
@ -220,7 +220,9 @@ impl<'a> Parser<'a> {
|
||||||
try!(self.parse_group_opts())
|
try!(self.parse_group_opts())
|
||||||
} else {
|
} else {
|
||||||
self.caps += 1;
|
self.caps += 1;
|
||||||
self.stack.push(Paren(self.flags, self.caps, ~""))
|
self.stack.push(Paren(self.flags,
|
||||||
|
self.caps,
|
||||||
|
"".to_owned()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
')' => {
|
')' => {
|
||||||
|
@ -769,7 +771,7 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
if self.cur() == ':' {
|
if self.cur() == ':' {
|
||||||
// Save the old flags with the opening paren.
|
// Save the old flags with the opening paren.
|
||||||
self.stack.push(Paren(self.flags, 0, ~""));
|
self.stack.push(Paren(self.flags, 0, "".to_owned()));
|
||||||
}
|
}
|
||||||
self.flags = flags;
|
self.flags = flags;
|
||||||
return Ok(())
|
return Ok(())
|
||||||
|
|
|
@ -1070,16 +1070,16 @@ pub fn build_session_(sopts: session::Options,
|
||||||
|
|
||||||
pub fn parse_pretty(sess: &Session, name: &str) -> PpMode {
|
pub fn parse_pretty(sess: &Session, name: &str) -> PpMode {
|
||||||
match name {
|
match name {
|
||||||
&"normal" => PpmNormal,
|
"normal" => PpmNormal,
|
||||||
&"expanded" => PpmExpanded,
|
"expanded" => PpmExpanded,
|
||||||
&"typed" => PpmTyped,
|
"typed" => PpmTyped,
|
||||||
&"expanded,identified" => PpmExpandedIdentified,
|
"expanded,identified" => PpmExpandedIdentified,
|
||||||
&"identified" => PpmIdentified,
|
"identified" => PpmIdentified,
|
||||||
_ => {
|
_ => {
|
||||||
sess.fatal("argument to `pretty` must be one of `normal`, \
|
sess.fatal("argument to `pretty` must be one of `normal`, \
|
||||||
`expanded`, `typed`, `identified`, \
|
`expanded`, `typed`, `identified`, \
|
||||||
or `expanded,identified`");
|
or `expanded,identified`");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -300,7 +300,7 @@ pub fn run_compiler(args: &[~str]) {
|
||||||
None::<d::PpMode> => {/* continue */ }
|
None::<d::PpMode> => {/* continue */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.contains(&~"ls") {
|
if r.contains(&("ls".to_owned())) {
|
||||||
match input {
|
match input {
|
||||||
d::FileInput(ref ifile) => {
|
d::FileInput(ref ifile) => {
|
||||||
let mut stdout = io::stdout();
|
let mut stdout = io::stdout();
|
||||||
|
|
|
@ -1036,7 +1036,7 @@ fn check_crate_attrs_usage(cx: &Context, attrs: &[ast::Attribute]) {
|
||||||
if !iter.any(|other_attr| { name.equiv(other_attr) }) {
|
if !iter.any(|other_attr| { name.equiv(other_attr) }) {
|
||||||
cx.span_lint(AttributeUsage, attr.span, "unknown crate attribute");
|
cx.span_lint(AttributeUsage, attr.span, "unknown crate attribute");
|
||||||
}
|
}
|
||||||
if name.equiv(& &"link") {
|
if name.equiv(&("link")) {
|
||||||
cx.tcx.sess.span_err(attr.span,
|
cx.tcx.sess.span_err(attr.span,
|
||||||
"obsolete crate `link` attribute");
|
"obsolete crate `link` attribute");
|
||||||
cx.tcx.sess.note("the link attribute has been superceded by the crate_id \
|
cx.tcx.sess.note("the link attribute has been superceded by the crate_id \
|
||||||
|
|
|
@ -189,9 +189,9 @@ impl<'a, 'b> Reflector<'a, 'b> {
|
||||||
ty::ty_rptr(_, ref mt) => {
|
ty::ty_rptr(_, ref mt) => {
|
||||||
match ty::get(mt.ty).sty {
|
match ty::get(mt.ty).sty {
|
||||||
ty::ty_vec(ref mt, None) => {
|
ty::ty_vec(ref mt, None) => {
|
||||||
let (name, extra) = (~"slice", Vec::new());
|
let (name, extra) = ("slice".to_owned(), Vec::new());
|
||||||
let extra = extra.append(self.c_mt(mt).as_slice());
|
let extra = extra.append(self.c_mt(mt).as_slice());
|
||||||
self.visit(~"evec_" + name, extra.as_slice())
|
self.visit("evec_".to_owned() + name, extra.as_slice())
|
||||||
}
|
}
|
||||||
ty::ty_str => self.visit("estr_slice".to_owned(), &[]),
|
ty::ty_str => self.visit("estr_slice".to_owned(), &[]),
|
||||||
_ => {
|
_ => {
|
||||||
|
|
|
@ -647,8 +647,8 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) {
|
||||||
ty::ty_vec(mt, None) => {
|
ty::ty_vec(mt, None) => {
|
||||||
fcx.type_error_message(pat.span,
|
fcx.type_error_message(pat.span,
|
||||||
|_| {
|
|_| {
|
||||||
~"unique vector patterns are no \
|
"unique vector patterns are no \
|
||||||
longer supported"
|
longer supported".to_owned()
|
||||||
},
|
},
|
||||||
expected,
|
expected,
|
||||||
None);
|
None);
|
||||||
|
|
|
@ -2566,10 +2566,6 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
|
||||||
match expr.node {
|
match expr.node {
|
||||||
ast::ExprVstore(ev, vst) => {
|
ast::ExprVstore(ev, vst) => {
|
||||||
let typ = match ev.node {
|
let typ = match ev.node {
|
||||||
ast::ExprLit(lit) if ast_util::lit_is_str(lit) => {
|
|
||||||
ast_expr_vstore_to_ty(fcx, ev, vst, || ty::mt{ ty: ty::mk_str(tcx),
|
|
||||||
mutbl: ast::MutImmutable })
|
|
||||||
}
|
|
||||||
ast::ExprVec(ref args) => {
|
ast::ExprVec(ref args) => {
|
||||||
let mutability = match vst {
|
let mutability = match vst {
|
||||||
ast::ExprVstoreMutSlice => ast::MutMutable,
|
ast::ExprVstoreMutSlice => ast::MutMutable,
|
||||||
|
@ -2622,8 +2618,13 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
|
||||||
mutbl: mutability})
|
mutbl: mutability})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ =>
|
ast::ExprLit(_) => {
|
||||||
tcx.sess.span_bug(expr.span, "vstore modifier on non-sequence")
|
tcx.sess.span_err(expr.span,
|
||||||
|
"`~\"string\"` has been removed; use `\"string\".to_owned()` \
|
||||||
|
instead");
|
||||||
|
ty::mk_err()
|
||||||
|
}
|
||||||
|
_ => tcx.sess.span_bug(expr.span, "vstore modifier on non-sequence"),
|
||||||
};
|
};
|
||||||
fcx.write_ty(ev.id, typ);
|
fcx.write_ty(ev.id, typ);
|
||||||
fcx.write_ty(id, typ);
|
fcx.write_ty(id, typ);
|
||||||
|
|
|
@ -1740,7 +1740,7 @@ impl<T: Iterator<char>> Builder<T> {
|
||||||
Some(NumberValue(n)) => { Ok(Number(n)) }
|
Some(NumberValue(n)) => { Ok(Number(n)) }
|
||||||
Some(BooleanValue(b)) => { Ok(Boolean(b)) }
|
Some(BooleanValue(b)) => { Ok(Boolean(b)) }
|
||||||
Some(StringValue(ref mut s)) => {
|
Some(StringValue(ref mut s)) => {
|
||||||
let mut temp = ~"";
|
let mut temp = "".to_owned();
|
||||||
swap(s, &mut temp);
|
swap(s, &mut temp);
|
||||||
Ok(String(temp))
|
Ok(String(temp))
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,22 +270,22 @@ pub fn syntax_expander_table() -> SyntaxEnv {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut syntax_expanders = SyntaxEnv::new();
|
let mut syntax_expanders = SyntaxEnv::new();
|
||||||
syntax_expanders.insert(intern(&"macro_rules"),
|
syntax_expanders.insert(intern("macro_rules"),
|
||||||
IdentTT(~BasicIdentMacroExpander {
|
IdentTT(~BasicIdentMacroExpander {
|
||||||
expander: ext::tt::macro_rules::add_new_extension,
|
expander: ext::tt::macro_rules::add_new_extension,
|
||||||
span: None,
|
span: None,
|
||||||
},
|
},
|
||||||
None));
|
None));
|
||||||
syntax_expanders.insert(intern(&"fmt"),
|
syntax_expanders.insert(intern("fmt"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::fmt::expand_syntax_ext));
|
ext::fmt::expand_syntax_ext));
|
||||||
syntax_expanders.insert(intern(&"format_args"),
|
syntax_expanders.insert(intern("format_args"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::format::expand_args));
|
ext::format::expand_args));
|
||||||
syntax_expanders.insert(intern(&"env"),
|
syntax_expanders.insert(intern("env"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::env::expand_env));
|
ext::env::expand_env));
|
||||||
syntax_expanders.insert(intern(&"option_env"),
|
syntax_expanders.insert(intern("option_env"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::env::expand_option_env));
|
ext::env::expand_option_env));
|
||||||
syntax_expanders.insert(intern("bytes"),
|
syntax_expanders.insert(intern("bytes"),
|
||||||
|
@ -297,63 +297,63 @@ pub fn syntax_expander_table() -> SyntaxEnv {
|
||||||
syntax_expanders.insert(intern("concat"),
|
syntax_expanders.insert(intern("concat"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::concat::expand_syntax_ext));
|
ext::concat::expand_syntax_ext));
|
||||||
syntax_expanders.insert(intern(&"log_syntax"),
|
syntax_expanders.insert(intern("log_syntax"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::log_syntax::expand_syntax_ext));
|
ext::log_syntax::expand_syntax_ext));
|
||||||
syntax_expanders.insert(intern(&"deriving"),
|
syntax_expanders.insert(intern("deriving"),
|
||||||
ItemDecorator(ext::deriving::expand_meta_deriving));
|
ItemDecorator(ext::deriving::expand_meta_deriving));
|
||||||
|
|
||||||
// Quasi-quoting expanders
|
// Quasi-quoting expanders
|
||||||
syntax_expanders.insert(intern(&"quote_tokens"),
|
syntax_expanders.insert(intern("quote_tokens"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::quote::expand_quote_tokens));
|
ext::quote::expand_quote_tokens));
|
||||||
syntax_expanders.insert(intern(&"quote_expr"),
|
syntax_expanders.insert(intern("quote_expr"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::quote::expand_quote_expr));
|
ext::quote::expand_quote_expr));
|
||||||
syntax_expanders.insert(intern(&"quote_ty"),
|
syntax_expanders.insert(intern("quote_ty"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::quote::expand_quote_ty));
|
ext::quote::expand_quote_ty));
|
||||||
syntax_expanders.insert(intern(&"quote_item"),
|
syntax_expanders.insert(intern("quote_item"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::quote::expand_quote_item));
|
ext::quote::expand_quote_item));
|
||||||
syntax_expanders.insert(intern(&"quote_pat"),
|
syntax_expanders.insert(intern("quote_pat"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::quote::expand_quote_pat));
|
ext::quote::expand_quote_pat));
|
||||||
syntax_expanders.insert(intern(&"quote_stmt"),
|
syntax_expanders.insert(intern("quote_stmt"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::quote::expand_quote_stmt));
|
ext::quote::expand_quote_stmt));
|
||||||
|
|
||||||
syntax_expanders.insert(intern(&"line"),
|
syntax_expanders.insert(intern("line"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::source_util::expand_line));
|
ext::source_util::expand_line));
|
||||||
syntax_expanders.insert(intern(&"col"),
|
syntax_expanders.insert(intern("col"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::source_util::expand_col));
|
ext::source_util::expand_col));
|
||||||
syntax_expanders.insert(intern(&"file"),
|
syntax_expanders.insert(intern("file"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::source_util::expand_file));
|
ext::source_util::expand_file));
|
||||||
syntax_expanders.insert(intern(&"stringify"),
|
syntax_expanders.insert(intern("stringify"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::source_util::expand_stringify));
|
ext::source_util::expand_stringify));
|
||||||
syntax_expanders.insert(intern(&"include"),
|
syntax_expanders.insert(intern("include"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::source_util::expand_include));
|
ext::source_util::expand_include));
|
||||||
syntax_expanders.insert(intern(&"include_str"),
|
syntax_expanders.insert(intern("include_str"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::source_util::expand_include_str));
|
ext::source_util::expand_include_str));
|
||||||
syntax_expanders.insert(intern(&"include_bin"),
|
syntax_expanders.insert(intern("include_bin"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::source_util::expand_include_bin));
|
ext::source_util::expand_include_bin));
|
||||||
syntax_expanders.insert(intern(&"module_path"),
|
syntax_expanders.insert(intern("module_path"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::source_util::expand_mod));
|
ext::source_util::expand_mod));
|
||||||
syntax_expanders.insert(intern(&"asm"),
|
syntax_expanders.insert(intern("asm"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::asm::expand_asm));
|
ext::asm::expand_asm));
|
||||||
syntax_expanders.insert(intern(&"cfg"),
|
syntax_expanders.insert(intern("cfg"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::cfg::expand_cfg));
|
ext::cfg::expand_cfg));
|
||||||
syntax_expanders.insert(intern(&"trace_macros"),
|
syntax_expanders.insert(intern("trace_macros"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::trace_macros::expand_trace_macros));
|
ext::trace_macros::expand_trace_macros));
|
||||||
syntax_expanders
|
syntax_expanders
|
||||||
|
|
|
@ -2779,28 +2779,11 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
token::BINOP(token::AND) | token::ANDAND => {
|
token::BINOP(token::AND) | token::ANDAND => {
|
||||||
// parse &pat
|
// parse &pat
|
||||||
let lo = self.span.lo;
|
let lo = self.span.lo;
|
||||||
self.expect_and();
|
self.expect_and();
|
||||||
let sub = self.parse_pat();
|
let sub = self.parse_pat();
|
||||||
hi = sub.span.hi;
|
pat = PatRegion(sub);
|
||||||
// HACK: parse &"..." as a literal of a borrowed str
|
|
||||||
pat = match sub.node {
|
|
||||||
PatLit(e) => {
|
|
||||||
match e.node {
|
|
||||||
ExprLit(lit) if lit_is_str(lit) => {
|
|
||||||
let vst = @Expr {
|
|
||||||
id: ast::DUMMY_NODE_ID,
|
|
||||||
node: ExprVstore(e, ExprVstoreSlice),
|
|
||||||
span: mk_sp(lo, hi)
|
|
||||||
};
|
|
||||||
PatLit(vst)
|
|
||||||
}
|
|
||||||
_ => PatRegion(sub),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => PatRegion(sub),
|
|
||||||
};
|
|
||||||
hi = self.last_span.hi;
|
hi = self.last_span.hi;
|
||||||
return @ast::Pat {
|
return @ast::Pat {
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
|
|
|
@ -534,7 +534,7 @@ impl<T: Writer> ConsoleTestState<T> {
|
||||||
|
|
||||||
pub fn write_run_start(&mut self, len: uint) -> io::IoResult<()> {
|
pub fn write_run_start(&mut self, len: uint) -> io::IoResult<()> {
|
||||||
self.total = len;
|
self.total = len;
|
||||||
let noun = if len != 1 { &"tests" } else { &"test" };
|
let noun = if len != 1 { "tests" } else { "test" };
|
||||||
self.write_plain(format!("\nrunning {} {}\n", len, noun))
|
self.write_plain(format!("\nrunning {} {}\n", len, noun))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue