From ee26c7c433dbb8d41a2b65dbc89eb84acfc2d311 Mon Sep 17 00:00:00 2001 From: Brendan Zabarauskas Date: Wed, 1 May 2013 15:40:05 +1000 Subject: Revert rename of Div to Quot --- src/libsyntax/parse/parser.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libsyntax/parse/parser.rs') diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 50bdfb2f557..42c6fad6463 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -19,7 +19,7 @@ use ast::{_mod, add, arg, arm, attribute, bind_by_ref, bind_infer}; use ast::{bind_by_copy, bitand, bitor, bitxor, blk}; use ast::{blk_check_mode, box}; use ast::{crate, crate_cfg, decl, decl_item}; -use ast::{decl_local, default_blk, deref, quot, enum_def}; +use ast::{decl_local, default_blk, deref, div, enum_def}; use ast::{expr, expr_, expr_addr_of, expr_match, expr_again}; use ast::{expr_assign, expr_assign_op, expr_binary, expr_block}; use ast::{expr_break, expr_call, expr_cast, expr_copy, expr_do_body}; @@ -1836,7 +1836,7 @@ pub impl Parser { token::PLUS => aop = add, token::MINUS => aop = subtract, token::STAR => aop = mul, - token::SLASH => aop = quot, + token::SLASH => aop = div, token::PERCENT => aop = rem, token::CARET => aop = bitxor, token::AND => aop = bitand, -- cgit 1.4.1-3-g733a5 From 7d6d0029ba0392bc0e8f2e7211f58a77cf85a231 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Tue, 30 Apr 2013 21:00:30 -0700 Subject: syntax: remove parsing destructors --- src/libsyntax/parse/parser.rs | 92 +++++++------------------------------------ 1 file changed, 14 insertions(+), 78 deletions(-) (limited to 'src/libsyntax/parse/parser.rs') diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 50bdfb2f557..1a4a15b3bf5 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -102,11 +102,6 @@ enum restriction { RESTRICT_NO_BAR_OR_DOUBLEBAR_OP, } -// So that we can distinguish a class dtor from other class members - -enum class_contents { dtor_decl(blk, ~[attribute], codemap::span), - members(~[@struct_field]) } - type arg_or_capture_item = Either; type item_info = (ident, item_, Option<~[attribute]>); @@ -3299,7 +3294,6 @@ pub impl Parser { } let mut fields: ~[@struct_field]; - let mut the_dtor: Option<(blk, ~[attribute], codemap::span)> = None; let is_tuple_like; if self.eat(&token::LBRACE) { @@ -3307,26 +3301,8 @@ pub impl Parser { is_tuple_like = false; fields = ~[]; while *self.token != token::RBRACE { - match self.parse_struct_decl_field() { - dtor_decl(ref blk, ref attrs, s) => { - match the_dtor { - Some((_, _, s_first)) => { - self.span_note(s, fmt!("Duplicate destructor \ - declaration for class %s", - *self.interner.get(class_name))); - self.span_fatal(copy s_first, ~"First destructor \ - declared here"); - } - None => { - the_dtor = Some((copy *blk, copy *attrs, s)); - } - } - } - members(mms) => { - for mms.each |struct_field| { - fields.push(*struct_field) - } - } + for self.parse_struct_decl_field().each |struct_field| { + fields.push(*struct_field) } } if fields.len() == 0 { @@ -3365,19 +3341,12 @@ pub impl Parser { ); } - let actual_dtor = do the_dtor.map |dtor| { - let (d_body, d_attrs, d_s) = copy *dtor; - codemap::spanned { node: ast::struct_dtor_ { id: self.get_id(), - attrs: d_attrs, - self_id: self.get_id(), - body: d_body}, - span: d_s}}; let _ = self.get_id(); // XXX: Workaround for crazy bug. let new_id = self.get_id(); (class_name, item_struct(@ast::struct_def { fields: fields, - dtor: actual_dtor, + dtor: None, ctor_id: if is_tuple_like { Some(new_id) } else { None } }, generics), None) @@ -3420,34 +3389,28 @@ pub impl Parser { } // parse an element of a struct definition - fn parse_struct_decl_field(&self) -> class_contents { + fn parse_struct_decl_field(&self) -> ~[@struct_field] { if self.try_parse_obsolete_priv_section() { - return members(~[]); + return ~[]; } - let attrs = self.parse_outer_attributes(); + // Need this to parse comments on fields. + let _attrs = self.parse_outer_attributes(); if self.eat_keyword(&~"priv") { - return members(~[self.parse_single_struct_field(private)]) + return ~[self.parse_single_struct_field(private)] } if self.eat_keyword(&~"pub") { - return members(~[self.parse_single_struct_field(public)]); + return ~[self.parse_single_struct_field(public)]; } if self.try_parse_obsolete_struct_ctor() { - return members(~[]); + return ~[]; } - if self.eat_keyword(&~"drop") { - let lo = self.last_span.lo; - let body = self.parse_block(); - return dtor_decl(body, attrs, mk_sp(lo, self.last_span.hi)) - } - else { - return members(~[self.parse_single_struct_field(inherited)]); - } + return ~[self.parse_single_struct_field(inherited)]; } // parse visiility: PUB, PRIV, or nothing @@ -3830,44 +3793,17 @@ pub impl Parser { // parse a structure-like enum variant definition // this should probably be renamed or refactored... fn parse_struct_def(&self) -> @struct_def { - let mut the_dtor: Option<(blk, ~[attribute], codemap::span)> = None; let mut fields: ~[@struct_field] = ~[]; while *self.token != token::RBRACE { - match self.parse_struct_decl_field() { - dtor_decl(ref blk, ref attrs, s) => { - match the_dtor { - Some((_, _, s_first)) => { - self.span_note(s, ~"duplicate destructor \ - declaration"); - self.span_fatal(copy s_first, - ~"first destructor \ - declared here"); - } - None => { - the_dtor = Some((copy *blk, copy *attrs, s)); - } - } - } - members(mms) => { - for mms.each |struct_field| { - fields.push(*struct_field); - } - } + for self.parse_struct_decl_field().each |struct_field| { + fields.push(*struct_field); } } self.bump(); - let actual_dtor = do the_dtor.map |dtor| { - let (d_body, d_attrs, d_s) = copy *dtor; - codemap::spanned { node: ast::struct_dtor_ { id: self.get_id(), - attrs: d_attrs, - self_id: self.get_id(), - body: d_body }, - span: d_s } - }; return @ast::struct_def { fields: fields, - dtor: actual_dtor, + dtor: None, ctor_id: None }; } -- cgit 1.4.1-3-g733a5 From c2e1f47955571fab24fc731c0af97e4c71f4ada9 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Tue, 30 Apr 2013 21:00:45 -0700 Subject: rustc: remove the rest of drop Removes: ast::struct_def::dtor syntax::ast::ii_dtor syntax::visit::fk_dtor syntax::ast_map::node_dtor syntax:struct_dtor --- src/librustc/metadata/common.rs | 1 - src/librustc/metadata/csearch.rs | 7 -- src/librustc/metadata/decoder.rs | 16 ---- src/librustc/metadata/encoder.rs | 27 ------ src/librustc/middle/astencode.rs | 26 ------ src/librustc/middle/borrowck/check_loans.rs | 6 +- src/librustc/middle/borrowck/gather_loans.rs | 3 +- src/librustc/middle/kind.rs | 11 --- src/librustc/middle/lint.rs | 29 ------- src/librustc/middle/liveness.rs | 5 +- src/librustc/middle/region.rs | 3 +- src/librustc/middle/resolve.rs | 21 +---- src/librustc/middle/trans/base.rs | 124 +-------------------------- src/librustc/middle/trans/debuginfo.rs | 3 - src/librustc/middle/trans/inline.rs | 4 - src/librustc/middle/trans/monomorphize.rs | 15 +--- src/librustc/middle/trans/reachable.rs | 13 +-- src/librustc/middle/trans/type_use.rs | 3 - src/librustc/middle/ty.rs | 27 +----- src/librustc/middle/typeck/check/mod.rs | 29 +------ src/librustc/middle/typeck/collect.rs | 25 ------ src/librustdoc/tystr_pass.rs | 8 +- src/libsyntax/ast.rs | 18 +--- src/libsyntax/ast_map.rs | 29 +------ src/libsyntax/ast_util.rs | 26 ------ src/libsyntax/ext/pipes/pipec.rs | 1 - src/libsyntax/fold.rs | 26 ------ src/libsyntax/parse/parser.rs | 2 - src/libsyntax/print/pprust.rs | 7 -- src/libsyntax/visit.rs | 44 +--------- 30 files changed, 21 insertions(+), 538 deletions(-) (limited to 'src/libsyntax/parse/parser.rs') diff --git a/src/librustc/metadata/common.rs b/src/librustc/metadata/common.rs index 8e689f3147b..111c201d502 100644 --- a/src/librustc/metadata/common.rs +++ b/src/librustc/metadata/common.rs @@ -100,7 +100,6 @@ pub static tag_mod_impl_trait: uint = 0x47u; different tags. */ pub static tag_item_impl_method: uint = 0x48u; -pub static tag_item_dtor: uint = 0x49u; pub static tag_item_trait_method_self_ty: uint = 0x4b; pub static tag_item_trait_method_self_ty_region: uint = 0x4c; diff --git a/src/librustc/metadata/csearch.rs b/src/librustc/metadata/csearch.rs index 5626714260b..f8dc34f9cee 100644 --- a/src/librustc/metadata/csearch.rs +++ b/src/librustc/metadata/csearch.rs @@ -230,13 +230,6 @@ pub fn get_impl_method(cstore: @mut cstore::CStore, decoder::get_impl_method(cstore.intr, cdata, def.node, mname) } -/* If def names a class with a dtor, return it. Otherwise, return none. */ -pub fn struct_dtor(cstore: @mut cstore::CStore, def: ast::def_id) - -> Option { - let cdata = cstore::get_crate_data(cstore, def.crate); - decoder::struct_dtor(cdata, def.node) -} - pub fn get_item_visibility(cstore: @mut cstore::CStore, def_id: ast::def_id) -> ast::visibility { diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index cfe31360d32..fb7b3f9c8b1 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -445,22 +445,6 @@ pub fn get_impl_method(intr: @ident_interner, cdata: cmd, id: ast::node_id, found.get() } -pub fn struct_dtor(cdata: cmd, id: ast::node_id) -> Option { - let items = reader::get_doc(reader::Doc(cdata.data), tag_items); - let mut found = None; - let cls_items = match maybe_find_item(id, items) { - Some(it) => it, - None => fail!(fmt!("struct_dtor: class id not found \ - when looking up dtor for %d", id)) - }; - for reader::tagged_docs(cls_items, tag_item_dtor) |doc| { - let doc1 = reader::get_doc(doc, tag_def_id); - let did = reader::with_doc_data(doc1, |d| parse_def_id(d)); - found = Some(translate_def_id(cdata, did)); - }; - found -} - pub fn get_symbol(data: @~[u8], id: ast::node_id) -> ~str { return item_symbol(lookup_item(id, data)); } diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index dd4ef0d2e68..ba6a4f30857 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -765,26 +765,6 @@ fn encode_info_for_item(ecx: @EncodeContext, ebml_w: &writer::Encoder, class itself */ let idx = encode_info_for_struct(ecx, ebml_w, path, struct_def.fields, index); - /* Encode the dtor */ - for struct_def.dtor.each |dtor| { - index.push(entry {val: dtor.node.id, pos: ebml_w.writer.tell()}); - encode_info_for_ctor(ecx, - ebml_w, - dtor.node.id, - ecx.tcx.sess.ident_of( - *ecx.tcx.sess.str_of(item.ident) + - ~"_dtor"), - path, - if generics.ty_params.len() > 0u { - Some(ii_dtor(copy *dtor, - item.ident, - copy *generics, - local_def(item.id))) } - else { - None - }, - generics); - } /* Index the class*/ add_to_index(); @@ -816,13 +796,6 @@ fn encode_info_for_item(ecx: @EncodeContext, ebml_w: &writer::Encoder, encode_name(ecx, ebml_w, item.ident); encode_path(ecx, ebml_w, path, ast_map::path_name(item.ident)); encode_region_param(ecx, ebml_w, item); - /* Encode the dtor */ - /* Encode id for dtor */ - for struct_def.dtor.each |dtor| { - do ebml_w.wr_tag(tag_item_dtor) { - encode_def_id(ebml_w, local_def(dtor.node.id)); - } - }; /* Encode def_ids for each field and method for methods, write all the stuff get_trait_method diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index c7c9c110586..2f753523a7b 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -327,15 +327,6 @@ fn simplify_ast(ii: &ast::inlined_item) -> ast::inlined_item { ast::ii_foreign(i) => { ast::ii_foreign(fld.fold_foreign_item(i)) } - ast::ii_dtor(ref dtor, nm, ref tps, parent_id) => { - let dtor_body = fld.fold_block(&dtor.node.body); - ast::ii_dtor( - codemap::spanned { - node: ast::struct_dtor_ { body: dtor_body, - .. /*bad*/copy (*dtor).node }, - .. (/*bad*/copy *dtor) }, - nm, /*bad*/copy *tps, parent_id) - } } } @@ -363,23 +354,6 @@ fn renumber_ast(xcx: @ExtendedDecodeContext, ii: ast::inlined_item) ast::ii_foreign(i) => { ast::ii_foreign(fld.fold_foreign_item(i)) } - ast::ii_dtor(ref dtor, nm, ref generics, parent_id) => { - let dtor_body = fld.fold_block(&dtor.node.body); - let dtor_attrs = fld.fold_attributes(/*bad*/copy (*dtor).node.attrs); - let new_generics = fold::fold_generics(generics, fld); - let dtor_id = fld.new_id((*dtor).node.id); - let new_parent = xcx.tr_def_id(parent_id); - let new_self = fld.new_id((*dtor).node.self_id); - ast::ii_dtor( - codemap::spanned { - node: ast::struct_dtor_ { id: dtor_id, - attrs: dtor_attrs, - self_id: new_self, - body: dtor_body }, - .. (/*bad*/copy *dtor) - }, - nm, new_generics, new_parent) - } } } diff --git a/src/librustc/middle/borrowck/check_loans.rs b/src/librustc/middle/borrowck/check_loans.rs index 07b6c80d420..526a5a3a9dd 100644 --- a/src/librustc/middle/borrowck/check_loans.rs +++ b/src/librustc/middle/borrowck/check_loans.rs @@ -629,8 +629,7 @@ fn check_loans_in_fn(fk: &visit::fn_kind, let declared_purity, src; match *fk { - visit::fk_item_fn(*) | visit::fk_method(*) | - visit::fk_dtor(*) => { + visit::fk_item_fn(*) | visit::fk_method(*) => { declared_purity = ty::ty_fn_purity(fty); src = id; } @@ -658,8 +657,7 @@ fn check_loans_in_fn(fk: &visit::fn_kind, // inherits the fn_args from enclosing ctxt } visit::fk_anon(*) | visit::fk_fn_block(*) | - visit::fk_method(*) | visit::fk_item_fn(*) | - visit::fk_dtor(*) => { + visit::fk_method(*) | visit::fk_item_fn(*) => { let mut fn_args = ~[]; for decl.inputs.each |input| { // For the purposes of purity, only consider function- diff --git a/src/librustc/middle/borrowck/gather_loans.rs b/src/librustc/middle/borrowck/gather_loans.rs index e40d0e63eb3..da048534118 100644 --- a/src/librustc/middle/borrowck/gather_loans.rs +++ b/src/librustc/middle/borrowck/gather_loans.rs @@ -104,8 +104,7 @@ fn req_loans_in_fn(fk: &visit::fn_kind, match *fk { visit::fk_anon(*) | visit::fk_fn_block(*) => {} - visit::fk_item_fn(*) | visit::fk_method(*) | - visit::fk_dtor(*) => { + visit::fk_item_fn(*) | visit::fk_method(*) => { self.item_ub = body.node.id; } } diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs index cf488b0ac89..0925e8cdd63 100644 --- a/src/librustc/middle/kind.rs +++ b/src/librustc/middle/kind.rs @@ -153,17 +153,6 @@ fn check_item(item: @item, cx: Context, visitor: visit::vt) { } } } - item_struct(struct_def, _) => { - match struct_def.dtor { - None => {} - Some(ref dtor) => { - let struct_did = def_id { crate: 0, node: item.id }; - check_struct_safe_for_destructor(cx, - dtor.span, - struct_did); - } - } - } _ => {} } } diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index faf4b1c3106..b67d74bc272 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -57,7 +57,6 @@ pub enum lint { type_limits, default_methods, deprecated_mutable_fields, - deprecated_drop, unused_unsafe, managed_heap_memory, @@ -210,13 +209,6 @@ pub fn get_lint_dict() -> LintDict { default: deny }), - (~"deprecated_drop", - LintSpec { - lint: deprecated_drop, - desc: "deprecated \"drop\" notation for the destructor", - default: deny - }), - (~"unused_unsafe", LintSpec { lint: unused_unsafe, @@ -463,7 +455,6 @@ fn check_item(i: @ast::item, cx: ty::ctxt) { check_item_type_limits(cx, i); check_item_default_methods(cx, i); check_item_deprecated_mutable_fields(cx, i); - check_item_deprecated_drop(cx, i); check_item_unused_unsafe(cx, i); check_item_unused_mut(cx, i); } @@ -668,26 +659,6 @@ fn check_item_deprecated_mutable_fields(cx: ty::ctxt, item: @ast::item) { } } -fn check_item_deprecated_drop(cx: ty::ctxt, item: @ast::item) { - match item.node { - ast::item_struct(struct_def, _) => { - match struct_def.dtor { - None => {} - Some(ref dtor) => { - cx.sess.span_lint(deprecated_drop, - item.id, - item.id, - dtor.span, - ~"`drop` notation for destructors is \ - deprecated; implement the `Drop` \ - trait instead"); - } - } - } - _ => {} - } -} - fn check_item_ctypes(cx: ty::ctxt, it: @ast::item) { fn check_foreign_fn(cx: ty::ctxt, fn_id: ast::node_id, diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 94d82d0acb8..0df10c59a8a 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -117,7 +117,7 @@ use syntax::ast::*; use syntax::codemap::span; use syntax::parse::token::special_idents; use syntax::print::pprust::{expr_to_str, block_to_str}; -use syntax::visit::{fk_anon, fk_dtor, fk_fn_block, fk_item_fn, fk_method}; +use syntax::visit::{fk_anon, fk_fn_block, fk_item_fn, fk_method}; use syntax::visit::{vt}; use syntax::{visit, ast_util}; @@ -440,9 +440,6 @@ fn visit_fn(fk: &visit::fn_kind, sty_static => {} } } - fk_dtor(_, _, self_id, _) => { - fn_maps.add_variable(Arg(self_id, special_idents::self_)); - } fk_item_fn(*) | fk_anon(*) | fk_fn_block(*) => {} } diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index f3299828171..88e201fb5f4 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -438,8 +438,7 @@ pub fn resolve_fn(fk: &visit::fn_kind, cx: ctxt, visitor: visit::vt) { let fn_cx = match *fk { - visit::fk_item_fn(*) | visit::fk_method(*) | - visit::fk_dtor(*) => { + visit::fk_item_fn(*) | visit::fk_method(*) => { // Top-level functions are a root scope. ctxt {parent: Some(id),.. cx} } diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 294a21fac2c..1d2ca59b8aa 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -47,7 +47,7 @@ use syntax::ast::{named_field, ne, neg, node_id, pat, pat_enum, pat_ident}; use syntax::ast::{Path, pat_lit, pat_range, pat_struct}; use syntax::ast::{prim_ty, private, provided}; use syntax::ast::{public, required, rem, self_ty_, shl, shr, stmt_decl}; -use syntax::ast::{struct_dtor, struct_field, struct_variant_kind}; +use syntax::ast::{struct_field, struct_variant_kind}; use syntax::ast::{sty_static, subtract, trait_ref, tuple_variant_kind, Ty}; use syntax::ast::{ty_bool, ty_char, ty_f, ty_f32, ty_f64, ty_float, ty_i}; use syntax::ast::{ty_i16, ty_i32, ty_i64, ty_i8, ty_int, TyParam, ty_path}; @@ -3512,7 +3512,6 @@ pub impl Resolver { self.resolve_struct(item.id, generics, struct_def.fields, - &struct_def.dtor, visitor); } @@ -3770,7 +3769,6 @@ pub impl Resolver { id: node_id, generics: &Generics, fields: &[@struct_field], - optional_destructor: &Option, visitor: ResolveVisitor) { // If applicable, create a rib for the type parameters. do self.with_type_parameter_rib(HasTypeParameters @@ -3784,23 +3782,6 @@ pub impl Resolver { for fields.each |field| { self.resolve_type(field.node.ty, visitor); } - - // Resolve the destructor, if applicable. - match *optional_destructor { - None => { - // Nothing to do. - } - Some(ref destructor) => { - self.resolve_function(NormalRibKind, - None, - NoTypeParameters, - &destructor.node.body, - HasSelfBinding - ((*destructor).node.self_id, - true), - visitor); - } - } } } diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index efa10dfc2aa..b3f7ab8b00a 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -2093,53 +2093,6 @@ pub fn trans_tuple_struct(ccx: @CrateContext, finish_fn(fcx, lltop); } -pub fn trans_struct_dtor(ccx: @CrateContext, - path: path, - body: &ast::blk, - dtor_id: ast::node_id, - psubsts: Option<@param_substs>, - hash_id: Option, - parent_id: ast::def_id) - -> ValueRef { - let tcx = ccx.tcx; - /* Look up the parent class's def_id */ - let mut class_ty = ty::lookup_item_type(tcx, parent_id).ty; - /* Substitute in the class type if necessary */ - for psubsts.each |ss| { - class_ty = ty::subst_tps(tcx, ss.tys, ss.self_ty, class_ty); - } - - /* The dtor takes a (null) output pointer, and a self argument, - and returns () */ - let lldty = type_of_dtor(ccx, class_ty); - - // XXX: Bad copies. - let s = get_dtor_symbol(ccx, copy path, dtor_id, psubsts); - - /* Register the dtor as a function. It has external linkage */ - let lldecl = decl_internal_cdecl_fn(ccx.llmod, s, lldty); - lib::llvm::SetLinkage(lldecl, lib::llvm::ExternalLinkage); - - /* If we're monomorphizing, register the monomorphized decl - for the dtor */ - for hash_id.each |h_id| { - ccx.monomorphized.insert(*h_id, lldecl); - } - /* Translate the dtor body */ - let decl = ast_util::dtor_dec(); - trans_fn(ccx, - path, - &decl, - body, - lldecl, - impl_self(class_ty), - psubsts, - dtor_id, - None, - []); - lldecl -} - pub fn trans_enum_def(ccx: @CrateContext, enum_definition: &ast::enum_def, id: ast::node_id, path: @ast_map::path, vi: @~[ty::VariantInfo], @@ -2158,8 +2111,7 @@ pub fn trans_enum_def(ccx: @CrateContext, enum_definition: &ast::enum_def, // Nothing to do. } ast::struct_variant_kind(struct_def) => { - trans_struct_def(ccx, struct_def, path, - variant.node.id); + trans_struct_def(ccx, struct_def); } } } @@ -2228,22 +2180,14 @@ pub fn trans_item(ccx: @CrateContext, item: &ast::item) { } ast::item_struct(struct_def, ref generics) => { if !generics.is_type_parameterized() { - trans_struct_def(ccx, struct_def, path, item.id); + trans_struct_def(ccx, struct_def); } } _ => {/* fall through */ } } } -pub fn trans_struct_def(ccx: @CrateContext, struct_def: @ast::struct_def, - path: @ast_map::path, - id: ast::node_id) { - // Translate the destructor. - for struct_def.dtor.each |dtor| { - trans_struct_dtor(ccx, /*bad*/copy *path, &dtor.node.body, - dtor.node.id, None, None, local_def(id)); - }; - +pub fn trans_struct_def(ccx: @CrateContext, struct_def: @ast::struct_def) { // If this is a tuple-like struct, translate the constructor. match struct_def.ctor_id { // We only need to translate a constructor if there are fields; @@ -2477,46 +2421,6 @@ pub fn item_path(ccx: @CrateContext, i: @ast::item) -> path { vec::append(/*bad*/copy *base, ~[path_name(i.ident)]) } -/* If there's already a symbol for the dtor with and substs , - return it; otherwise, create one and register it, returning it as well */ -pub fn get_dtor_symbol(ccx: @CrateContext, - path: path, - id: ast::node_id, - substs: Option<@param_substs>) - -> ~str { - let t = ty::node_id_to_type(ccx.tcx, id); - match ccx.item_symbols.find(&id) { - Some(s) => (/*bad*/copy *s), - None if substs.is_none() => { - let s = mangle_exported_name( - ccx, - vec::append(path, ~[path_name((ccx.names)(~"dtor"))]), - t); - // XXX: Bad copy, use `@str`? - ccx.item_symbols.insert(id, copy s); - s - } - None => { - // Monomorphizing, so just make a symbol, don't add - // this to item_symbols - match substs { - Some(ss) => { - let mono_ty = ty::subst_tps(ccx.tcx, ss.tys, ss.self_ty, t); - mangle_exported_name( - ccx, - vec::append(path, - ~[path_name((ccx.names)(~"dtor"))]), - mono_ty) - } - None => { - ccx.sess.bug(fmt!("get_dtor_symbol: not monomorphizing and \ - couldn't find a symbol for dtor %?", path)); - } - } - } - } -} - pub fn get_item_val(ccx: @CrateContext, id: ast::node_id) -> ValueRef { debug!("get_item_val(id=`%?`)", id); let tcx = ccx.tcx; @@ -2602,28 +2506,6 @@ pub fn get_item_val(ccx: @CrateContext, id: ast::node_id) -> ValueRef { } } } - ast_map::node_dtor(_, dt, parent_id, pt) => { - /* - Don't just call register_fn, since we don't want to add - the implicit self argument automatically (we want to make sure - it has the right type) - */ - // Want parent_id and not id, because id is the dtor's type - let class_ty = ty::lookup_item_type(tcx, parent_id).ty; - // This code shouldn't be reached if the class is generic - assert!(!ty::type_has_params(class_ty)); - let lldty = T_fn(~[ - T_ptr(T_i8()), - T_ptr(type_of(ccx, class_ty)) - ], - T_nil()); - let s = get_dtor_symbol(ccx, /*bad*/copy *pt, dt.node.id, None); - - /* Make the declaration for the dtor */ - let llfn = decl_internal_cdecl_fn(ccx.llmod, s, lldty); - lib::llvm::SetLinkage(llfn, lib::llvm::ExternalLinkage); - llfn - } ast_map::node_variant(ref v, enm, pth) => { let llfn; diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index 2a2bf7ba4ad..58fc5ea3be6 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -983,9 +983,6 @@ pub fn create_function(fcx: fn_ctxt) -> @Metadata { expected an expr_fn_block here") } } - ast_map::node_dtor(_, _, did, _) => { - ((dbg_cx.names)(~"dtor"), ast_util::dtor_ty(), did.node) - } _ => fcx.ccx.sess.bug(~"create_function: unexpected \ sort of node") }; diff --git a/src/librustc/middle/trans/inline.rs b/src/librustc/middle/trans/inline.rs index 7a7f03c2273..ad06a9715b4 100644 --- a/src/librustc/middle/trans/inline.rs +++ b/src/librustc/middle/trans/inline.rs @@ -118,10 +118,6 @@ pub fn maybe_instantiate_inline(ccx: @CrateContext, fn_id: ast::def_id, } local_def(mth.id) } - csearch::found(ast::ii_dtor(ref dtor, _, _, _)) => { - ccx.external.insert(fn_id, Some((*dtor).node.id)); - local_def((*dtor).node.id) - } } } } diff --git a/src/librustc/middle/trans/monomorphize.rs b/src/librustc/middle/trans/monomorphize.rs index 72ad6dde4f1..aa49915d175 100644 --- a/src/librustc/middle/trans/monomorphize.rs +++ b/src/librustc/middle/trans/monomorphize.rs @@ -13,7 +13,7 @@ use driver::session; use lib::llvm::ValueRef; use middle::trans::base::{get_insn_ctxt}; use middle::trans::base::{set_inline_hint_if_appr, set_inline_hint}; -use middle::trans::base::{trans_enum_variant, trans_struct_dtor}; +use middle::trans::base::{trans_enum_variant}; use middle::trans::base::{trans_fn, decl_internal_cdecl_fn}; use middle::trans::base::{get_item_val, no_self}; use middle::trans::base; @@ -35,7 +35,6 @@ use syntax::ast_map; use syntax::ast_map::path_name; use syntax::ast_util::local_def; use syntax::opt_vec; -use syntax::parse::token::special_idents; use syntax::abi::AbiSet; pub fn monomorphic_fn(ccx: @CrateContext, @@ -116,8 +115,6 @@ pub fn monomorphic_fn(ccx: @CrateContext, // Foreign externs don't have to be monomorphized. return (get_item_val(ccx, fn_id.node), true); } - ast_map::node_dtor(_, dtor, _, pt) => - (pt, special_idents::dtor, dtor.span), ast_map::node_trait_method(@ast::provided(m), _, pt) => { (pt, m.ident, m.span) } @@ -243,16 +240,6 @@ pub fn monomorphic_fn(ccx: @CrateContext, meth::trans_method(ccx, pt, mth, psubsts, None, d, impl_did); d } - ast_map::node_dtor(_, dtor, _, pt) => { - let parent_id = match ty::ty_to_def_id(ty::node_id_to_type(ccx.tcx, - dtor.node.self_id)) { - Some(did) => did, - None => ccx.sess.span_bug(dtor.span, ~"Bad self ty in \ - dtor") - }; - trans_struct_dtor(ccx, /*bad*/copy *pt, &dtor.node.body, - dtor.node.id, psubsts, Some(hash_id), parent_id) - } ast_map::node_trait_method(@ast::provided(mth), _, pt) => { let d = mk_lldecl(); set_inline_hint_if_appr(/*bad*/copy mth.attrs, d); diff --git a/src/librustc/middle/trans/reachable.rs b/src/librustc/middle/trans/reachable.rs index 3ccef0dbc4a..234473dd35b 100644 --- a/src/librustc/middle/trans/reachable.rs +++ b/src/librustc/middle/trans/reachable.rs @@ -124,18 +124,10 @@ fn traverse_public_item(cx: &ctx, item: @item) { } } } - item_struct(ref struct_def, ref generics) => { + item_struct(ref struct_def, _) => { for struct_def.ctor_id.each |&ctor_id| { cx.rmap.insert(ctor_id); } - for struct_def.dtor.each |dtor| { - cx.rmap.insert(dtor.node.id); - if generics.ty_params.len() > 0u || - attr::find_inline_attr(dtor.node.attrs) != attr::ia_none - { - traverse_inline_body(cx, &dtor.node.body); - } - } } item_ty(t, _) => { traverse_ty(t, cx, @@ -239,9 +231,6 @@ fn traverse_all_resources_and_impls(cx: &ctx, crate_mod: &_mod) { visit_item: |i, cx, v| { visit::visit_item(i, cx, v); match i.node { - item_struct(sdef, _) if sdef.dtor.is_some() => { - traverse_public_item(cx, i); - } item_impl(*) => { traverse_public_item(cx, i); } diff --git a/src/librustc/middle/trans/type_use.rs b/src/librustc/middle/trans/type_use.rs index 33145dd4334..e19eba6ca98 100644 --- a/src/librustc/middle/trans/type_use.rs +++ b/src/librustc/middle/trans/type_use.rs @@ -157,9 +157,6 @@ pub fn type_uses_for(ccx: @CrateContext, fn_id: def_id, n_tps: uint) for uint::range(0u, n_tps) |n| { cx.uses[n] |= flags;} } } - ast_map::node_dtor(_, ref dtor, _, _) => { - handle_body(cx, &dtor.node.body); - } ast_map::node_struct_ctor(*) => { // Similarly to node_variant, this monomorphized function just uses // the representations of all of its type parameters. diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index c7fb1e94adf..5b8e0e03b62 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -3748,28 +3748,8 @@ pub impl DtorKind { Otherwise return none. */ pub fn ty_dtor(cx: ctxt, struct_id: def_id) -> DtorKind { match cx.destructor_for_type.find(&struct_id) { - Some(&method_def_id) => return TraitDtor(method_def_id), - None => {} // Continue. - } - - if is_local(struct_id) { - match cx.items.find(&struct_id.node) { - Some(&ast_map::node_item(@ast::item { - node: ast::item_struct(@ast::struct_def { dtor: Some(ref dtor), - _ }, - _), - _ - }, _)) => - LegacyDtor(local_def((*dtor).node.id)), - _ => - NoDtor - } - } - else { - match csearch::struct_dtor(cx.sess.cstore, struct_id) { + Some(&method_def_id) => TraitDtor(method_def_id), None => NoDtor, - Some(did) => LegacyDtor(did), - } } } @@ -3819,11 +3799,6 @@ pub fn item_path(cx: ctxt, id: ast::def_id) -> ast_map::path { ast_map::path_name((*variant).node.name)) } - ast_map::node_dtor(_, _, _, path) => { - vec::append_one(/*bad*/copy *path, ast_map::path_name( - syntax::parse::token::special_idents::literally_dtor)) - } - ast_map::node_struct_ctor(_, item, path) => { vec::append_one(/*bad*/copy *path, ast_map::path_name(item.ident)) } diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index b9f3de873cf..d1c5ae18bc3 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -557,30 +557,7 @@ pub fn check_no_duplicate_fields(tcx: ty::ctxt, } } -pub fn check_struct(ccx: @mut CrateCtxt, - struct_def: @ast::struct_def, - id: ast::node_id, - span: span) { - let tcx = ccx.tcx; - let self_ty = ty::node_id_to_type(tcx, id); - - for struct_def.dtor.each |dtor| { - let class_t = SelfInfo { - self_ty: self_ty, - self_id: dtor.node.self_id, - span: dtor.span, - }; - // typecheck the dtor - let dtor_dec = ast_util::dtor_dec(); - check_bare_fn( - ccx, - &dtor_dec, - &dtor.node.body, - dtor.node.id, - Some(class_t) - ); - }; - +pub fn check_struct(ccx: @mut CrateCtxt, id: ast::node_id, span: span) { // Check that the class is instantiable check_instantiable(ccx.tcx, span, id); } @@ -623,8 +600,8 @@ pub fn check_item(ccx: @mut CrateCtxt, it: @ast::item) { } } } - ast::item_struct(struct_def, _) => { - check_struct(ccx, struct_def, it.id, it.span); + ast::item_struct(*) => { + check_struct(ccx, it.id, it.span); } ast::item_ty(t, ref generics) => { let tpt_ty = ty::node_id_to_type(ccx.tcx, it.id); diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index 0ffd398d03c..10537711b32 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -49,7 +49,6 @@ use syntax::ast::{RegionTyParamBound, TraitTyParamBound}; use syntax::ast; use syntax::ast_map; use syntax::ast_util::{local_def, split_trait_methods}; -use syntax::ast_util; use syntax::codemap::span; use syntax::codemap; use syntax::print::pprust::{path_to_str, self_ty_to_str}; @@ -897,30 +896,6 @@ pub fn convert_struct(ccx: &CrateCtxt, id: ast::node_id) { let tcx = ccx.tcx; - for struct_def.dtor.each |dtor| { - let region_parameterization = - RegionParameterization::from_variance_and_generics(rp, generics); - - // Write the dtor type - let t_dtor = ty::mk_bare_fn( - tcx, - astconv::ty_of_bare_fn( - ccx, - &type_rscope(region_parameterization), - ast::impure_fn, - AbiSet::Rust(), - &opt_vec::Empty, - &ast_util::dtor_dec())); - write_ty_to_tcx(tcx, dtor.node.id, t_dtor); - tcx.tcache.insert(local_def(dtor.node.id), - ty_param_bounds_and_ty { - generics: ty::Generics { - type_param_defs: tpt.generics.type_param_defs, - region_param: rp - }, - ty: t_dtor}); - }; - // Write the type of each of the members for struct_def.fields.each |f| { convert_field(ccx, rp, tpt.generics.type_param_defs, *f, generics); diff --git a/src/librustdoc/tystr_pass.rs b/src/librustdoc/tystr_pass.rs index 303bdc53b69..a6fbee81bc8 100644 --- a/src/librustdoc/tystr_pass.rs +++ b/src/librustdoc/tystr_pass.rs @@ -332,13 +332,7 @@ fn fold_struct( /// what I actually want fn strip_struct_extra_stuff(item: @ast::item) -> @ast::item { let node = match copy item.node { - ast::item_struct(def, tys) => { - let def = @ast::struct_def { - dtor: None, // Remove the drop { } block - .. copy *def - }; - ast::item_struct(def, tys) - } + ast::item_struct(def, tys) => ast::item_struct(def, tys), _ => fail!(~"not a struct") }; diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index ba6fe1cda4f..71fd506ebed 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1174,10 +1174,7 @@ pub enum struct_field_kind { #[auto_decode] #[deriving(Eq)] pub struct struct_def { - fields: ~[@struct_field], /* fields */ - /* (not including ctor or dtor) */ - /* dtor is optional */ - dtor: Option, + fields: ~[@struct_field], /* fields, not including ctor */ /* ID of the constructor. This is only used for tuple- or enum-like * structs. */ ctor_id: Option @@ -1230,18 +1227,6 @@ impl to_bytes::IterBytes for struct_mutability { } } -pub type struct_dtor = spanned; - -#[auto_encode] -#[auto_decode] -#[deriving(Eq)] -pub struct struct_dtor_ { - id: node_id, - attrs: ~[attribute], - self_id: node_id, - body: blk, -} - #[auto_encode] #[auto_decode] #[deriving(Eq)] @@ -1272,7 +1257,6 @@ pub enum inlined_item { ii_item(@item), ii_method(def_id /* impl id */, @method), ii_foreign(@foreign_item), - ii_dtor(struct_dtor, ident, Generics, def_id /* parent id */) } /* hold off on tests ... they appear in a later merge. diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index f9828ad2b9e..d2125cebb5e 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -14,7 +14,6 @@ use ast; use ast_util::{inlined_item_utils, stmt_id}; use ast_util; use codemap; -use codemap::spanned; use diagnostic::span_handler; use parse::token::ident_interner; use print::pprust; @@ -93,8 +92,6 @@ pub enum ast_node { // order they are introduced. node_arg(arg, uint), node_local(uint), - // Destructor for a struct - node_dtor(Generics, @struct_dtor, def_id, @path), node_block(blk), node_struct_ctor(@struct_def, @item, @path), } @@ -163,7 +160,7 @@ pub fn map_decoded_item(diag: @span_handler, // don't decode and instantiate the impl, but just the method, we have to // add it to the table now: match *ii { - ii_item(*) | ii_dtor(*) => { /* fallthrough */ } + ii_item(*) => { /* fallthrough */ } ii_foreign(i) => { cx.map.insert(i.id, node_foreign_item(i, AbiSet::Intrinsic(), @@ -193,27 +190,6 @@ pub fn map_fn( node_arg(/* FIXME (#2543) */ copy *a, cx.local_id)); cx.local_id += 1u; } - match *fk { - visit::fk_dtor(generics, ref attrs, self_id, parent_id) => { - let dt = @spanned { - node: ast::struct_dtor_ { - id: id, - attrs: /* FIXME (#2543) */ vec::from_slice(*attrs), - self_id: self_id, - body: /* FIXME (#2543) */ copy *body, - }, - span: sp, - }; - cx.map.insert( - id, - node_dtor( - /* FIXME (#2543) */ copy *generics, - dt, - parent_id, - @/* FIXME (#2543) */ copy cx.path)); - } - _ => () - } visit::visit_fn(fk, decl, body, sp, id, cx, v); } @@ -411,9 +387,6 @@ pub fn node_id_to_str(map: map, id: node_id, itr: @ident_interner) -> ~str { Some(&node_local(_)) => { // add more info here fmt!("local (id=%?)", id) } - Some(&node_dtor(*)) => { // add more info here - fmt!("node_dtor (id=%?)", id) - } Some(&node_block(_)) => { fmt!("block") } diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 148b713a4f5..bf5381831d0 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -302,7 +302,6 @@ impl inlined_item_utils for inlined_item { ii_item(i) => /* FIXME (#2543) */ copy i.ident, ii_foreign(i) => /* FIXME (#2543) */ copy i.ident, ii_method(_, m) => /* FIXME (#2543) */ copy m.ident, - ii_dtor(_, nm, _, _) => /* FIXME (#2543) */ copy nm } } @@ -311,7 +310,6 @@ impl inlined_item_utils for inlined_item { ii_item(i) => i.id, ii_foreign(i) => i.id, ii_method(_, m) => m.id, - ii_dtor(ref dtor, _, _, _) => (*dtor).node.id } } @@ -320,10 +318,6 @@ impl inlined_item_utils for inlined_item { ii_item(i) => (v.visit_item)(i, e, v), ii_foreign(i) => (v.visit_foreign_item)(i, e, v), ii_method(_, m) => visit::visit_method_helper(m, e, v), - ii_dtor(/*bad*/ copy dtor, _, ref generics, parent_id) => { - visit::visit_struct_dtor_helper(dtor, generics, - parent_id, e, v); - } } } } @@ -359,20 +353,6 @@ pub fn operator_prec(op: ast::binop) -> uint { /// not appearing in the prior table. pub static as_prec: uint = 11u; -pub fn dtor_ty() -> @ast::Ty { - @ast::Ty {id: 0, node: ty_nil, span: dummy_sp()} -} - -pub fn dtor_dec() -> fn_decl { - let nil_t = dtor_ty(); - // dtor has no args - ast::fn_decl { - inputs: ~[], - output: nil_t, - cf: return_val, - } -} - pub fn empty_generics() -> Generics { Generics {lifetimes: opt_vec::Empty, ty_params: opt_vec::Empty} @@ -457,12 +437,6 @@ pub fn id_visitor(vfn: @fn(node_id)) -> visit::vt<()> { vfn(id); match *fk { - visit::fk_dtor(generics, _, self_id, parent_id) => { - visit_generics(generics); - vfn(id); - vfn(self_id); - vfn(parent_id.node); - } visit::fk_item_fn(_, generics, _, _) => { visit_generics(generics); } diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index 3311c61de8b..3ad94905f7f 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -431,7 +431,6 @@ impl gen_init for protocol { dummy_sp(), ast::struct_def { fields: fields, - dtor: None, ctor_id: None }, cx.strip_bounds(&generics)) diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index d82608846ab..adfc95f3e94 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -290,21 +290,8 @@ pub fn noop_fold_item_underscore(i: &item_, fld: @ast_fold) -> item_ { fn fold_struct_def(struct_def: @ast::struct_def, fld: @ast_fold) -> @ast::struct_def { - let dtor = do struct_def.dtor.map |dtor| { - let dtor_body = fld.fold_block(&dtor.node.body); - let dtor_id = fld.new_id(dtor.node.id); - spanned { - node: ast::struct_dtor_ { - body: dtor_body, - id: dtor_id, - .. copy dtor.node - }, - span: copy dtor.span - } - }; @ast::struct_def { fields: struct_def.fields.map(|f| fold_struct_field(*f, fld)), - dtor: dtor, ctor_id: struct_def.ctor_id.map(|cid| fld.new_id(*cid)), } } @@ -655,22 +642,9 @@ fn noop_fold_variant(v: &variant_, fld: @ast_fold) -> variant_ { }) } struct_variant_kind(struct_def) => { - let dtor = do struct_def.dtor.map |dtor| { - let dtor_body = fld.fold_block(&dtor.node.body); - let dtor_id = fld.new_id(dtor.node.id); - spanned { - node: ast::struct_dtor_ { - body: dtor_body, - id: dtor_id, - .. copy dtor.node - }, - .. copy *dtor - } - }; kind = struct_variant_kind(@ast::struct_def { fields: vec::map(struct_def.fields, |f| fld.fold_struct_field(*f)), - dtor: dtor, ctor_id: struct_def.ctor_id.map(|c| fld.new_id(*c)) }) } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 1a4a15b3bf5..27a1cde2f96 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3346,7 +3346,6 @@ pub impl Parser { (class_name, item_struct(@ast::struct_def { fields: fields, - dtor: None, ctor_id: if is_tuple_like { Some(new_id) } else { None } }, generics), None) @@ -3803,7 +3802,6 @@ pub impl Parser { return @ast::struct_def { fields: fields, - dtor: None, ctor_id: None }; } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index d5645ada929..f23badd0462 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -693,13 +693,6 @@ pub fn print_struct(s: @ps, nbsp(s); bopen(s); hardbreak_if_not_bol(s); - for struct_def.dtor.each |dtor| { - hardbreak_if_not_bol(s); - maybe_print_comment(s, dtor.span.lo); - print_outer_attributes(s, dtor.node.attrs); - head(s, ~"drop"); - print_block(s, &dtor.node.body); - } for struct_def.fields.each |field| { match field.node.kind { diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 80df8fb91a5..71cfbab9108 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -11,7 +11,6 @@ use abi::AbiSet; use ast::*; use ast; -use ast_util; use codemap::span; use parse; use opt_vec; @@ -39,13 +38,6 @@ pub enum fn_kind<'self> { // |x, y| ... fk_fn_block, - - fk_dtor( // class destructor - &'self Generics, - &'self [attribute], - node_id /* self id */, - def_id /* parent class id */ - ) } pub fn name_of_fn(fk: &fn_kind) -> ident { @@ -54,15 +46,13 @@ pub fn name_of_fn(fk: &fn_kind) -> ident { name } fk_anon(*) | fk_fn_block(*) => parse::token::special_idents::anon, - fk_dtor(*) => parse::token::special_idents::dtor } } pub fn generics_of_fn(fk: &fn_kind) -> Generics { match *fk { fk_item_fn(_, generics, _, _) | - fk_method(_, generics, _) | - fk_dtor(generics, _, _, _) => { + fk_method(_, generics, _) => { copy *generics } fk_anon(*) | fk_fn_block(*) => { @@ -369,25 +359,6 @@ pub fn visit_method_helper(m: &method, e: E, v: vt) { ); } -pub fn visit_struct_dtor_helper(dtor: struct_dtor, generics: &Generics, - parent_id: def_id, e: E, v: vt) { - (v.visit_fn)( - &fk_dtor( - generics, - dtor.node.attrs, - dtor.node.self_id, - parent_id - ), - &ast_util::dtor_dec(), - &dtor.node.body, - dtor.span, - dtor.node.id, - e, - v - ) - -} - pub fn visit_fn(fk: &fn_kind, decl: &fn_decl, body: &blk, _sp: span, _id: node_id, e: E, v: vt) { visit_fn_decl(decl, e, v); @@ -412,23 +383,14 @@ pub fn visit_trait_method(m: &trait_method, e: E, v: vt) { pub fn visit_struct_def( sd: @struct_def, _nm: ast::ident, - generics: &Generics, - id: node_id, + _generics: &Generics, + _id: node_id, e: E, v: vt ) { for sd.fields.each |f| { (v.visit_struct_field)(*f, e, v); } - for sd.dtor.each |dtor| { - visit_struct_dtor_helper( - *dtor, - generics, - ast_util::local_def(id), - e, - v - ) - } } pub fn visit_struct_field(sf: @struct_field, e: E, v: vt) { -- cgit 1.4.1-3-g733a5 From 3e3e2f00250d77719598ad052bb2016d46e6a148 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Tue, 30 Apr 2013 20:20:08 -0700 Subject: allow parsing attributes on struct fields --- src/libsyntax/ast.rs | 1 + src/libsyntax/ext/pipes/pipec.rs | 3 ++- src/libsyntax/fold.rs | 7 ++++++- src/libsyntax/parse/obsolete.rs | 6 +++--- src/libsyntax/parse/parser.rs | 30 ++++++++++++++++++------------ src/libsyntax/print/pprust.rs | 1 + 6 files changed, 31 insertions(+), 17 deletions(-) (limited to 'src/libsyntax/parse/parser.rs') diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 71fd506ebed..a853dbed2f1 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1158,6 +1158,7 @@ pub struct struct_field_ { kind: struct_field_kind, id: node_id, ty: @Ty, + attrs: ~[attribute], } pub type struct_field = spanned; diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index 3ad94905f7f..e876972fe68 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -415,7 +415,8 @@ impl gen_init for protocol { ast::struct_immutable, ast::inherited), id: cx.next_id(), - ty: fty + ty: fty, + attrs: ~[], }, span: dummy_sp() } diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index adfc95f3e94..36565395e59 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -222,9 +222,12 @@ pub fn noop_fold_item(i: @item, fld: @ast_fold) -> Option<@item> { fn noop_fold_struct_field(sf: @struct_field, fld: @ast_fold) -> @struct_field { + let fold_attribute = |x| fold_attribute_(x, fld); + @spanned { node: ast::struct_field_ { kind: copy sf.node.kind, id: sf.node.id, - ty: fld.fold_ty(sf.node.ty) }, + ty: fld.fold_ty(sf.node.ty), + attrs: sf.node.attrs.map(|e| fold_attribute(*e)) }, span: sf.span } } @@ -309,6 +312,7 @@ fn fold_struct_field(f: @struct_field, fld: @ast_fold) -> @struct_field { kind: copy f.node.kind, id: fld.new_id(f.node.id), ty: fld.fold_ty(f.node.ty), + attrs: /* FIXME (#2543) */ copy f.node.attrs, }, span: fld.new_span(f.span), } @@ -757,6 +761,7 @@ impl ast_fold for AstFoldFns { kind: copy sf.node.kind, id: sf.node.id, ty: (self as @ast_fold).fold_ty(sf.node.ty), + attrs: copy sf.node.attrs, }, span: (self.new_span)(sf.span), } diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index ce21e0f672d..c1afc53def0 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -18,7 +18,7 @@ removed. */ -use ast::{expr, expr_lit, lit_nil}; +use ast::{expr, expr_lit, lit_nil, attribute}; use ast; use codemap::{span, respan}; use parse::parser::Parser; @@ -282,13 +282,13 @@ pub impl Parser { } } - fn try_parse_obsolete_priv_section(&self) -> bool { + fn try_parse_obsolete_priv_section(&self, attrs: ~[attribute]) -> bool { if self.is_keyword(&~"priv") && self.look_ahead(1) == token::LBRACE { self.obsolete(copy *self.span, ObsoletePrivSection); self.eat_keyword(&~"priv"); self.bump(); while *self.token != token::RBRACE { - self.parse_single_struct_field(ast::private); + self.parse_single_struct_field(ast::private, attrs); } self.bump(); true diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 27a1cde2f96..74af7458408 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2520,7 +2520,9 @@ pub impl Parser { } // parse a structure field - fn parse_name_and_ty(&self, pr: visibility) -> @struct_field { + fn parse_name_and_ty(&self, + pr: visibility, + attrs: ~[attribute]) -> @struct_field { let mut is_mutbl = struct_immutable; let lo = self.span.lo; if self.eat_keyword(&~"mut") { @@ -2535,7 +2537,8 @@ pub impl Parser { @spanned(lo, self.last_span.hi, ast::struct_field_ { kind: named_field(name, is_mutbl, pr), id: self.get_id(), - ty: ty + ty: ty, + attrs: attrs, }) } @@ -3318,11 +3321,13 @@ pub impl Parser { &token::RPAREN, seq_sep_trailing_allowed(token::COMMA) ) |p| { + let attrs = self.parse_outer_attributes(); let lo = p.span.lo; let struct_field_ = ast::struct_field_ { kind: unnamed_field, id: self.get_id(), - ty: p.parse_ty(false) + ty: p.parse_ty(false), + attrs: attrs, }; @spanned(lo, p.span.hi, struct_field_) }; @@ -3359,12 +3364,14 @@ pub impl Parser { } // parse a structure field declaration - fn parse_single_struct_field(&self, vis: visibility) -> @struct_field { + fn parse_single_struct_field(&self, + vis: visibility, + attrs: ~[attribute]) -> @struct_field { if self.eat_obsolete_ident("let") { self.obsolete(*self.last_span, ObsoleteLet); } - let a_var = self.parse_name_and_ty(vis); + let a_var = self.parse_name_and_ty(vis, attrs); match *self.token { token::SEMI => { self.obsolete(copy *self.span, ObsoleteFieldTerminator); @@ -3390,26 +3397,25 @@ pub impl Parser { // parse an element of a struct definition fn parse_struct_decl_field(&self) -> ~[@struct_field] { - if self.try_parse_obsolete_priv_section() { + let attrs = self.parse_outer_attributes(); + + if self.try_parse_obsolete_priv_section(attrs) { return ~[]; } - // Need this to parse comments on fields. - let _attrs = self.parse_outer_attributes(); - if self.eat_keyword(&~"priv") { - return ~[self.parse_single_struct_field(private)] + return ~[self.parse_single_struct_field(private, attrs)] } if self.eat_keyword(&~"pub") { - return ~[self.parse_single_struct_field(public)]; + return ~[self.parse_single_struct_field(public, attrs)]; } if self.try_parse_obsolete_struct_ctor() { return ~[]; } - return ~[self.parse_single_struct_field(inherited)]; + return ~[self.parse_single_struct_field(inherited, attrs)]; } // parse visiility: PUB, PRIV, or nothing diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index f23badd0462..ab958d8b5ce 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -700,6 +700,7 @@ pub fn print_struct(s: @ps, ast::named_field(ident, mutability, visibility) => { hardbreak_if_not_bol(s); maybe_print_comment(s, field.span.lo); + print_outer_attributes(s, field.node.attrs); print_visibility(s, visibility); if mutability == ast::struct_mutable { word_nbsp(s, ~"mut"); -- cgit 1.4.1-3-g733a5 From e596128bd87b978fb163235bcf5eb0ef7d446218 Mon Sep 17 00:00:00 2001 From: Brendan Zabarauskas Date: Wed, 1 May 2013 20:52:09 +1000 Subject: Remove 'Local Variable' comments --- src/compiletest/compiletest.rc | 7 ------- src/libcore/core.rc | 9 --------- src/libcore/either.rs | 10 ---------- src/libcore/io.rs | 10 ---------- src/libcore/libc.rs | 9 --------- src/libcore/num/cmath.rs | 11 ----------- src/libcore/num/f32.rs | 10 ---------- src/libcore/num/f64.rs | 10 ---------- src/libcore/num/float.rs | 10 ---------- src/libcore/option.rs | 8 -------- src/libcore/rand.rs | 9 --------- src/libcore/run.rs | 8 -------- src/libcore/sys.rs | 8 -------- src/libcore/unstable/extfmt.rs | 8 -------- src/libcore/unstable/lang.rs | 8 -------- src/libfuzzer/fuzzer.rc | 7 ------- src/librustc/back/abi.rs | 9 --------- src/librustc/back/arm.rs | 11 ----------- src/librustc/back/link.rs | 10 ---------- src/librustc/back/mips.rs | 11 ----------- src/librustc/back/upcall.rs | 9 --------- src/librustc/back/x86.rs | 10 ---------- src/librustc/back/x86_64.rs | 10 ---------- src/librustc/driver/driver.rs | 8 -------- src/librustc/driver/session.rs | 7 ------- src/librustc/front/config.rs | 8 -------- src/librustc/front/test.rs | 8 -------- src/librustc/lib/llvm.rs | 10 ---------- src/librustc/metadata/creader.rs | 8 -------- src/librustc/metadata/csearch.rs | 8 -------- src/librustc/metadata/cstore.rs | 8 -------- src/librustc/metadata/decoder.rs | 8 -------- src/librustc/metadata/encoder.rs | 9 --------- src/librustc/metadata/tydecode.rs | 10 ---------- src/librustc/metadata/tyencode.rs | 10 ---------- src/librustc/middle/check_const.rs | 8 -------- src/librustc/middle/check_match.rs | 8 -------- src/librustc/middle/const_eval.rs | 9 --------- src/librustc/middle/freevars.rs | 8 -------- src/librustc/middle/kind.rs | 10 ---------- src/librustc/middle/lint.rs | 10 ---------- src/librustc/middle/trans/_match.rs | 8 -------- src/librustc/middle/trans/base.rs | 9 --------- src/librustc/middle/trans/build.rs | 10 ---------- src/librustc/middle/trans/common.rs | 10 ---------- src/librustc/middle/trans/tvec.rs | 10 ---------- src/librustc/middle/ty.rs | 8 -------- src/librustc/middle/typeck/mod.rs | 9 --------- src/librustc/rustc.rc | 8 -------- src/librustc/util/common.rs | 10 ---------- src/librustc/util/ppaux.rs | 8 -------- src/libstd/bitv.rs | 10 ---------- src/libstd/dbg.rs | 8 -------- src/libstd/getopts.rs | 8 -------- src/libstd/list.rs | 8 -------- src/libstd/sha1.rs | 8 -------- src/libstd/sort.rs | 8 -------- src/libstd/std.rc | 8 -------- src/libstd/term.rs | 7 ------- src/libstd/test.rs | 9 --------- src/libsyntax/ast.rs | 9 --------- src/libsyntax/ast_map.rs | 8 -------- src/libsyntax/ast_util.rs | 8 -------- src/libsyntax/attr.rs | 10 ---------- src/libsyntax/codemap.rs | 12 ------------ src/libsyntax/ext/asm.rs | 12 ------------ src/libsyntax/ext/base.rs | 10 ---------- src/libsyntax/ext/env.rs | 10 ---------- src/libsyntax/ext/expand.rs | 8 -------- src/libsyntax/ext/fmt.rs | 9 --------- src/libsyntax/ext/source_util.rs | 10 ---------- src/libsyntax/ext/tt/macro_parser.rs | 8 -------- src/libsyntax/fold.rs | 10 ---------- src/libsyntax/parse/attr.rs | 10 ---------- src/libsyntax/parse/lexer.rs | 10 ---------- src/libsyntax/parse/mod.rs | 10 ---------- src/libsyntax/parse/parser.rs | 11 ----------- src/libsyntax/parse/token.rs | 8 -------- src/libsyntax/print/pp.rs | 11 ----------- src/libsyntax/print/pprust.rs | 10 ---------- src/libsyntax/visit.rs | 8 -------- src/test/run-pass/item-attributes.rs | 10 ---------- src/test/run-pass/spawn.rs | 8 -------- src/test/run-pass/spawn2.rs | 8 -------- src/test/run-pass/task-killjoin-rsrc.rs | 8 -------- src/test/run-pass/task-killjoin.rs | 8 -------- 86 files changed, 775 deletions(-) (limited to 'src/libsyntax/parse/parser.rs') diff --git a/src/compiletest/compiletest.rc b/src/compiletest/compiletest.rc index 4392ce7ba28..b6d690f8307 100644 --- a/src/compiletest/compiletest.rc +++ b/src/compiletest/compiletest.rc @@ -223,10 +223,3 @@ pub fn make_test_closure(config: config, testfile: &Path) -> test::TestFn { let testfile = testfile.to_str(); test::DynTestFn(|| runtest::run(config, testfile)) } - -// Local Variables: -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libcore/core.rc b/src/libcore/core.rc index 9a0419ebfc6..f410591fdc7 100644 --- a/src/libcore/core.rc +++ b/src/libcore/core.rc @@ -263,12 +263,3 @@ mod core { pub use sys; pub use pipes; } - - -// Local Variables: -// mode: rust; -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libcore/either.rs b/src/libcore/either.rs index 92f850cddd6..33b7e81ee85 100644 --- a/src/libcore/either.rs +++ b/src/libcore/either.rs @@ -263,13 +263,3 @@ fn test_partition_empty() { assert_eq!(vec::len(lefts), 0u); assert_eq!(vec::len(rights), 0u); } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libcore/io.rs b/src/libcore/io.rs index 35ffd88c8f4..185b84a09c5 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -1954,13 +1954,3 @@ mod tests { } } } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libcore/libc.rs b/src/libcore/libc.rs index 999a5d9b350..53aaf5726dd 100644 --- a/src/libcore/libc.rs +++ b/src/libcore/libc.rs @@ -1846,12 +1846,3 @@ pub mod funcs { } } } - - -// Local Variables: -// mode: rust; -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libcore/num/cmath.rs b/src/libcore/num/cmath.rs index 30b0c54dc2d..8a0a88235d2 100644 --- a/src/libcore/num/cmath.rs +++ b/src/libcore/num/cmath.rs @@ -267,14 +267,3 @@ pub mod c_double_targ_consts { } */ - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// - diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index 04ddd63a177..a00225e85bc 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -986,13 +986,3 @@ mod tests { assert_eq!(Primitive::bytes::(), sys::size_of::()); } } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index 9f1944e3fad..c3bd89b0e03 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -1033,13 +1033,3 @@ mod tests { assert_eq!(Primitive::bytes::(), sys::size_of::()); } } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libcore/num/float.rs b/src/libcore/num/float.rs index f163d67a69c..b487fa48782 100644 --- a/src/libcore/num/float.rs +++ b/src/libcore/num/float.rs @@ -1139,13 +1139,3 @@ mod tests { assert_eq!(to_str_digits(-infinity, 10u), ~"-inf"); } } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 17192b4257b..47ec1fabcb8 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -565,11 +565,3 @@ fn test_get_or_zero() { let no_stuff: Option = None; assert!(no_stuff.get_or_zero() == 0); } - -// Local Variables: -// mode: rust; -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libcore/rand.rs b/src/libcore/rand.rs index 94ba5ba31b7..80f69f067eb 100644 --- a/src/libcore/rand.rs +++ b/src/libcore/rand.rs @@ -1073,12 +1073,3 @@ mod tests { } } } - - -// Local Variables: -// mode: rust; -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libcore/run.rs b/src/libcore/run.rs index 37401788ca2..d0c495dd19e 100644 --- a/src/libcore/run.rs +++ b/src/libcore/run.rs @@ -639,11 +639,3 @@ mod tests { test_destroy_actually_kills(true); } } - -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libcore/sys.rs b/src/libcore/sys.rs index 8cad0a22886..c0c1ad6d896 100644 --- a/src/libcore/sys.rs +++ b/src/libcore/sys.rs @@ -343,11 +343,3 @@ mod tests { #[should_fail] fn fail_owned() { FailWithCause::fail_with(~"cause", file!(), line!()) } } - -// Local Variables: -// mode: rust; -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libcore/unstable/extfmt.rs b/src/libcore/unstable/extfmt.rs index b812be5575a..f65b1e6726e 100644 --- a/src/libcore/unstable/extfmt.rs +++ b/src/libcore/unstable/extfmt.rs @@ -688,11 +688,3 @@ mod test { let _s = fmt!("%s", s); } } - -// Local Variables: -// mode: rust; -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libcore/unstable/lang.rs b/src/libcore/unstable/lang.rs index 611862a79e7..a6599e03d6b 100644 --- a/src/libcore/unstable/lang.rs +++ b/src/libcore/unstable/lang.rs @@ -183,11 +183,3 @@ pub fn start(main: *u8, argc: int, argv: **c_char, crate_map: *c_void) -> c_int; } } - -// Local Variables: -// mode: rust; -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libfuzzer/fuzzer.rc b/src/libfuzzer/fuzzer.rc index fc1efd3313c..7c93d867f50 100644 --- a/src/libfuzzer/fuzzer.rc +++ b/src/libfuzzer/fuzzer.rc @@ -693,10 +693,3 @@ pub fn main() { error!("Fuzzer done"); } - -// Local Variables: -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/librustc/back/abi.rs b/src/librustc/back/abi.rs index 70a029ede6f..842dd89a7cd 100644 --- a/src/librustc/back/abi.rs +++ b/src/librustc/back/abi.rs @@ -77,12 +77,3 @@ pub fn bzero_glue_name() -> ~str { return ~"rust_bzero_glue"; } pub fn yield_glue_name() -> ~str { return ~"rust_yield_glue"; } pub fn no_op_type_glue_name() -> ~str { return ~"rust_no_op_type_glue"; } -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/librustc/back/arm.rs b/src/librustc/back/arm.rs index 97c3a588a7f..dfe5751f21b 100644 --- a/src/librustc/back/arm.rs +++ b/src/librustc/back/arm.rs @@ -72,14 +72,3 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t { cc_args: ~[~"-marm"] }; } - - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index adaffe5873d..87e08a73fcb 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -949,13 +949,3 @@ pub fn link_args(sess: Session, return args; } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/librustc/back/mips.rs b/src/librustc/back/mips.rs index 93c1879eb0f..b15306a56b0 100644 --- a/src/librustc/back/mips.rs +++ b/src/librustc/back/mips.rs @@ -72,14 +72,3 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t { cc_args: ~[] }; } - - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/librustc/back/upcall.rs b/src/librustc/back/upcall.rs index 4cdd279e2fc..8fcc5234e8b 100644 --- a/src/librustc/back/upcall.rs +++ b/src/librustc/back/upcall.rs @@ -59,12 +59,3 @@ pub fn declare_upcalls(targ_cfg: @session::config, nothrow(dv(~"reset_stack_limit", ~[])) } } -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/librustc/back/x86.rs b/src/librustc/back/x86.rs index 2cc812c3d41..759f5f63c9e 100644 --- a/src/librustc/back/x86.rs +++ b/src/librustc/back/x86.rs @@ -55,13 +55,3 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t { cc_args: ~[~"-m32"] }; } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/librustc/back/x86_64.rs b/src/librustc/back/x86_64.rs index b68073974dc..ed6f1d28514 100644 --- a/src/librustc/back/x86_64.rs +++ b/src/librustc/back/x86_64.rs @@ -63,13 +63,3 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t { cc_args: ~[~"-m64"] }; } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index 8c053c265fa..afd0e0acfe9 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -951,11 +951,3 @@ mod test { assert!((vec::len(test_items) == 1u)); } } - -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs index ff623049f75..b9e0eeb3466 100644 --- a/src/librustc/driver/session.rs +++ b/src/librustc/driver/session.rs @@ -430,10 +430,3 @@ mod test { assert!(building_library(lib_crate, crate, true)); } } - -// Local Variables: -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/librustc/front/config.rs b/src/librustc/front/config.rs index 75ae8724d72..2246dd9d2f0 100644 --- a/src/librustc/front/config.rs +++ b/src/librustc/front/config.rs @@ -194,11 +194,3 @@ pub fn metas_in_cfg(cfg: ast::crate_cfg, }) }) } - - -// Local Variables: -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs index 02e2a4c8734..4506feece2b 100644 --- a/src/librustc/front/test.rs +++ b/src/librustc/front/test.rs @@ -456,11 +456,3 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::expr { ); e } - -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs index 31050448e75..fbb3380554d 100644 --- a/src/librustc/lib/llvm.rs +++ b/src/librustc/lib/llvm.rs @@ -2196,13 +2196,3 @@ pub fn mk_section_iter(llof: ObjectFileRef) -> SectionIter { } } } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs index 0d0f0d7ab69..da7a2c15f30 100644 --- a/src/librustc/metadata/creader.rs +++ b/src/librustc/metadata/creader.rs @@ -328,11 +328,3 @@ fn resolve_crate_deps(e: @mut Env, cdata: @~[u8]) -> cstore::cnum_map { } return @mut cnum_map; } - -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/librustc/metadata/csearch.rs b/src/librustc/metadata/csearch.rs index f8dc34f9cee..375989b0ebe 100644 --- a/src/librustc/metadata/csearch.rs +++ b/src/librustc/metadata/csearch.rs @@ -243,11 +243,3 @@ pub fn get_link_args_for_crate(cstore: @mut cstore::CStore, let cdata = cstore::get_crate_data(cstore, crate_num); decoder::get_link_args_for_crate(cdata) } - -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/librustc/metadata/cstore.rs b/src/librustc/metadata/cstore.rs index 05275a4c665..21815a9ed47 100644 --- a/src/librustc/metadata/cstore.rs +++ b/src/librustc/metadata/cstore.rs @@ -161,11 +161,3 @@ pub fn get_dep_hashes(cstore: &CStore) -> ~[~str] { sorted.map(|ch| /*bad*/copy *ch.hash) } - -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index fb7b3f9c8b1..61454c802cc 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -1176,11 +1176,3 @@ pub fn get_link_args_for_crate(cdata: cmd) -> ~[~str] { } result } - -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index ba6a4f30857..2a4334781e4 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -1420,12 +1420,3 @@ pub fn encoded_ty(tcx: ty::ctxt, t: ty::t) -> ~str { tyencode::enc_ty(wr, cx, t); } } - - -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index 011ee115e8c..b12db430afc 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -567,13 +567,3 @@ fn parse_bounds(st: @mut PState, conv: conv_did) -> @~[ty::param_bound] { } @bounds } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs index 763b1984b81..0548204b154 100644 --- a/src/librustc/metadata/tyencode.rs +++ b/src/librustc/metadata/tyencode.rs @@ -416,13 +416,3 @@ pub fn enc_type_param_def(w: @io::Writer, cx: @ctxt, v: &ty::TypeParameterDef) { w.write_char('|'); enc_bounds(w, cx, v.bounds); } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/librustc/middle/check_const.rs b/src/librustc/middle/check_const.rs index 6a47eedcea8..36be65ed63f 100644 --- a/src/librustc/middle/check_const.rs +++ b/src/librustc/middle/check_const.rs @@ -253,11 +253,3 @@ pub fn check_item_recursion(sess: Session, visit::visit_expr(e, env, v); } } - -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index 852eb1b50a4..e412a0e5102 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -862,11 +862,3 @@ pub fn check_legality_of_move_bindings(cx: @MatchCheckCtxt, (vt.visit_pat)(*pat, false, vt); } } - -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs index 86b7379bb69..63b9fcf7096 100644 --- a/src/librustc/middle/const_eval.rs +++ b/src/librustc/middle/const_eval.rs @@ -484,12 +484,3 @@ pub fn lit_expr_eq(tcx: middle::ty::ctxt, a: @expr, b: @expr) -> bool { pub fn lit_eq(a: @lit, b: @lit) -> bool { compare_const_vals(&lit_to_const(a), &lit_to_const(b)) == 0 } - - -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/librustc/middle/freevars.rs b/src/librustc/middle/freevars.rs index 4c8d36f93f4..419b75a2ad9 100644 --- a/src/librustc/middle/freevars.rs +++ b/src/librustc/middle/freevars.rs @@ -119,11 +119,3 @@ pub fn get_freevars(tcx: ty::ctxt, fid: ast::node_id) -> freevar_info { pub fn has_freevars(tcx: ty::ctxt, fid: ast::node_id) -> bool { return vec::len(*get_freevars(tcx, fid)) != 0u; } - -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs index 0925e8cdd63..90e6f7c6af9 100644 --- a/src/librustc/middle/kind.rs +++ b/src/librustc/middle/kind.rs @@ -587,13 +587,3 @@ pub fn check_kind_bounds_of_cast(cx: Context, source: @expr, target: @expr) { _ => {} // Nothing to do. } } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index b67d74bc272..f6db25065b7 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -946,13 +946,3 @@ pub fn check_crate(tcx: ty::ctxt, crate: @ast::crate) { tcx.sess.abort_if_errors(); } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index 3755cca8c35..197b537fe90 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -1862,11 +1862,3 @@ pub fn bind_irrefutable_pat(bcx: block, } return bcx; } - -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 2090e50000b..0c3e3ba3cb6 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -3172,12 +3172,3 @@ pub fn trans_crate(sess: session::Session, return (llmod, link_meta); } } -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/librustc/middle/trans/build.rs b/src/librustc/middle/trans/build.rs index f5c496484a0..a02ac96e520 100644 --- a/src/librustc/middle/trans/build.rs +++ b/src/librustc/middle/trans/build.rs @@ -1086,13 +1086,3 @@ pub fn AtomicRMW(cx: block, op: AtomicBinOp, llvm::LLVMBuildAtomicRMW(B(cx), op, dst, src, order) } } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index f8fb0f4b7cf..d31caffe77a 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -1521,13 +1521,3 @@ pub fn dummy_substs(tps: ~[ty::t]) -> ty::substs { pub fn bool_to_i1(bcx: block, llval: ValueRef) -> ValueRef { build::ICmp(bcx, lib::llvm::IntNE, llval, C_bool(false)) } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs index 30a7648e7ea..da1cdfa4db1 100644 --- a/src/librustc/middle/trans/tvec.rs +++ b/src/librustc/middle/trans/tvec.rs @@ -594,13 +594,3 @@ pub fn iter_vec_unboxed(bcx: block, body_ptr: ValueRef, vec_ty: ty::t, let dataptr = get_dataptr(bcx, body_ptr); return iter_vec_raw(bcx, dataptr, vec_ty, fill, f); } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index ccd7cc6a8ab..1546c885a6d 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -4370,11 +4370,3 @@ pub fn visitor_object_ty(tcx: ctxt) -> (@TraitRef, t) { (trait_ref, mk_trait(tcx, trait_ref.def_id, copy trait_ref.substs, BoxTraitStore, ast::m_imm)) } - -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc/middle/typeck/mod.rs index 646b6412f55..b0e0b7319ac 100644 --- a/src/librustc/middle/typeck/mod.rs +++ b/src/librustc/middle/typeck/mod.rs @@ -426,12 +426,3 @@ pub fn check_crate(tcx: ty::ctxt, tcx.sess.abort_if_errors(); (ccx.method_map, ccx.vtable_map) } -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/librustc/rustc.rc b/src/librustc/rustc.rc index 54c51cf2e48..adb1c2fcc41 100644 --- a/src/librustc/rustc.rc +++ b/src/librustc/rustc.rc @@ -357,11 +357,3 @@ pub fn main() { run_compiler(&args, demitter); } } - - -// Local Variables: -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index 38f55b2b6e4..b4a479fc597 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -112,13 +112,3 @@ pub fn pluralize(n: uint, s: ~str) -> ~str { // A set of node IDs (used to keep track of which node IDs are for statements) pub type stmt_set = @mut HashSet; - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index aa8c3f8fd1b..69849a8d51b 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -739,11 +739,3 @@ impl Repr for ty::vstore { vstore_to_str(tcx, *self) } } - -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs index 5314c35419c..078ed6af5a0 100644 --- a/src/libstd/bitv.rs +++ b/src/libstd/bitv.rs @@ -1507,13 +1507,3 @@ mod tests { } } } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libstd/dbg.rs b/src/libstd/dbg.rs index 34dd6390ecc..4b2d2a60a68 100644 --- a/src/libstd/dbg.rs +++ b/src/libstd/dbg.rs @@ -76,11 +76,3 @@ fn test_breakpoint_should_not_abort_process_when_not_under_gdb() { // the process under normal circumstances breakpoint(); } - -// Local Variables: -// mode: rust; -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs index fda5c105da5..c03042fe9c2 100644 --- a/src/libstd/getopts.rs +++ b/src/libstd/getopts.rs @@ -1374,11 +1374,3 @@ Options: assert!(usage == expected) } } - -// Local Variables: -// mode: rust; -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libstd/list.rs b/src/libstd/list.rs index 401cc121a62..2b6fa0bc056 100644 --- a/src/libstd/list.rs +++ b/src/libstd/list.rs @@ -242,11 +242,3 @@ mod tests { == list::append(list::from_vec(~[1,2]), list::from_vec(~[3,4]))); } } - -// Local Variables: -// mode: rust; -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libstd/sha1.rs b/src/libstd/sha1.rs index 7371250b38a..a8e0f7d062a 100644 --- a/src/libstd/sha1.rs +++ b/src/libstd/sha1.rs @@ -412,11 +412,3 @@ mod tests { } } } - -// Local Variables: -// mode: rust; -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs index 3e6011e80df..172532a2e5b 100644 --- a/src/libstd/sort.rs +++ b/src/libstd/sort.rs @@ -1202,11 +1202,3 @@ mod big_tests { } } } - -// Local Variables: -// mode: rust; -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libstd/std.rc b/src/libstd/std.rc index 0a5348d7976..ea099090eba 100644 --- a/src/libstd/std.rc +++ b/src/libstd/std.rc @@ -121,11 +121,3 @@ pub mod std { pub use serialize; pub use test; } - -// Local Variables: -// mode: rust; -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libstd/term.rs b/src/libstd/term.rs index 022f1f8564e..a79b9f4c849 100644 --- a/src/libstd/term.rs +++ b/src/libstd/term.rs @@ -76,10 +76,3 @@ pub fn fg(writer: @io::Writer, color: u8) { pub fn bg(writer: @io::Writer, color: u8) { return set_color(writer, '4' as u8, color); } - -// Local Variables: -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libstd/test.rs b/src/libstd/test.rs index 278a326d1de..65fb0c7426a 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -960,12 +960,3 @@ mod tests { } } } - - -// Local Variables: -// mode: rust; -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 4bb2d220ad6..a295952439f 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1346,12 +1346,3 @@ mod test { } */ -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index d2125cebb5e..69397276c4f 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -404,11 +404,3 @@ pub fn node_item_query(items: map, id: node_id, _ => fail!(error_msg) } } - -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 2b3793e45e9..47ef7227842 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -832,11 +832,3 @@ mod test { } } - -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 2f8405c6e96..f4f0def2843 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -341,13 +341,3 @@ pub fn require_unique_names(diagnostic: @span_handler, } } } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 1194506a887..5f4967351e1 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -522,15 +522,3 @@ mod test { fm.next_line(BytePos(2)); } } - - - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs index dfebf6f786a..53f40113532 100644 --- a/src/libsyntax/ext/asm.rs +++ b/src/libsyntax/ext/asm.rs @@ -187,15 +187,3 @@ pub fn expand_asm(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree]) span: sp }) } - - - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 2d6d74b5c1e..1c03ad13759 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -543,13 +543,3 @@ mod test { assert_eq!(*(m.find(&@~"def").get()),16); } } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libsyntax/ext/env.rs b/src/libsyntax/ext/env.rs index 5e5fd7d97b1..5b1e3737b23 100644 --- a/src/libsyntax/ext/env.rs +++ b/src/libsyntax/ext/env.rs @@ -34,13 +34,3 @@ pub fn expand_syntax_ext(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree]) }; MRExpr(e) } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index fde5a259422..02a698b283d 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -721,11 +721,3 @@ mod test { } } - -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs index 9bbe617eb07..62641279f88 100644 --- a/src/libsyntax/ext/fmt.rs +++ b/src/libsyntax/ext/fmt.rs @@ -322,12 +322,3 @@ fn pieces_to_expr(cx: @ext_ctxt, sp: span, return mk_block(cx, fmt_sp, ~[], stms, Some(buf())); } -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 70aa9472c85..ab22b3152f4 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -150,13 +150,3 @@ fn res_rel_file(cx: @ext_ctxt, sp: codemap::span, arg: &Path) -> Path { copy *arg } } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index e4e033e0fff..0c1e619985d 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -438,11 +438,3 @@ pub fn parse_nt(p: &Parser, name: ~str) -> nonterminal { _ => p.fatal(~"Unsupported builtin nonterminal parser: " + name) } } - -// Local Variables: -// mode: rust; -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 36565395e59..229a8664d0c 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -859,13 +859,3 @@ impl AstFoldExtensions for @ast_fold { pub fn make_fold(afp: ast_fold_fns) -> @ast_fold { afp as @ast_fold } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index cc580155d70..037b2c089f4 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -179,13 +179,3 @@ impl parser_attr for Parser { } } } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 60d6ce504fd..16a7ef71317 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -892,13 +892,3 @@ mod test { assert_eq!(tok, token::LIFETIME(id)); } } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 5d51a54d770..74e4f562ce5 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -674,13 +674,3 @@ mod test { string_to_expr(@~"a::z.froob(b,@(987+3))"); } } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index a582748edb3..8459fc8c627 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4509,14 +4509,3 @@ pub impl Parser { } } } - - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 338b7c99d97..fe7bd5b3bc1 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -556,11 +556,3 @@ pub fn reserved_keyword_table() -> HashSet<~str> { } return words; } - - -// Local Variables: -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index e2ad5becb12..3fa615939b7 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -587,14 +587,3 @@ pub fn hardbreak_tok_offset(off: int) -> token { } pub fn hardbreak_tok() -> token { return hardbreak_tok_offset(0); } - - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index ab958d8b5ce..76de109eebd 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -2280,13 +2280,3 @@ mod test { assert_eq!(&varstr,&~"pub principal_skinner"); } } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 71cfbab9108..9a0c97d7616 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -757,11 +757,3 @@ pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> { v_struct_method(v.visit_struct_method, a, b, c) }); } - -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/test/run-pass/item-attributes.rs b/src/test/run-pass/item-attributes.rs index 24fe6713372..c616d46a833 100644 --- a/src/test/run-pass/item-attributes.rs +++ b/src/test/run-pass/item-attributes.rs @@ -195,13 +195,3 @@ fn test_fn_inner() { } pub fn main() { } - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// diff --git a/src/test/run-pass/spawn.rs b/src/test/run-pass/spawn.rs index db4ca7b3ed8..63c2b7da38f 100644 --- a/src/test/run-pass/spawn.rs +++ b/src/test/run-pass/spawn.rs @@ -18,11 +18,3 @@ pub fn main() { } fn child(&&i: int) { error!(i); assert!((i == 10)); } - -// Local Variables: -// mode: rust; -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/test/run-pass/spawn2.rs b/src/test/run-pass/spawn2.rs index f9350746349..e748a1636ea 100644 --- a/src/test/run-pass/spawn2.rs +++ b/src/test/run-pass/spawn2.rs @@ -32,11 +32,3 @@ fn child(&&args: (int, int, int, int, int, int, int, int, int)) { assert!((i8 == 80)); assert!((i9 == 90)); } - -// Local Variables: -// mode: rust; -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/test/run-pass/task-killjoin-rsrc.rs b/src/test/run-pass/task-killjoin-rsrc.rs index 7cd08695da0..879f668577f 100644 --- a/src/test/run-pass/task-killjoin-rsrc.rs +++ b/src/test/run-pass/task-killjoin-rsrc.rs @@ -83,11 +83,3 @@ fn supervisor() { pub fn main() { join(joinable(supervisor)); } - -// Local Variables: -// mode: rust; -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/test/run-pass/task-killjoin.rs b/src/test/run-pass/task-killjoin.rs index 563e35be3d6..73c069e560c 100644 --- a/src/test/run-pass/task-killjoin.rs +++ b/src/test/run-pass/task-killjoin.rs @@ -33,11 +33,3 @@ fn supervisor() { pub fn main() { task::spawn_unlinked(supervisor) } - -// Local Variables: -// mode: rust; -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -- cgit 1.4.1-3-g733a5 From 35b91e2f73cec610af4a2a653389562ad7cbc85e Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Fri, 3 May 2013 01:28:53 +0900 Subject: Use static strings --- src/librustc/middle/borrowck/loan.rs | 6 +- src/librustc/middle/borrowck/mod.rs | 4 +- src/librustc/middle/borrowck/preserve.rs | 2 +- src/librustc/middle/trans/_match.rs | 3 +- src/librustc/middle/trans/base.rs | 9 ++- src/librustc/middle/trans/callee.rs | 4 +- src/librustc/middle/trans/consts.rs | 35 +++----- src/librustc/middle/trans/datum.rs | 4 +- src/librustc/middle/trans/debuginfo.rs | 23 +++--- src/librustc/middle/trans/expr.rs | 11 ++- src/librustc/middle/trans/foreign.rs | 2 +- src/librustc/middle/trans/monomorphize.rs | 2 +- src/librustc/middle/trans/reachable.rs | 10 ++- src/librustc/middle/trans/tvec.rs | 4 +- src/librustc/middle/typeck/astconv.rs | 31 +++----- src/librustc/middle/typeck/check/_match.rs | 37 ++++----- src/librustc/middle/typeck/check/method.rs | 14 ++-- src/librustc/middle/typeck/check/mod.rs | 92 ++++++++++------------ src/librustc/middle/typeck/check/regionck.rs | 18 ++--- src/librustc/middle/typeck/check/vtable.rs | 2 +- src/librustc/middle/typeck/coherence.rs | 52 +++++------- src/librustc/middle/typeck/collect.rs | 5 +- .../middle/typeck/infer/region_inference.rs | 8 +- src/librustc/middle/typeck/mod.rs | 8 +- src/libsyntax/ext/base.rs | 2 +- src/libsyntax/parse/parser.rs | 69 ++++++++-------- 26 files changed, 201 insertions(+), 256 deletions(-) (limited to 'src/libsyntax/parse/parser.rs') diff --git a/src/librustc/middle/borrowck/loan.rs b/src/librustc/middle/borrowck/loan.rs index 21de29b8f60..4dd727390aa 100644 --- a/src/librustc/middle/borrowck/loan.rs +++ b/src/librustc/middle/borrowck/loan.rs @@ -115,7 +115,7 @@ pub impl LoanContext { if cmt.lp.is_none() { self.bccx.tcx.sess.span_bug( cmt.span, - ~"loan() called with non-lendable value"); + "loan() called with non-lendable value"); } match cmt.cat { @@ -123,7 +123,7 @@ pub impl LoanContext { // should never be loanable self.bccx.tcx.sess.span_bug( cmt.span, - ~"rvalue with a non-none lp"); + "rvalue with a non-none lp"); } cat_local(local_id) | cat_arg(local_id) | cat_self(local_id) => { // FIXME(#4903) @@ -188,7 +188,7 @@ pub impl LoanContext { // Aliased data is simply not lendable. self.bccx.tcx.sess.span_bug( cmt.span, - ~"aliased ptr with a non-none lp"); + "aliased ptr with a non-none lp"); } } } diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs index 3746f9c6e60..f1d45e6e9aa 100644 --- a/src/librustc/middle/borrowck/mod.rs +++ b/src/librustc/middle/borrowck/mod.rs @@ -525,11 +525,11 @@ pub impl BorrowckCtxt { self.note_and_explain_bckerr(err); } - fn span_err(&self, s: span, m: ~str) { + fn span_err(&self, s: span, m: &str) { self.tcx.sess.span_err(s, m); } - fn span_note(&self, s: span, m: ~str) { + fn span_note(&self, s: span, m: &str) { self.tcx.sess.span_note(s, m); } diff --git a/src/librustc/middle/borrowck/preserve.rs b/src/librustc/middle/borrowck/preserve.rs index c44920fffa5..62358823f23 100644 --- a/src/librustc/middle/borrowck/preserve.rs +++ b/src/librustc/middle/borrowck/preserve.rs @@ -124,7 +124,7 @@ pub impl<'self> PreserveCtxt<'self> { if self.root_managed_data { self.tcx().sess.span_bug( cmt.span, - ~"preserve() called with local and !root_managed_data"); + "preserve() called with local and !root_managed_data"); } let local_region = self.tcx().region_maps.encl_region(local_id); self.compare_scope(cmt, local_region) diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index 197b537fe90..3bd2a8269b7 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -557,8 +557,7 @@ pub fn enter_opt<'r>(bcx: block, struct_id = found_struct_id; } _ => { - tcx.sess.span_bug(p.span, ~"expected enum \ - variant def"); + tcx.sess.span_bug(p.span, "expected enum variant def"); } } diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 0c3e3ba3cb6..87e347d2004 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -1125,10 +1125,11 @@ pub fn init_local(bcx: block, local: @ast::local) -> block { } let llptr = match bcx.fcx.lllocals.find(&local.node.id) { - Some(&local_mem(v)) => v, - _ => { bcx.tcx().sess.span_bug(local.span, - ~"init_local: Someone forgot to document why it's\ - safe to assume local.node.init must be local_mem!"); + Some(&local_mem(v)) => v, + _ => { + bcx.tcx().sess.span_bug(local.span, + "init_local: Someone forgot to document why it's\ + safe to assume local.node.init must be local_mem!"); } }; diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs index ad0fea3b4b4..ed7f91bf04a 100644 --- a/src/librustc/middle/trans/callee.rs +++ b/src/librustc/middle/trans/callee.rs @@ -356,9 +356,7 @@ pub fn trans_method_call(in_cx: block, origin) } None => { - cx.tcx().sess.span_bug(call_ex.span, - ~"method call expr wasn't in \ - method map") + cx.tcx().sess.span_bug(call_ex.span, "method call expr wasn't in method map") } } }, diff --git a/src/librustc/middle/trans/consts.rs b/src/librustc/middle/trans/consts.rs index c6c5561854c..9d04905bcc9 100644 --- a/src/librustc/middle/trans/consts.rs +++ b/src/librustc/middle/trans/consts.rs @@ -58,8 +58,7 @@ pub fn const_lit(cx: @CrateContext, e: @ast::expr, lit: ast::lit) } _ => { cx.sess.span_bug(lit.span, - ~"floating point literal doesn't have the right \ - type"); + "floating point literal doesn't have the right type"); } } } @@ -281,7 +280,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef { else { llvm::LLVMConstURem(te1, te2) } } ast::and | - ast::or => cx.sess.span_unimpl(e.span, ~"binop logic"), + ast::or => cx.sess.span_unimpl(e.span, "binop logic"), ast::bitxor => llvm::LLVMConstXor(te1, te2), ast::bitand => llvm::LLVMConstAnd(te1, te2), ast::bitor => llvm::LLVMConstOr(te1, te2), @@ -295,7 +294,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef { ast::le | ast::ne | ast::ge | - ast::gt => cx.sess.span_unimpl(e.span, ~"binop comparator") + ast::gt => cx.sess.span_unimpl(e.span, "binop comparator") } } ast::expr_unary(u, e) => { @@ -344,8 +343,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef { const_eval::const_int(i) => i as u64, const_eval::const_uint(u) => u, _ => cx.sess.span_bug(index.span, - ~"index is not an integer-constant \ - expression") + "index is not an integer-constant expression") }; let (arr, len) = match ty::get(bt).sty { ty::ty_evec(_, vstore) | ty::ty_estr(vstore) => @@ -363,12 +361,10 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef { unit_sz)) }, _ => cx.sess.span_bug(base.span, - ~"index-expr base must be \ - fixed-size or slice") + "index-expr base must be fixed-size or slice") }, _ => cx.sess.span_bug(base.span, - ~"index-expr base must be \ - a vector or string type") + "index-expr base must be a vector or string type") }; let len = llvm::LLVMConstIntGetZExtValue(len) as u64; @@ -380,7 +376,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef { // FIXME #3170: report this earlier on in the const-eval // pass. Reporting here is a bit late. cx.sess.span_err(e.span, - ~"const index-expr is out of bounds"); + "const index-expr is out of bounds"); } const_get_elt(cx, arr, [iv as c_uint]) } @@ -454,8 +450,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef { match fs.find(|f| field_ty.ident == f.node.ident) { Some(ref f) => const_expr(cx, (*f).node.expr), None => { - cx.tcx.sess.span_bug( - e.span, ~"missing struct field"); + cx.tcx.sess.span_bug(e.span, "missing struct field"); } } }); @@ -471,8 +466,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef { ast::expr_lit(ref lit) => { match lit.node { ast::lit_str(*) => { const_expr(cx, sub) } - _ => { cx.sess.span_bug(e.span, - ~"bad const-slice lit") } + _ => { cx.sess.span_bug(e.span, "bad const-slice lit") } } } ast::expr_vec(ref es, ast::m_imm) => { @@ -487,8 +481,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef { let p = const_ptrcast(cx, gv, llunitty); C_struct(~[p, sz]) } - _ => cx.sess.span_bug(e.span, - ~"bad const-slice expr") + _ => cx.sess.span_bug(e.span, "bad const-slice expr") } } ast::expr_path(pth) => { @@ -520,8 +513,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef { C_null(llty) } _ => { - cx.sess.span_bug(e.span, ~"expected a const, fn, \ - struct, or variant def") + cx.sess.span_bug(e.span, "expected a const, fn, struct, or variant def") } } } @@ -542,13 +534,12 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef { adt::trans_const(cx, repr, vinfo.disr_val, args.map(|a| const_expr(cx, *a))) } - _ => cx.sess.span_bug(e.span, ~"expected a struct or \ - variant def") + _ => cx.sess.span_bug(e.span, "expected a struct or variant def") } } ast::expr_paren(e) => { return const_expr(cx, e); } _ => cx.sess.span_bug(e.span, - ~"bad constant expression type in consts::const_expr") + "bad constant expression type in consts::const_expr") }; } } diff --git a/src/librustc/middle/trans/datum.rs b/src/librustc/middle/trans/datum.rs index fa27f652ac8..cf5fbb6e216 100644 --- a/src/librustc/middle/trans/datum.rs +++ b/src/librustc/middle/trans/datum.rs @@ -761,8 +761,8 @@ pub impl Datum { match self.try_deref(bcx, expr.id, derefs, false) { (Some(lvres), bcx) => DatumBlock { bcx: bcx, datum: lvres }, (None, _) => { - bcx.ccx().sess.span_bug( - expr.span, ~"Cannot deref this expression"); + bcx.ccx().sess.span_bug(expr.span, + "Cannot deref this expression"); } } } diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index 58fc5ea3be6..b7a1a90741c 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -756,7 +756,7 @@ fn create_ty(cx: @CrateContext, t: ty::t, span: span) } }, ty::ty_enum(_did, ref _substs) => { - cx.sess.span_bug(span, ~"debuginfo for enum NYI") + cx.sess.span_bug(span, "debuginfo for enum NYI") } ty::ty_box(ref mt) | ty::ty_uniq(ref mt) => { let boxed = create_ty(cx, mt.ty, span); @@ -782,7 +782,7 @@ fn create_ty(cx: @CrateContext, t: ty::t, span: span) create_pointer_type(cx, t, span, pointee) }, ty::ty_rptr(ref _region, ref _mt) => { - cx.sess.span_bug(span, ~"debuginfo for rptr NYI") + cx.sess.span_bug(span, "debuginfo for rptr NYI") }, ty::ty_bare_fn(ref barefnty) => { let inputs = do barefnty.sig.inputs.map |a| { a.ty }; @@ -790,10 +790,10 @@ fn create_ty(cx: @CrateContext, t: ty::t, span: span) create_fn_ty(cx, t, inputs, output, span) }, ty::ty_closure(ref _closurety) => { - cx.sess.span_bug(span, ~"debuginfo for closure NYI") + cx.sess.span_bug(span, "debuginfo for closure NYI") }, ty::ty_trait(_did, ref _substs, ref _vstore, _) => { - cx.sess.span_bug(span, ~"debuginfo for trait NYI") + cx.sess.span_bug(span, "debuginfo for trait NYI") }, ty::ty_struct(did, ref substs) => { let fields = ty::struct_fields(cx.tcx, did, substs); @@ -860,14 +860,12 @@ pub fn create_local_var(bcx: block, local: @ast::local) let llptr = match bcx.fcx.lllocals.find(&local.node.id) { option::Some(&local_mem(v)) => v, option::Some(_) => { - bcx.tcx().sess.span_bug(local.span, ~"local is bound to \ - something weird"); + bcx.tcx().sess.span_bug(local.span, "local is bound to something weird"); } option::None => { match *bcx.fcx.lllocals.get(&local.node.pat.id) { local_imm(v) => v, - _ => bcx.tcx().sess.span_bug(local.span, ~"local is bound to \ - something weird") + _ => bcx.tcx().sess.span_bug(local.span, "local is bound to something weird") } } }; @@ -966,8 +964,7 @@ pub fn create_function(fcx: fn_ctxt) -> @Metadata { ast::item_fn(ref decl, _, _, _, _) => { (item.ident, decl.output, item.id) } - _ => fcx.ccx.sess.span_bug(item.span, ~"create_function: item \ - bound to non-function") + _ => fcx.ccx.sess.span_bug(item.span, "create_function: item bound to non-function") } } ast_map::node_method(method, _, _) => { @@ -979,12 +976,10 @@ pub fn create_function(fcx: fn_ctxt) -> @Metadata { ((dbg_cx.names)(~"fn"), decl.output, expr.id) } _ => fcx.ccx.sess.span_bug(expr.span, - ~"create_function: \ - expected an expr_fn_block here") + "create_function: expected an expr_fn_block here") } } - _ => fcx.ccx.sess.bug(~"create_function: unexpected \ - sort of node") + _ => fcx.ccx.sess.bug("create_function: unexpected sort of node") }; debug!("%?", ident); diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs index ae510ae6d11..7cdd7c3799e 100644 --- a/src/librustc/middle/trans/expr.rs +++ b/src/librustc/middle/trans/expr.rs @@ -690,7 +690,7 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr, } _ => { bcx.tcx().sess.span_bug(expr.span, - ~"expr_cast of non-trait"); + "expr_cast of non-trait"); } } } @@ -700,8 +700,7 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr, _ => { bcx.tcx().sess.span_bug( expr.span, - fmt!("trans_rvalue_dps_unadjusted reached \ - fall-through case: %?", + fmt!("trans_rvalue_dps_unadjusted reached fall-through case: %?", expr.node)); } } @@ -1202,7 +1201,7 @@ fn trans_rec_or_struct(bcx: block, } None => { tcx.sess.span_bug(field.span, - ~"Couldn't find field in struct type") + "Couldn't find field in struct type") } } }; @@ -1478,7 +1477,7 @@ fn trans_eager_binop(bcx: block, } else { if !ty::type_is_scalar(rhs_t) { bcx.tcx().sess.span_bug(binop_expr.span, - ~"non-scalar comparison"); + "non-scalar comparison"); } let cmpr = base::compare_scalar_types(bcx, lhs, rhs, rhs_t, op); bcx = cmpr.bcx; @@ -1486,7 +1485,7 @@ fn trans_eager_binop(bcx: block, } } _ => { - bcx.tcx().sess.span_bug(binop_expr.span, ~"unexpected binop"); + bcx.tcx().sess.span_bug(binop_expr.span, "unexpected binop"); } }; diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs index c45ba64c584..0e2bf80cc5e 100644 --- a/src/librustc/middle/trans/foreign.rs +++ b/src/librustc/middle/trans/foreign.rs @@ -1080,7 +1080,7 @@ pub fn trans_intrinsic(ccx: @CrateContext, _ => { // Could we make this an enum rather than a string? does it get // checked earlier? - ccx.sess.span_bug(item.span, ~"unknown intrinsic"); + ccx.sess.span_bug(item.span, "unknown intrinsic"); } } build_return(bcx); diff --git a/src/librustc/middle/trans/monomorphize.rs b/src/librustc/middle/trans/monomorphize.rs index aa49915d175..2640dab1c04 100644 --- a/src/librustc/middle/trans/monomorphize.rs +++ b/src/librustc/middle/trans/monomorphize.rs @@ -160,7 +160,7 @@ pub fn monomorphic_fn(ccx: @CrateContext, // causing an infinite expansion. if depth > 30 { ccx.sess.span_fatal( - span, ~"overly deep expansion of inlined function"); + span, "overly deep expansion of inlined function"); } ccx.monomorphizing.insert(fn_id, depth + 1); diff --git a/src/librustc/middle/trans/reachable.rs b/src/librustc/middle/trans/reachable.rs index 234473dd35b..f301a7d2973 100644 --- a/src/librustc/middle/trans/reachable.rs +++ b/src/librustc/middle/trans/reachable.rs @@ -170,11 +170,13 @@ fn traverse_inline_body(cx: &ctx, body: &blk) { expr_path(_) => { match cx.tcx.def_map.find(&e.id) { Some(&d) => { - traverse_def_id(cx, def_id_of_def(d)); + traverse_def_id(cx, def_id_of_def(d)); } - None => cx.tcx.sess.span_bug(e.span, fmt!("Unbound node \ - id %? while traversing %s", e.id, - expr_to_str(e, cx.tcx.sess.intr()))) + None => cx.tcx.sess.span_bug( + e.span, + fmt!("Unbound node id %? while traversing %s", + e.id, + expr_to_str(e, cx.tcx.sess.intr()))) } } expr_field(_, _, _) => { diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs index da1cdfa4db1..e8075c1f2ad 100644 --- a/src/librustc/middle/trans/tvec.rs +++ b/src/librustc/middle/trans/tvec.rs @@ -469,7 +469,7 @@ pub fn write_content(bcx: block, } _ => { bcx.tcx().sess.span_bug(content_expr.span, - ~"Unexpected evec content"); + "Unexpected evec content"); } } } @@ -503,7 +503,7 @@ pub fn elements_required(bcx: block, content_expr: @ast::expr) -> uint { ty::eval_repeat_count(bcx.tcx(), count_expr) } _ => bcx.tcx().sess.span_bug(content_expr.span, - ~"Unexpected evec content") + "Unexpected evec content") } } diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index ffaa6d46d33..7ef77646f52 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -291,10 +291,8 @@ pub fn ast_ty_to_ty( ty::vstore_fixed(*) => { tcx.sess.span_err( path.span, - ~"@trait, ~trait or &trait \ - are the only supported \ - forms of casting-to-\ - trait"); + "@trait, ~trait or &trait are the only supported \ + forms of casting-to-trait"); ty::BoxTraitStore } }; @@ -321,7 +319,7 @@ pub fn ast_ty_to_ty( if path.types.len() > 0u { tcx.sess.span_err( path.span, - ~"type parameters are not allowed on this type"); + "type parameters are not allowed on this type"); } } @@ -329,7 +327,7 @@ pub fn ast_ty_to_ty( if path.rp.is_some() { tcx.sess.span_err( path.span, - ~"region parameters are not allowed on this type"); + "region parameters are not allowed on this type"); } } } @@ -339,9 +337,8 @@ pub fn ast_ty_to_ty( match tcx.ast_ty_to_ty_cache.find(&ast_ty.id) { Some(&ty::atttce_resolved(ty)) => return ty, Some(&ty::atttce_unresolved) => { - tcx.sess.span_fatal(ast_ty.span, ~"illegal recursive type; \ - insert an enum in the cycle, \ - if this is desired"); + tcx.sess.span_fatal(ast_ty.span, "illegal recursive type; \ + insert an enum in the cycle, if this is desired"); } None => { /* go on */ } } @@ -359,11 +356,9 @@ pub fn ast_ty_to_ty( |tmt| ty::mk_uniq(tcx, tmt)) } ast::ty_vec(ref mt) => { - tcx.sess.span_err(ast_ty.span, - ~"bare `[]` is not a type"); + tcx.sess.span_err(ast_ty.span, "bare `[]` is not a type"); // return /something/ so they can at least get more errors - ty::mk_evec(tcx, ast_mt_to_mt(self, rscope, mt), - ty::vstore_uniq) + ty::mk_evec(tcx, ast_mt_to_mt(self, rscope, mt), ty::vstore_uniq) } ast::ty_ptr(ref mt) => { ty::mk_ptr(tcx, ast_mt_to_mt(self, rscope, mt)) @@ -434,7 +429,7 @@ pub fn ast_ty_to_ty( } ast::ty_str => { tcx.sess.span_err(ast_ty.span, - ~"bare `str` is not a type"); + "bare `str` is not a type"); // return /something/ so they can at least get more errors ty::mk_estr(tcx, ty::vstore_uniq) } @@ -454,7 +449,7 @@ pub fn ast_ty_to_ty( } _ => { tcx.sess.span_fatal(ast_ty.span, - ~"found type name used as a variable"); + "found type name used as a variable"); } } } @@ -470,7 +465,7 @@ pub fn ast_ty_to_ty( ty::vstore_fixed(i as uint)), _ => { tcx.sess.span_fatal( - ast_ty.span, ~"expected constant expr for vector length"); + ast_ty.span, "expected constant expr for vector length"); } } } @@ -489,11 +484,11 @@ pub fn ast_ty_to_ty( // routine. self.tcx().sess.span_bug( ast_ty.span, - ~"found `ty_infer` in unexpected place"); + "found `ty_infer` in unexpected place"); } ast::ty_mac(_) => { tcx.sess.span_bug(ast_ty.span, - ~"found `ty_mac` in unexpected place"); + "found `ty_mac` in unexpected place"); } }; diff --git a/src/librustc/middle/typeck/check/_match.rs b/src/librustc/middle/typeck/check/_match.rs index 5ff71057121..de384d02dc3 100644 --- a/src/librustc/middle/typeck/check/_match.rs +++ b/src/librustc/middle/typeck/check/_match.rs @@ -204,8 +204,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: @ast::pat, path: @ast::Path, if arg_len > 0 { // N-ary variant. if arg_len != subpats_len { - let s = fmt!("this pattern has %u field%s, but the corresponding \ - %s has %u field%s", + let s = fmt!("this pattern has %u field%s, but the corresponding %s has %u field%s", subpats_len, if subpats_len == 1u { ~"" } else { ~"s" }, kind_name, @@ -223,13 +222,12 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: @ast::pat, path: @ast::Path, } } } else if subpats_len > 0 { - tcx.sess.span_err - (pat.span, fmt!("this pattern has %u field%s, but the \ - corresponding %s has no fields", - subpats_len, - if subpats_len == 1u { ~"" } - else { ~"s" }, - kind_name)); + tcx.sess.span_err(pat.span, + fmt!("this pattern has %u field%s, but the corresponding %s has no \ + fields", + subpats_len, + if subpats_len == 1u { "" } else { "s" }, + kind_name)); error_happened = true; } @@ -319,20 +317,19 @@ pub fn check_struct_pat(pcx: &pat_ctxt, pat_id: ast::node_id, span: span, Some(&ast::def_struct(*)) | Some(&ast::def_variant(*)) => { let name = pprust::path_to_str(path, tcx.sess.intr()); tcx.sess.span_err(span, - fmt!("mismatched types: expected `%s` but \ - found `%s`", + fmt!("mismatched types: expected `%s` but found `%s`", fcx.infcx().ty_to_str(expected), name)); } _ => { - tcx.sess.span_bug(span, ~"resolve didn't write in class"); + tcx.sess.span_bug(span, "resolve didn't write in class"); } } // Forbid pattern-matching structs with destructors. if ty::has_dtor(tcx, class_id) { - tcx.sess.span_err(span, ~"deconstructing struct not allowed in \ - pattern (it has a destructor)"); + tcx.sess.span_err(span, "deconstructing struct not allowed in pattern \ + (it has a destructor)"); } check_struct_pat_fields(pcx, span, path, fields, class_fields, class_id, @@ -370,7 +367,7 @@ pub fn check_struct_like_enum_variant_pat(pcx: &pat_ctxt, name)); } _ => { - tcx.sess.span_bug(span, ~"resolve didn't write in variant"); + tcx.sess.span_bug(span, "resolve didn't write in variant"); } } } @@ -404,10 +401,9 @@ pub fn check_pat(pcx: &pat_ctxt, pat: @ast::pat, expected: ty::t) { { // no-op } else if !ty::type_is_numeric(b_ty) { - tcx.sess.span_err(pat.span, ~"non-numeric type used in range"); + tcx.sess.span_err(pat.span, "non-numeric type used in range"); } else if !valid_range_bounds(fcx.ccx, begin, end) { - tcx.sess.span_err(begin.span, ~"lower range bound must be less \ - than upper"); + tcx.sess.span_err(begin.span, "lower range bound must be less than upper"); } fcx.write_ty(pat.id, b_ty); } @@ -476,9 +472,8 @@ pub fn check_pat(pcx: &pat_ctxt, pat: @ast::pat, expected: ty::t) { } _ => { tcx.sess.span_err(pat.span, - fmt!("mismatched types: expected `%s` \ - but found struct", - fcx.infcx().ty_to_str(expected))); + fmt!("mismatched types: expected `%s` but found struct", + fcx.infcx().ty_to_str(expected))); error_happened = true; } } diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index fb5b53d9400..abaadceb053 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -872,7 +872,7 @@ pub impl<'self> LookupContext<'self> { if relevant_candidates.len() > 1 { self.tcx().sess.span_err( self.expr.span, - ~"multiple applicable methods in scope"); + "multiple applicable methods in scope"); for uint::range(0, relevant_candidates.len()) |idx| { self.report_candidate(idx, &relevant_candidates[idx].origin); } @@ -983,12 +983,12 @@ pub impl<'self> LookupContext<'self> { } else if num_method_tps == 0u { tcx.sess.span_err( self.expr.span, - ~"this method does not take type parameters"); + "this method does not take type parameters"); self.fcx.infcx().next_ty_vars(num_method_tps) } else if num_supplied_tps != num_method_tps { tcx.sess.span_err( self.expr.span, - ~"incorrect number of type \ + "incorrect number of type \ parameters given for this method"); self.fcx.infcx().next_ty_vars(num_method_tps) } else { @@ -1082,14 +1082,14 @@ pub impl<'self> LookupContext<'self> { if ty::type_has_self(method_fty) { self.tcx().sess.span_err( self.expr.span, - ~"cannot call a method whose type contains a \ - self-type through a boxed trait"); + "cannot call a method whose type contains a \ + self-type through a boxed trait"); } if candidate.method_ty.generics.has_type_params() { self.tcx().sess.span_err( self.expr.span, - ~"cannot call a generic method through a boxed trait"); + "cannot call a generic method through a boxed trait"); } } @@ -1109,7 +1109,7 @@ pub impl<'self> LookupContext<'self> { if bad { self.tcx().sess.span_err(self.expr.span, - ~"explicit call to destructor"); + "explicit call to destructor"); } } diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index d1c5ae18bc3..69775771d96 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -542,17 +542,15 @@ pub fn check_no_duplicate_fields(tcx: ty::ctxt, let (id, sp) = *p; let orig_sp = field_names.find(&id).map_consume(|x| *x); match orig_sp { - Some(orig_sp) => { - tcx.sess.span_err(sp, fmt!("Duplicate field \ - name %s in record type declaration", - *tcx.sess.str_of(id))); - tcx.sess.span_note(orig_sp, ~"First declaration of \ - this field occurred here"); - break; - } - None => { - field_names.insert(id, sp); - } + Some(orig_sp) => { + tcx.sess.span_err(sp, fmt!("Duplicate field name %s in record type declaration", + *tcx.sess.str_of(id))); + tcx.sess.span_note(orig_sp, "First declaration of this field occurred here"); + break; + } + None => { + field_names.insert(id, sp); + } } } } @@ -1252,8 +1250,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, ty::ty_rptr(_, mt) => formal_ty = mt.ty, ty::ty_err => (), _ => { - fcx.ccx.tcx.sess.span_bug(arg.span, - ~"no ref"); + fcx.ccx.tcx.sess.span_bug(arg.span, "no ref"); } } } @@ -1559,8 +1556,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, match ty::get(lhs_resolved_t).sty { ty::ty_bare_fn(_) | ty::ty_closure(_) => { tcx.sess.span_note( - ex.span, ~"did you forget the `do` keyword \ - for the call?"); + ex.span, "did you forget the `do` keyword for the call?"); } _ => () } @@ -1851,9 +1847,9 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, tcx.sess.span_err(span, fmt!("missing field%s: %s", if missing_fields.len() == 1 { - ~"" + "" } else { - ~"s" + "s" }, str::connect(missing_fields, ~", "))); } @@ -1901,7 +1897,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, } _ => { tcx.sess.span_bug(span, - ~"resolve didn't map this to a class"); + "resolve didn't map this to a class"); } } } else { @@ -1989,7 +1985,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, } _ => { tcx.sess.span_bug(span, - ~"resolve didn't map this to an enum"); + "resolve didn't map this to an enum"); } } } else { @@ -2201,7 +2197,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, } } _ => - tcx.sess.span_bug(expr.span, ~"vstore modifier on non-sequence") + tcx.sess.span_bug(expr.span, "vstore modifier on non-sequence") }; fcx.write_ty(ev.id, typ); fcx.write_ty(id, typ); @@ -2284,21 +2280,18 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, ty::ty_enum(*) => { tcx.sess.span_err( expr.span, - ~"can only dereference enums \ - with a single variant which has a \ - single argument"); + "can only dereference enums with a single variant which \ + has a single argument"); } ty::ty_struct(*) => { tcx.sess.span_err( expr.span, - ~"can only dereference structs with \ - one anonymous field"); + "can only dereference structs with one anonymous field"); } _ => { fcx.type_error_message(expr.span, |actual| { - fmt!("type %s cannot be \ - dereferenced", actual) + fmt!("type %s cannot be dereferenced", actual) }, oprnd_t, None); } } @@ -2394,7 +2387,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, result::Err(_) => { tcx.sess.span_err( expr.span, - ~"`return;` in function returning non-nil"); + "`return;` in function returning non-nil"); } }, Some(e) => { @@ -2758,8 +2751,8 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, variant_id, *fields); } _ => { - tcx.sess.span_bug(path.span, ~"structure constructor does \ - not name a structure type"); + tcx.sess.span_bug(path.span, + "structure constructor does not name a structure type"); } } } @@ -2961,7 +2954,7 @@ pub fn check_block_with_expected(fcx: @mut FnCtxt, } _ => false } { - fcx.ccx.tcx.sess.span_warn(s.span, ~"unreachable statement"); + fcx.ccx.tcx.sess.span_warn(s.span, "unreachable statement"); warned = true; } if ty::type_is_bot(s_ty) { @@ -2982,7 +2975,7 @@ pub fn check_block_with_expected(fcx: @mut FnCtxt, }, Some(e) => { if any_bot && !warned { - fcx.ccx.tcx.sess.span_warn(e.span, ~"unreachable expression"); + fcx.ccx.tcx.sess.span_warn(e.span, "unreachable expression"); } check_expr_with_opt_hint(fcx, e, expected); let ety = fcx.expr_ty(e); @@ -3073,8 +3066,8 @@ pub fn check_enum_variants(ccx: @mut CrateCtxt, *disr_val = val as int; } Ok(_) => { - ccx.tcx.sess.span_err(e.span, ~"expected signed integer \ - constant"); + ccx.tcx.sess.span_err(e.span, "expected signed integer \ + constant"); } Err(ref err) => { ccx.tcx.sess.span_err(e.span, @@ -3085,7 +3078,7 @@ pub fn check_enum_variants(ccx: @mut CrateCtxt, } if vec::contains(*disr_vals, &*disr_val) { ccx.tcx.sess.span_err(v.span, - ~"discriminator value already exists"); + "discriminator value already exists"); } disr_vals.push(*disr_val); let ctor_ty = ty::node_id_to_type(ccx.tcx, v.node.id); @@ -3142,9 +3135,9 @@ pub fn check_enum_variants(ccx: @mut CrateCtxt, _ => false } }) { - ccx.tcx.sess.span_err(sp, ~"illegal recursive enum type; \ - wrap the inner value in a box to \ - make it representable"); + ccx.tcx.sess.span_err(sp, + "illegal recursive enum type; \ + wrap the inner value in a box to make it representable"); } // Check that it is possible to instantiate this enum: @@ -3205,26 +3198,25 @@ pub fn ty_param_bounds_and_ty_for_def(fcx: @mut FnCtxt, ast::def_ty(_) | ast::def_prim_ty(_) | ast::def_ty_param(*)=> { - fcx.ccx.tcx.sess.span_bug(sp, ~"expected value but found type"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value but found type"); } ast::def_mod(*) | ast::def_foreign_mod(*) => { - fcx.ccx.tcx.sess.span_bug(sp, ~"expected value but found module"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value but found module"); } ast::def_use(*) => { - fcx.ccx.tcx.sess.span_bug(sp, ~"expected value but found use"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value but found use"); } ast::def_region(*) => { - fcx.ccx.tcx.sess.span_bug(sp, ~"expected value but found region"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value but found region"); } ast::def_typaram_binder(*) => { - fcx.ccx.tcx.sess.span_bug(sp, ~"expected value but found type \ - parameter"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value but found type parameter"); } ast::def_label(*) => { - fcx.ccx.tcx.sess.span_bug(sp, ~"expected value but found label"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value but found label"); } ast::def_self_ty(*) => { - fcx.ccx.tcx.sess.span_bug(sp, ~"expected value but found self ty"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value but found self ty"); } } } @@ -3253,7 +3245,7 @@ pub fn instantiate_path(fcx: @mut FnCtxt, match tpt.generics.region_param { None => { // ...but the type is not lifetime parameterized! fcx.ccx.tcx.sess.span_err - (span, ~"this item is not region-parameterized"); + (span, "this item is not region-parameterized"); None } Some(_) => { // ...and the type is lifetime parameterized, ok. @@ -3273,15 +3265,15 @@ pub fn instantiate_path(fcx: @mut FnCtxt, fcx.infcx().next_ty_vars(ty_param_count) } else if ty_param_count == 0 { fcx.ccx.tcx.sess.span_err - (span, ~"this item does not take type parameters"); + (span, "this item does not take type parameters"); fcx.infcx().next_ty_vars(ty_param_count) } else if ty_substs_len > ty_param_count { fcx.ccx.tcx.sess.span_err - (span, ~"too many type parameters provided for this item"); + (span, "too many type parameters provided for this item"); fcx.infcx().next_ty_vars(ty_param_count) } else if ty_substs_len < ty_param_count { fcx.ccx.tcx.sess.span_err - (span, ~"not enough type parameters provided for this item"); + (span, "not enough type parameters provided for this item"); fcx.infcx().next_ty_vars(ty_param_count) } else { pth.types.map(|aty| fcx.to_ty(*aty)) diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs index cb2b854276d..3a38d0b1d7b 100644 --- a/src/librustc/middle/typeck/check/regionck.rs +++ b/src/librustc/middle/typeck/check/regionck.rs @@ -490,13 +490,13 @@ fn constrain_auto_ref(rcx: @mut Rcx, expr: @ast::expr) { // reporting an error would be the correct path. tcx.sess.span_err( expr.span, - ~"lifetime of borrowed pointer does not include \ - the expression being borrowed"); + "lifetime of borrowed pointer does not include \ + the expression being borrowed"); note_and_explain_region( tcx, - ~"lifetime of the borrowed pointer is", + "lifetime of the borrowed pointer is", region, - ~""); + ""); rcx.errors_reported += 1; } } @@ -522,17 +522,17 @@ fn constrain_free_variables( result::Err(_) => { tcx.sess.span_err( freevar.span, - ~"captured variable does not outlive the enclosing closure"); + "captured variable does not outlive the enclosing closure"); note_and_explain_region( tcx, - ~"captured variable is valid for ", + "captured variable is valid for ", en_region, - ~""); + ""); note_and_explain_region( tcx, - ~"closure is valid for ", + "closure is valid for ", region, - ~""); + ""); } } } diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc/middle/typeck/check/vtable.rs index 44b62122612..532638faa68 100644 --- a/src/librustc/middle/typeck/check/vtable.rs +++ b/src/librustc/middle/typeck/check/vtable.rs @@ -414,7 +414,7 @@ fn lookup_vtable(vcx: &VtableContext, if !is_early { vcx.tcx().sess.span_err( location_info.span, - ~"multiple applicable methods in scope"); + "multiple applicable methods in scope"); } return Some(/*bad*/copy found[0]); } diff --git a/src/librustc/middle/typeck/coherence.rs b/src/librustc/middle/typeck/coherence.rs index 05b2f6f577b..7fff756b01d 100644 --- a/src/librustc/middle/typeck/coherence.rs +++ b/src/librustc/middle/typeck/coherence.rs @@ -76,10 +76,8 @@ pub fn get_base_type(inference_context: @mut InferCtxt, } _ => { inference_context.tcx.sess.span_fatal(span, - ~"the type of this value \ - must be known in order \ - to determine the base \ - type"); + "the type of this value must be known in order \ + to determine the base type"); } } @@ -257,9 +255,8 @@ pub impl CoherenceChecker { None => { let session = self.crate_context.tcx.sess; session.span_err(item.span, - ~"no base type found for inherent \ - implementation; implement a \ - trait or new type instead"); + "no base type found for inherent implementation; \ + implement a trait or new type instead"); } Some(_) => { // Nothing to do. @@ -483,11 +480,9 @@ pub impl CoherenceChecker { if self.polytypes_unify(polytype_a, polytype_b) { let session = self.crate_context.tcx.sess; session.span_err(self.span_of_impl(implementation_b), - ~"conflicting implementations for a \ - trait"); + "conflicting implementations for a trait"); session.span_note(self.span_of_impl(implementation_a), - ~"note conflicting implementation \ - here"); + "note conflicting implementation here"); } } } @@ -667,11 +662,9 @@ pub impl CoherenceChecker { // This is an error. let session = self.crate_context.tcx.sess; session.span_err(item.span, - ~"cannot associate methods with \ - a type outside the crate the \ - type is defined in; define \ - and implement a trait or new \ - type instead"); + "cannot associate methods with a type outside the \ + crate the type is defined in; define and implement \ + a trait or new type instead"); } } item_impl(_, Some(trait_ref), _, _) => { @@ -690,10 +683,8 @@ pub impl CoherenceChecker { if trait_def_id.crate != local_crate { let session = self.crate_context.tcx.sess; session.span_err(item.span, - ~"cannot provide an \ - extension implementation \ - for a trait not defined \ - in this crate"); + "cannot provide an extension implementation \ + for a trait not defined in this crate"); } } @@ -765,7 +756,7 @@ pub impl CoherenceChecker { None => { self.crate_context.tcx.sess.span_bug( original_type.span, - ~"resolve didn't resolve this type?!"); + "resolve didn't resolve this type?!"); } Some(&node_item(item, _)) => { match item.node { @@ -849,8 +840,7 @@ pub impl CoherenceChecker { } _ => { self.crate_context.tcx.sess.span_bug(item.span, - ~"can't convert a \ - non-impl to an impl"); + "can't convert a non-impl to an impl"); } } } @@ -862,9 +852,8 @@ pub impl CoherenceChecker { return item.span; } _ => { - self.crate_context.tcx.sess.bug(~"span_of_impl() called on \ - something that wasn't an \ - impl!"); + self.crate_context.tcx.sess.bug("span_of_impl() called on something that \ + wasn't an impl!"); } } } @@ -1045,17 +1034,16 @@ pub impl CoherenceChecker { match tcx.items.find(&impl_info.did.node) { Some(&ast_map::node_item(@ref item, _)) => { tcx.sess.span_err((*item).span, - ~"the Drop trait may only \ - be implemented on \ - structures"); + "the Drop trait may only be implemented on \ + structures"); } _ => { - tcx.sess.bug(~"didn't find impl in ast map"); + tcx.sess.bug("didn't find impl in ast map"); } } } else { - tcx.sess.bug(~"found external impl of Drop trait on \ - something other than a struct"); + tcx.sess.bug("found external impl of Drop trait on \ + something other than a struct"); } } } diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index 10537711b32..45d61bb7357 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -151,7 +151,7 @@ impl AstConv for CrateCtxt { fn ty_infer(&self, span: span) -> ty::t { self.tcx.sess.span_bug(span, - ~"found `ty_infer` in unexpected place"); + "found `ty_infer` in unexpected place"); } } @@ -416,8 +416,7 @@ pub fn ensure_supertraits(ccx: &CrateCtxt, if ty_trait_refs.any(|other_trait| other_trait.def_id == trait_ref.def_id) { // This means a trait inherited from the same supertrait more // than once. - tcx.sess.span_err(sp, ~"Duplicate supertrait in trait \ - declaration"); + tcx.sess.span_err(sp, "Duplicate supertrait in trait declaration"); break; } else { ty_trait_refs.push(trait_ref); diff --git a/src/librustc/middle/typeck/infer/region_inference.rs b/src/librustc/middle/typeck/infer/region_inference.rs index e12a3f2e975..25e65d7a18b 100644 --- a/src/librustc/middle/typeck/infer/region_inference.rs +++ b/src/librustc/middle/typeck/infer/region_inference.rs @@ -1587,9 +1587,9 @@ pub impl RegionVarBindings { note_and_explain_region( self.tcx, - ~"first, the lifetime cannot outlive ", + "first, the lifetime cannot outlive ", upper_bound.region, - ~"..."); + "..."); self.tcx.sess.span_note( upper_bound.span, @@ -1597,9 +1597,9 @@ pub impl RegionVarBindings { note_and_explain_region( self.tcx, - ~"but, the lifetime must be valid for ", + "but, the lifetime must be valid for ", lower_bound.region, - ~"..."); + "..."); self.tcx.sess.span_note( lower_bound.span, diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc/middle/typeck/mod.rs index b0e0b7319ac..0012eb70030 100644 --- a/src/librustc/middle/typeck/mod.rs +++ b/src/librustc/middle/typeck/mod.rs @@ -214,7 +214,7 @@ pub fn lookup_def_tcx(tcx: ty::ctxt, sp: span, id: ast::node_id) -> ast::def { match tcx.def_map.find(&id) { Some(&x) => x, _ => { - tcx.sess.span_fatal(sp, ~"internal error looking up a definition") + tcx.sess.span_fatal(sp, "internal error looking up a definition") } } } @@ -301,8 +301,7 @@ fn check_main_fn_ty(ccx: @mut CrateCtxt, if ps.is_parameterized() => { tcx.sess.span_err( main_span, - ~"main function is not allowed \ - to have type parameters"); + "main function is not allowed to have type parameters"); return; } _ => () @@ -343,8 +342,7 @@ fn check_start_fn_ty(ccx: @mut CrateCtxt, if ps.is_parameterized() => { tcx.sess.span_err( start_span, - ~"start function is not allowed to have type \ - parameters"); + "start function is not allowed to have type parameters"); return; } _ => () diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 1c03ad13759..db4912d2131 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -342,7 +342,7 @@ pub fn expr_to_str(cx: @ext_ctxt, expr: @ast::expr, err_msg: ~str) -> ~str { pub fn expr_to_ident(cx: @ext_ctxt, expr: @ast::expr, - err_msg: ~str) -> ast::ident { + err_msg: &str) -> ast::ident { match expr.node { ast::expr_path(p) => { if vec::len(p.types) > 0u || vec::len(p.idents) != 1u { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 8459fc8c627..5ae101a567c 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -308,22 +308,22 @@ pub impl Parser { } return copy self.buffer[(*self.buffer_start + dist - 1) & 3].tok; } - fn fatal(&self, m: ~str) -> ! { + fn fatal(&self, m: &str) -> ! { self.sess.span_diagnostic.span_fatal(*copy self.span, m) } - fn span_fatal(&self, sp: span, m: ~str) -> ! { + fn span_fatal(&self, sp: span, m: &str) -> ! { self.sess.span_diagnostic.span_fatal(sp, m) } - fn span_note(&self, sp: span, m: ~str) { + fn span_note(&self, sp: span, m: &str) { self.sess.span_diagnostic.span_note(sp, m) } - fn bug(&self, m: ~str) -> ! { + fn bug(&self, m: &str) -> ! { self.sess.span_diagnostic.span_bug(*copy self.span, m) } - fn warn(&self, m: ~str) { + fn warn(&self, m: &str) { self.sess.span_diagnostic.span_warn(*copy self.span, m) } - fn span_err(&self, sp: span, m: ~str) { + fn span_err(&self, sp: span, m: &str) { self.sess.span_diagnostic.span_err(sp, m) } fn abort_if_errors(&self) { @@ -2029,8 +2029,7 @@ pub impl Parser { // This is a 'continue' expression if opt_ident.is_some() { self.span_err(*self.last_span, - ~"a label may not be used with a `loop` \ - expression"); + "a label may not be used with a `loop` expression"); } let lo = self.span.lo; @@ -2167,7 +2166,7 @@ pub impl Parser { @ast::pat { node: pat_wild, _ } => (), @ast::pat { node: pat_ident(_, _, _), _ } => (), @ast::pat { span, _ } => self.span_fatal( - span, ~"expected an identifier or `_`" + span, "expected an identifier or `_`" ) } slice = Some(subpat); @@ -2459,7 +2458,7 @@ pub impl Parser { -> ast::pat_ { if !is_plain_ident(&*self.token) { self.span_fatal(*self.last_span, - ~"expected identifier, found path"); + "expected identifier, found path"); } // why a path here, and not just an identifier? let name = self.parse_path_without_tps(); @@ -2478,7 +2477,7 @@ pub impl Parser { if *self.token == token::LPAREN { self.span_fatal( *self.last_span, - ~"expected identifier, found enum pattern"); + "expected identifier, found enum pattern"); } pat_ident(binding_mode, name, sub) @@ -2609,19 +2608,19 @@ pub impl Parser { match self.parse_item_or_view_item(/*bad*/ copy item_attrs, false) { - iovi_item(i) => { - let hi = i.span.hi; - let decl = @spanned(lo, hi, decl_item(i)); - return @spanned(lo, hi, stmt_decl(decl, self.get_id())); - } - iovi_view_item(vi) => { - self.span_fatal(vi.span, ~"view items must be declared at \ - the top of the block"); - } - iovi_foreign_item(_) => { - self.fatal(~"foreign items are not allowed here"); - } - iovi_none() => { /* fallthrough */ } + iovi_item(i) => { + let hi = i.span.hi; + let decl = @spanned(lo, hi, decl_item(i)); + return @spanned(lo, hi, stmt_decl(decl, self.get_id())); + } + iovi_view_item(vi) => { + self.span_fatal(vi.span, + "view items must be declared at the top of the block"); + } + iovi_foreign_item(_) => { + self.fatal(~"foreign items are not allowed here"); + } + iovi_none() => { /* fallthrough */ } } check_expected_item(self, item_attrs); @@ -2822,8 +2821,7 @@ pub impl Parser { result.push(RegionTyParamBound); } else { self.span_err(*self.span, - ~"`'static` is the only permissible \ - region bound here"); + "`'static` is the only permissible region bound here"); } self.bump(); } @@ -3238,7 +3236,7 @@ pub impl Parser { }) } _ => { - self.span_err(*self.span, ~"not a trait"); + self.span_err(*self.span, "not a trait"); None } }; @@ -3467,9 +3465,8 @@ pub impl Parser { ) { iovi_item(item) => items.push(item), iovi_view_item(view_item) => { - self.span_fatal(view_item.span, ~"view items must be \ - declared at the top of the \ - module"); + self.span_fatal(view_item.span, "view items must be declared at the top of the \ + module"); } _ => { self.fatal( @@ -3762,7 +3759,7 @@ pub impl Parser { } if opt_abis.is_some() { - self.span_err(*self.span, ~"an ABI may not be specified here"); + self.span_err(*self.span, "an ABI may not be specified here"); } // extern mod foo; @@ -4397,9 +4394,7 @@ pub impl Parser { view_item_extern_mod(*) if !extern_mod_allowed => { self.span_err(view_item.span, - ~"\"extern mod\" \ - declarations are not \ - allowed here"); + "\"extern mod\" declarations are not allowed here"); } view_item_extern_mod(*) => {} } @@ -4425,8 +4420,7 @@ pub impl Parser { iovi_none => break, iovi_view_item(view_item) => { self.span_err(view_item.span, - ~"`use` and `extern mod` declarations \ - must precede items"); + "`use` and `extern mod` declarations must precede items"); } iovi_item(item) => { items.push(item) @@ -4461,8 +4455,7 @@ pub impl Parser { iovi_view_item(view_item) => { // I think this can't occur: self.span_err(view_item.span, - ~"`use` and `extern mod` declarations \ - must precede items"); + "`use` and `extern mod` declarations must precede items"); } iovi_item(_) => { // FIXME #5668: this will occur for a macro invocation: -- cgit 1.4.1-3-g733a5 From 1a5f11a11b1b12f74fdb9e81b6c428901913246f Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Fri, 3 May 2013 16:20:24 -0700 Subject: syntax: Warning police --- src/libsyntax/parse/parser.rs | 6 +++--- src/libsyntax/syntax.rc | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src/libsyntax/parse/parser.rs') diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 5ae101a567c..a6528160398 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -932,8 +932,8 @@ pub impl Parser { loop { match *self.token { token::MOD_SEP => { - match self.look_ahead(1u) { - token::IDENT(id,_) => { + match self.look_ahead(1) { + token::IDENT(*) => { self.bump(); ids.push(self.parse_ident()); } @@ -3693,7 +3693,7 @@ pub impl Parser { items: _, foreign_items: foreign_items } = self.parse_foreign_items(first_item_attrs, true); - let mut initial_attrs = attrs_remaining; + let _initial_attrs = attrs_remaining; assert!(*self.token == token::RBRACE); ast::foreign_mod { sort: sort, diff --git a/src/libsyntax/syntax.rc b/src/libsyntax/syntax.rc index a401d9eb8ac..cea3b20e97e 100644 --- a/src/libsyntax/syntax.rc +++ b/src/libsyntax/syntax.rc @@ -22,7 +22,6 @@ #[allow(vecs_implicitly_copyable)]; #[allow(non_camel_case_types)]; -#[deny(deprecated_mode)]; #[deny(deprecated_pattern)]; extern mod std(vers = "0.7-pre"); -- cgit 1.4.1-3-g733a5