Skip to content

Commit ba8fe12

Browse files
committed
Revert "De-share ast::Ty"
This reverts commit 47eca21.
1 parent 44808fc commit ba8fe12

28 files changed

+263
-264
lines changed

src/librustc/front/config.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ fn fold_foreign_mod(
9696
fn fold_item_underscore(cx: @Context, item: &ast::item_,
9797
fld: @fold::ast_fold) -> ast::item_ {
9898
let item = match *item {
99-
ast::item_impl(ref a, ref b, ref c, ref methods) => {
99+
ast::item_impl(ref a, ref b, c, ref methods) => {
100100
let methods = methods.iter().filter(|m| method_in_cfg(cx, **m))
101101
.transform(|x| *x).collect();
102-
ast::item_impl((*a).clone(), (*b).clone(), (*c).clone(), methods)
102+
ast::item_impl((*a).clone(), (*b).clone(), c, methods)
103103
}
104104
ast::item_trait(ref a, ref b, ref methods) => {
105105
let methods = methods.iter().filter(|m| trait_method_in_cfg(cx, *m) )

src/librustc/metadata/tydecode.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ fn parse_substs(st: &mut PState, conv: conv_did) -> ty::substs {
202202
};
203203
}
204204

205-
fn parse_region_substs(st: &mut PState, conv: conv_did) -> ty::RegionSubsts {
205+
fn parse_region_substs(st: &mut PState, _conv: conv_did) -> ty::RegionSubsts {
206206
match next(st) {
207207
'e' => ty::ErasedRegions,
208208
'n' => {

src/librustc/middle/kind.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ fn check_item(item: @item, (cx, visitor): (Context, visit::vt<Context>)) {
116116
// If this is a destructor, check kinds.
117117
if !attr::contains_name(item.attrs, "unsafe_destructor") {
118118
match item.node {
119-
item_impl(_, Some(ref trait_ref), ref self_type, _) => {
119+
item_impl(_, Some(ref trait_ref), self_type, _) => {
120120
match cx.tcx.def_map.find(&trait_ref.ref_id) {
121121
None => cx.tcx.sess.bug("trait ref not in def map!"),
122122
Some(&trait_def) => {
@@ -313,7 +313,7 @@ pub fn check_expr(e: @expr, (cx, v): (Context, visit::vt<Context>)) {
313313
visit::visit_expr(e, (cx, v));
314314
}
315315

316-
fn check_ty(aty: &Ty, (cx, v): (Context, visit::vt<Context>)) {
316+
fn check_ty(aty: @Ty, (cx, v): (Context, visit::vt<Context>)) {
317317
match aty.node {
318318
ty_path(_, _, id) => {
319319
let r = cx.tcx.node_type_substs.find(&id);

src/librustc/middle/lint.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -707,9 +707,9 @@ fn check_item_ctypes(cx: &Context, it: &ast::item) {
707707

708708
fn check_foreign_fn(cx: &Context, decl: &ast::fn_decl) {
709709
for decl.inputs.iter().advance |in| {
710-
check_ty(cx, &in.ty);
710+
check_ty(cx, in.ty);
711711
}
712-
check_ty(cx, &decl.output)
712+
check_ty(cx, decl.output)
713713
}
714714

715715
match it.node {
@@ -719,7 +719,7 @@ fn check_item_ctypes(cx: &Context, it: &ast::item) {
719719
ast::foreign_item_fn(ref decl, _, _) => {
720720
check_foreign_fn(cx, decl);
721721
}
722-
ast::foreign_item_static(ref t, _) => { check_ty(cx, t); }
722+
ast::foreign_item_static(t, _) => { check_ty(cx, t); }
723723
}
724724
}
725725
}

src/librustc/middle/region.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -714,10 +714,10 @@ fn determine_rp_in_fn(fk: &visit::fn_kind,
714714
do cx.with(cx.item_id, false) {
715715
do cx.with_ambient_variance(rv_contravariant) {
716716
for decl.inputs.iter().advance |a| {
717-
(visitor.visit_ty)(&a.ty, (cx, visitor));
717+
(visitor.visit_ty)(a.ty, (cx, visitor));
718718
}
719719
}
720-
(visitor.visit_ty)(&decl.output, (cx, visitor));
720+
(visitor.visit_ty)(decl.output, (cx, visitor));
721721
let generics = visit::generics_of_fn(fk);
722722
(visitor.visit_generics)(&generics, (cx, visitor));
723723
(visitor.visit_block)(body, (cx, visitor));
@@ -732,7 +732,7 @@ fn determine_rp_in_ty_method(ty_m: &ast::ty_method,
732732
}
733733
}
734734

735-
fn determine_rp_in_ty(ty: &ast::Ty,
735+
fn determine_rp_in_ty(ty: @ast::Ty,
736736
(cx, visitor): (@mut DetermineRpCtxt,
737737
visit::vt<@mut DetermineRpCtxt>)) {
738738
// we are only interested in types that will require an item to
@@ -816,16 +816,16 @@ fn determine_rp_in_ty(ty: &ast::Ty,
816816
}
817817

818818
match ty.node {
819-
ast::ty_box(ref mt) | ast::ty_uniq(ref mt) | ast::ty_vec(ref mt) |
820-
ast::ty_rptr(_, ref mt) | ast::ty_ptr(ref mt) => {
819+
ast::ty_box(mt) | ast::ty_uniq(mt) | ast::ty_vec(mt) |
820+
ast::ty_rptr(_, mt) | ast::ty_ptr(mt) => {
821821
visit_mt(mt, (cx, visitor));
822822
}
823823

824824
ast::ty_path(ref path, _, _) => {
825825
// type parameters are---for now, anyway---always invariant
826826
do cx.with_ambient_variance(rv_invariant) {
827827
for path.types.iter().advance |tp| {
828-
(visitor.visit_ty)(tp, (cx, visitor));
828+
(visitor.visit_ty)(*tp, (cx, visitor));
829829
}
830830
}
831831
}
@@ -838,10 +838,10 @@ fn determine_rp_in_ty(ty: &ast::Ty,
838838
// parameters are contravariant
839839
do cx.with_ambient_variance(rv_contravariant) {
840840
for decl.inputs.iter().advance |a| {
841-
(visitor.visit_ty)(&a.ty, (cx, visitor));
841+
(visitor.visit_ty)(a.ty, (cx, visitor));
842842
}
843843
}
844-
(visitor.visit_ty)(&decl.output, (cx, visitor));
844+
(visitor.visit_ty)(decl.output, (cx, visitor));
845845
}
846846
}
847847

@@ -850,7 +850,7 @@ fn determine_rp_in_ty(ty: &ast::Ty,
850850
}
851851
}
852852

853-
fn visit_mt(mt: &ast::mt,
853+
fn visit_mt(mt: ast::mt,
854854
(cx, visitor): (@mut DetermineRpCtxt,
855855
visit::vt<@mut DetermineRpCtxt>)) {
856856
// mutability is invariant

src/librustc/middle/resolve.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,7 @@ impl Resolver {
12161216
visit_item(item, (new_parent, visitor));
12171217
}
12181218

1219-
item_impl(_, None, ref ty, ref methods) => {
1219+
item_impl(_, None, ty, ref methods) => {
12201220
// If this implements an anonymous trait, then add all the
12211221
// methods within to a new module, if the type was defined
12221222
// within this module.
@@ -1226,8 +1226,8 @@ impl Resolver {
12261226
// the same module that declared the type.
12271227

12281228
// Create the module and add all methods.
1229-
match ty {
1230-
&Ty {
1229+
match *ty {
1230+
Ty {
12311231
node: ty_path(ref path, _, _),
12321232
_
12331233
} if path.idents.len() == 1 => {
@@ -1296,7 +1296,7 @@ impl Resolver {
12961296
visit_item(item, (parent, visitor));
12971297
}
12981298

1299-
item_impl(_, Some(_), _, _) => {
1299+
item_impl(_, Some(_), _ty, ref _methods) => {
13001300
visit_item(item, (parent, visitor));
13011301
}
13021302

@@ -3517,7 +3517,7 @@ impl Resolver {
35173517

35183518
item_impl(ref generics,
35193519
ref implemented_traits,
3520-
ref self_type,
3520+
self_type,
35213521
ref methods) => {
35223522
self.resolve_implementation(item.id,
35233523
generics,
@@ -3568,10 +3568,10 @@ impl Resolver {
35683568
visitor);
35693569

35703570
for ty_m.decl.inputs.iter().advance |argument| {
3571-
self.resolve_type(&argument.ty, visitor);
3571+
self.resolve_type(argument.ty, visitor);
35723572
}
35733573

3574-
self.resolve_type(&ty_m.decl.output, visitor);
3574+
self.resolve_type(ty_m.decl.output, visitor);
35753575
}
35763576
}
35773577
provided(m) => {
@@ -3761,12 +3761,12 @@ impl Resolver {
37613761
None,
37623762
visitor);
37633763

3764-
self.resolve_type(&argument.ty, visitor);
3764+
self.resolve_type(argument.ty, visitor);
37653765

37663766
debug!("(resolving function) recorded argument");
37673767
}
37683768

3769-
self.resolve_type(&declaration.output, visitor);
3769+
self.resolve_type(declaration.output, visitor);
37703770
}
37713771
}
37723772

@@ -3863,7 +3863,7 @@ impl Resolver {
38633863

38643864
// Resolve fields.
38653865
for fields.iter().advance |field| {
3866-
self.resolve_type(&field.node.ty, visitor);
3866+
self.resolve_type(field.node.ty, visitor);
38673867
}
38683868
}
38693869
}
@@ -3899,7 +3899,7 @@ impl Resolver {
38993899
id: node_id,
39003900
generics: &Generics,
39013901
opt_trait_reference: &Option<trait_ref>,
3902-
self_type: &Ty,
3902+
self_type: @Ty,
39033903
methods: &[@method],
39043904
visitor: ResolveVisitor) {
39053905
// If applicable, create a rib for the type parameters.
@@ -3987,7 +3987,7 @@ impl Resolver {
39873987
let mutability = if local.is_mutbl {Mutable} else {Immutable};
39883988

39893989
// Resolve the type.
3990-
self.resolve_type(&local.ty, visitor);
3990+
self.resolve_type(local.ty, visitor);
39913991

39923992
// Resolve the initializer, if necessary.
39933993
match local.init {
@@ -4098,7 +4098,7 @@ impl Resolver {
40984098
debug!("(resolving block) leaving block");
40994099
}
41004100

4101-
pub fn resolve_type(@mut self, ty: &Ty, visitor: ResolveVisitor) {
4101+
pub fn resolve_type(@mut self, ty: @Ty, visitor: ResolveVisitor) {
41024102
match ty.node {
41034103
// Like path expressions, the interpretation of path types depends
41044104
// on whether the path has multiple elements in it or not.
@@ -4320,7 +4320,7 @@ impl Resolver {
43204320

43214321
// Check the types in the path pattern.
43224322
for path.types.iter().advance |ty| {
4323-
self.resolve_type(ty, visitor);
4323+
self.resolve_type(*ty, visitor);
43244324
}
43254325
}
43264326

@@ -4353,7 +4353,7 @@ impl Resolver {
43534353

43544354
// Check the types in the path pattern.
43554355
for path.types.iter().advance |ty| {
4356-
self.resolve_type(ty, visitor);
4356+
self.resolve_type(*ty, visitor);
43574357
}
43584358
}
43594359

@@ -4382,7 +4382,7 @@ impl Resolver {
43824382

43834383
// Check the types in the path pattern.
43844384
for path.types.iter().advance |ty| {
4385-
self.resolve_type(ty, visitor);
4385+
self.resolve_type(*ty, visitor);
43864386
}
43874387
}
43884388

@@ -4478,7 +4478,7 @@ impl Resolver {
44784478
-> Option<def> {
44794479
// First, resolve the types.
44804480
for path.types.iter().advance |ty| {
4481-
self.resolve_type(ty, visitor);
4481+
self.resolve_type(*ty, visitor);
44824482
}
44834483

44844484
if path.global {

src/librustc/middle/trans/base.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1791,7 +1791,7 @@ pub fn copy_args_to_allocas(fcx: @mut FunctionContext,
17911791
bcx = _match::store_arg(bcx, args[arg_n].pat, llarg);
17921792

17931793
if fcx.ccx.sess.opts.extra_debuginfo && fcx_has_nonzero_span(fcx) {
1794-
debuginfo::create_argument_metadata(bcx, &args[arg_n], args[arg_n].ty.span);
1794+
debuginfo::create_argument_metadata(bcx, args[arg_n], args[arg_n].ty.span);
17951795
}
17961796
}
17971797

@@ -2011,17 +2011,17 @@ pub fn trans_tuple_struct(ccx: @mut CrateContext,
20112011

20122012
trait IdAndTy {
20132013
fn id(&self) -> ast::node_id;
2014-
fn ty<'a>(&'a self) -> &'a ast::Ty;
2014+
fn ty(&self) -> @ast::Ty;
20152015
}
20162016

20172017
impl IdAndTy for ast::variant_arg {
20182018
fn id(&self) -> ast::node_id { self.id }
2019-
fn ty<'a>(&'a self) -> &'a ast::Ty { &self.ty }
2019+
fn ty<'a>(&self) -> @ast::Ty { self.ty }
20202020
}
20212021

20222022
impl IdAndTy for @ast::struct_field {
20232023
fn id(&self) -> ast::node_id { self.node.id }
2024-
fn ty<'a>(&'a self) -> &'a ast::Ty { &self.node.ty }
2024+
fn ty<'a>(&self) -> @ast::Ty { self.node.ty }
20252025
}
20262026

20272027
pub fn trans_enum_variant_or_tuple_like_struct<A:IdAndTy>(
@@ -2036,7 +2036,7 @@ pub fn trans_enum_variant_or_tuple_like_struct<A:IdAndTy>(
20362036
let fn_args = do args.map |varg| {
20372037
ast::arg {
20382038
is_mutbl: false,
2039-
ty: (*varg.ty()).clone(),
2039+
ty: varg.ty(),
20402040
pat: ast_util::ident_to_pat(
20412041
ccx.tcx.sess.next_node_id(),
20422042
codemap::dummy_sp(),

src/librustc/middle/trans/debuginfo.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ pub fn create_local_var_metadata(bcx: @mut Block, local: @ast::Local) -> DIVaria
197197
///
198198
/// Adds the created metadata nodes directly to the crate's IR.
199199
/// The return value should be ignored if called from outside of the debuginfo module.
200-
pub fn create_argument_metadata(bcx: @mut Block, arg: &ast::arg, span: span) -> Option<DIVariable> {
200+
pub fn create_argument_metadata(bcx: @mut Block, arg: ast::arg, span: span) -> Option<DIVariable> {
201201
debug!("create_argument_metadata");
202202
if true {
203203
// XXX create_argument_metadata disabled for now because "node_id_type(bcx, arg.id)" below
@@ -278,9 +278,9 @@ pub fn create_function_metadata(fcx: &FunctionContext) -> DISubprogram {
278278

279279
let fnitem = cx.tcx.items.get_copy(&fcx.id);
280280
let (ident, ret_ty, id) = match fnitem {
281-
ast_map::node_item(ref item, _) => {
281+
ast_map::node_item(item, _) => {
282282
match item.node {
283-
ast::item_fn(ast::fn_decl { output: ref ty, _}, _, _, _, _) => {
283+
ast::item_fn(ast::fn_decl { output: ty, _}, _, _, _, _) => {
284284
(item.ident, ty, item.id)
285285
}
286286
_ => fcx.ccx.sess.span_bug(item.span,
@@ -289,7 +289,7 @@ pub fn create_function_metadata(fcx: &FunctionContext) -> DISubprogram {
289289
}
290290
ast_map::node_method(
291291
@ast::method {
292-
decl: ast::fn_decl { output: ref ty, _ },
292+
decl: ast::fn_decl { output: ty, _ },
293293
id: id,
294294
ident: ident,
295295
_
@@ -302,7 +302,7 @@ pub fn create_function_metadata(fcx: &FunctionContext) -> DISubprogram {
302302
match expr.node {
303303
ast::expr_fn_block(ref decl, _) => {
304304
let name = gensym_name("fn");
305-
(name, &decl.output, expr.id)
305+
(name, decl.output, expr.id)
306306
}
307307
_ => fcx.ccx.sess.span_bug(expr.span,
308308
"create_function_metadata: expected an expr_fn_block here")
@@ -311,7 +311,7 @@ pub fn create_function_metadata(fcx: &FunctionContext) -> DISubprogram {
311311
ast_map::node_trait_method(
312312
@ast::provided(
313313
@ast::method {
314-
decl: ast::fn_decl { output: ref ty, _ },
314+
decl: ast::fn_decl { output: ty, _ },
315315
id: id,
316316
ident: ident,
317317
_

0 commit comments

Comments
 (0)