Skip to content

Commit 83dd0c8

Browse files
committed
---
yaml --- r: 185831 b: refs/heads/auto c: a817c69 h: refs/heads/master i: 185829: 9e0af32 185827: 41542bd 185823: 5c09555 v: v3
1 parent d703a6f commit 83dd0c8

File tree

22 files changed

+75
-102
lines changed

22 files changed

+75
-102
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: 27747ac1a76f054275c75a5b3f867d09cd27c888
13+
refs/heads/auto: a817c69297dc2bfac4029410cc055d32022cea95
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustc/lint/builtin.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ struct ImproperCTypesVisitor<'a, 'tcx: 'a> {
405405
}
406406

407407
impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
408-
fn check_def(&mut self, sp: Span, ty_id: ast::NodeId, path_id: ast::NodeId) {
409-
match self.cx.tcx.def_map.borrow()[path_id].clone() {
408+
fn check_def(&mut self, sp: Span, id: ast::NodeId) {
409+
match self.cx.tcx.def_map.borrow()[id].clone() {
410410
def::DefPrimTy(ast::TyInt(ast::TyIs(_))) => {
411411
self.cx.span_lint(IMPROPER_CTYPES, sp,
412412
"found rust type `isize` in foreign module, while \
@@ -418,7 +418,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
418418
libc::c_uint or libc::c_ulong should be used");
419419
}
420420
def::DefTy(..) => {
421-
let tty = match self.cx.tcx.ast_ty_to_ty_cache.borrow().get(&ty_id) {
421+
let tty = match self.cx.tcx.ast_ty_to_ty_cache.borrow().get(&id) {
422422
Some(&ty::atttce_resolved(t)) => t,
423423
_ => panic!("ast_ty_to_ty_cache was incomplete after typeck!")
424424
};
@@ -437,9 +437,8 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
437437

438438
impl<'a, 'tcx, 'v> Visitor<'v> for ImproperCTypesVisitor<'a, 'tcx> {
439439
fn visit_ty(&mut self, ty: &ast::Ty) {
440-
match ty.node {
441-
ast::TyPath(_, id) => self.check_def(ty.span, ty.id, id),
442-
_ => (),
440+
if let ast::TyPath(_) = ty.node {
441+
self.check_def(ty.span, ty.id);
443442
}
444443
visit::walk_ty(self, ty);
445444
}

branches/auto/src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
12211221
encode_unsafety(rbml_w, unsafety);
12221222
encode_polarity(rbml_w, polarity);
12231223
match ty.node {
1224-
ast::TyPath(ref path, _) if path.segments.len() == 1 => {
1224+
ast::TyPath(ref path) if path.segments.len() == 1 => {
12251225
let ident = path.segments.last().unwrap().identifier;
12261226
encode_impl_type_basename(rbml_w, ident);
12271227
}

branches/auto/src/librustc/middle/astconv_util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ pub fn check_path_args(tcx: &ty::ctxt,
4343
pub fn ast_ty_to_prim_ty<'tcx>(tcx: &ty::ctxt<'tcx>, ast_ty: &ast::Ty)
4444
-> Option<Ty<'tcx>> {
4545
match ast_ty.node {
46-
ast::TyPath(ref path, id) => {
47-
let a_def = match tcx.def_map.borrow().get(&id) {
46+
ast::TyPath(ref path) => {
47+
let a_def = match tcx.def_map.borrow().get(&ast_ty.id) {
4848
None => {
4949
tcx.sess.span_bug(ast_ty.span,
5050
&format!("unbound path {}",

branches/auto/src/librustc/middle/infer/error_reporting.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,8 +1233,8 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
12331233
}
12341234
ty_queue.push(&*mut_ty.ty);
12351235
}
1236-
ast::TyPath(ref path, id) => {
1237-
let a_def = match self.tcx.def_map.borrow().get(&id) {
1236+
ast::TyPath(ref path) => {
1237+
let a_def = match self.tcx.def_map.borrow().get(&cur_ty.id) {
12381238
None => {
12391239
self.tcx
12401240
.sess
@@ -1279,7 +1279,7 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
12791279
let new_path = self.rebuild_path(rebuild_info, lifetime);
12801280
let to = ast::Ty {
12811281
id: cur_ty.id,
1282-
node: ast::TyPath(new_path, id),
1282+
node: ast::TyPath(new_path),
12831283
span: cur_ty.span
12841284
};
12851285
new_ty = self.rebuild_ty(new_ty, P(to));

branches/auto/src/librustc/middle/resolve_lifetime.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,13 @@ impl<'a, 'v> Visitor<'v> for LifetimeContext<'a> {
165165
visit::walk_ty(this, ty);
166166
});
167167
}
168-
ast::TyPath(ref path, id) => {
168+
ast::TyPath(ref path) => {
169169
// if this path references a trait, then this will resolve to
170170
// a trait ref, which introduces a binding scope.
171-
match self.def_map.borrow().get(&id) {
171+
match self.def_map.borrow().get(&ty.id) {
172172
Some(&def::DefTrait(..)) => {
173173
self.with(LateScope(&Vec::new(), self.scope), |_, this| {
174-
this.visit_path(path, id);
174+
this.visit_path(path, ty.id);
175175
});
176176
}
177177
_ => {
@@ -270,16 +270,12 @@ impl<'a, 'v> Visitor<'v> for LifetimeContext<'a> {
270270
for lifetime in &trait_ref.bound_lifetimes {
271271
this.visit_lifetime_def(lifetime);
272272
}
273-
this.visit_trait_ref(&trait_ref.trait_ref)
273+
visit::walk_path(this, &trait_ref.trait_ref.path)
274274
})
275275
} else {
276276
self.visit_trait_ref(&trait_ref.trait_ref)
277277
}
278278
}
279-
280-
fn visit_trait_ref(&mut self, trait_ref: &ast::TraitRef) {
281-
self.visit_path(&trait_ref.path, trait_ref.ref_id);
282-
}
283279
}
284280

285281
impl<'a> LifetimeContext<'a> {

branches/auto/src/librustc_privacy/lib.rs

Lines changed: 27 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
259259
// * Private trait impls for private types can be completely ignored
260260
ast::ItemImpl(_, _, _, _, ref ty, ref impl_items) => {
261261
let public_ty = match ty.node {
262-
ast::TyPath(_, id) => {
263-
match self.tcx.def_map.borrow()[id].clone() {
262+
ast::TyPath(_) => {
263+
match self.tcx.def_map.borrow()[ty.id].clone() {
264264
def::DefPrimTy(..) => true,
265265
def => {
266266
let did = def.def_id();
@@ -326,8 +326,8 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
326326
}
327327

328328
ast::ItemTy(ref ty, _) if public_first => {
329-
if let ast::TyPath(_, id) = ty.node {
330-
match self.tcx.def_map.borrow()[id].clone() {
329+
if let ast::TyPath(_) = ty.node {
330+
match self.tcx.def_map.borrow()[ty.id].clone() {
331331
def::DefPrimTy(..) | def::DefTyParam(..) => {},
332332
def => {
333333
let did = def.def_id();
@@ -628,11 +628,11 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
628628
// back up the chains to find the relevant struct/enum that
629629
// was private.
630630
ast::ItemImpl(_, _, _, _, ref ty, _) => {
631-
let id = match ty.node {
632-
ast::TyPath(_, id) => id,
631+
match ty.node {
632+
ast::TyPath(_) => {}
633633
_ => return Some((err_span, err_msg, None)),
634634
};
635-
let def = self.tcx.def_map.borrow()[id].clone();
635+
let def = self.tcx.def_map.borrow()[ty.id].clone();
636636
let did = def.def_id();
637637
assert!(is_local(did));
638638
match self.tcx.map.get(did.node) {
@@ -716,13 +716,13 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
716716
}
717717

718718
// Checks that a path is in scope.
719-
fn check_path(&mut self, span: Span, path_id: ast::NodeId, path: &ast::Path) {
719+
fn check_path(&mut self, span: Span, path_id: ast::NodeId, last: ast::Ident) {
720720
debug!("privacy - path {}", self.nodestr(path_id));
721721
let orig_def = self.tcx.def_map.borrow()[path_id].clone();
722722
let ck = |tyname: &str| {
723723
let ck_public = |def: ast::DefId| {
724724
debug!("privacy - ck_public {:?}", def);
725-
let name = token::get_ident(path.segments.last().unwrap().identifier);
725+
let name = token::get_ident(last);
726726
let origdid = orig_def.def_id();
727727
self.ensure_public(span,
728728
def,
@@ -832,37 +832,22 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
832832

833833
impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
834834
fn visit_item(&mut self, item: &ast::Item) {
835-
match item.node {
836-
ast::ItemUse(ref vpath) => {
837-
match vpath.node {
838-
ast::ViewPathSimple(..) | ast::ViewPathGlob(..) => {}
839-
ast::ViewPathList(ref prefix, ref list) => {
840-
for pid in list {
841-
match pid.node {
842-
ast::PathListIdent { id, name } => {
843-
debug!("privacy - ident item {}", id);
844-
let seg = ast::PathSegment {
845-
identifier: name,
846-
parameters: ast::PathParameters::none(),
847-
};
848-
let segs = vec![seg];
849-
let path = ast::Path {
850-
global: false,
851-
span: pid.span,
852-
segments: segs,
853-
};
854-
self.check_path(pid.span, id, &path);
855-
}
856-
ast::PathListMod { id } => {
857-
debug!("privacy - mod item {}", id);
858-
self.check_path(pid.span, id, prefix);
859-
}
860-
}
835+
if let ast::ItemUse(ref vpath) = item.node {
836+
if let ast::ViewPathList(ref prefix, ref list) = vpath.node {
837+
for pid in list {
838+
match pid.node {
839+
ast::PathListIdent { id, name } => {
840+
debug!("privacy - ident item {}", id);
841+
self.check_path(pid.span, id, name);
842+
}
843+
ast::PathListMod { id } => {
844+
debug!("privacy - mod item {}", id);
845+
let name = prefix.segments.last().unwrap().identifier;
846+
self.check_path(pid.span, id, name);
861847
}
862848
}
863849
}
864850
}
865-
_ => {}
866851
}
867852
let orig_curitem = replace(&mut self.curitem, item.id);
868853
visit::walk_item(self, item);
@@ -1033,7 +1018,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
10331018
}
10341019

10351020
fn visit_path(&mut self, path: &ast::Path, id: ast::NodeId) {
1036-
self.check_path(path.span, id, path);
1021+
self.check_path(path.span, id, path.segments.last().unwrap().identifier);
10371022
visit::walk_path(self, path);
10381023
}
10391024
}
@@ -1273,8 +1258,8 @@ impl<'a, 'tcx> VisiblePrivateTypesVisitor<'a, 'tcx> {
12731258

12741259
impl<'a, 'b, 'tcx, 'v> Visitor<'v> for CheckTypeForPrivatenessVisitor<'a, 'b, 'tcx> {
12751260
fn visit_ty(&mut self, ty: &ast::Ty) {
1276-
if let ast::TyPath(_, path_id) = ty.node {
1277-
if self.inner.path_is_private_type(path_id) {
1261+
if let ast::TyPath(_) = ty.node {
1262+
if self.inner.path_is_private_type(ty.id) {
12781263
self.contains_private = true;
12791264
// found what we're looking for so let's stop
12801265
// working.
@@ -1398,7 +1383,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for VisiblePrivateTypesVisitor<'a, 'tcx> {
13981383
//
13991384
// Those in 2. are warned via walk_generics and this
14001385
// call here.
1401-
self.visit_trait_ref(tr)
1386+
visit::walk_path(self, &tr.path);
14021387
}
14031388
}
14041389
} else if trait_ref.is_none() && self_is_public_path {
@@ -1479,9 +1464,9 @@ impl<'a, 'tcx, 'v> Visitor<'v> for VisiblePrivateTypesVisitor<'a, 'tcx> {
14791464
}
14801465

14811466
fn visit_ty(&mut self, t: &ast::Ty) {
1482-
if let ast::TyPath(ref p, path_id) = t.node {
1467+
if let ast::TyPath(ref p) = t.node {
14831468
if !self.tcx.sess.features.borrow().visible_private_types &&
1484-
self.path_is_private_type(path_id) {
1469+
self.path_is_private_type(t.id) {
14851470
self.tcx.sess.span_err(p.span,
14861471
"private type in exported type signature");
14871472
}

branches/auto/src/librustc_resolve/build_reduced_graph.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,14 +523,14 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
523523
// within this module.
524524

525525
let mod_name = match ty.node {
526-
TyPath(ref path, _) if path.segments.len() == 1 => {
526+
TyPath(ref path) if path.segments.len() == 1 => {
527527
// FIXME(18446) we should distinguish between the name of
528528
// a trait and the name of an impl of that trait.
529529
Some(path.segments.last().unwrap().identifier.name)
530530
}
531531
TyObjectSum(ref lhs_ty, _) => {
532532
match lhs_ty.node {
533-
TyPath(ref path, _) if path.segments.len() == 1 => {
533+
TyPath(ref path) if path.segments.len() == 1 => {
534534
Some(path.segments.last().unwrap().identifier.name)
535535
}
536536
_ => {

branches/auto/src/librustc_resolve/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3387,8 +3387,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
33873387
// type, the result will be that the type name resolves to a module but not
33883388
// a type (shadowing any imported modules or types with this name), leading
33893389
// to weird user-visible bugs. So we ward this off here. See #15060.
3390-
TyPath(ref path, path_id) => {
3391-
match self.def_map.borrow().get(&path_id) {
3390+
TyPath(ref path) => {
3391+
match self.def_map.borrow().get(&self_type.id) {
33923392
// FIXME: should we catch other options and give more precise errors?
33933393
Some(&DefMod(_)) => {
33943394
self.resolve_error(path.span, "inherent implementations are not \
@@ -3576,7 +3576,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
35763576
// Like path expressions, the interpretation of path types depends
35773577
// on whether the path has multiple elements in it or not.
35783578

3579-
TyPath(ref path, path_id) => {
3579+
TyPath(ref path) => {
35803580
// This is a path in the type namespace. Walk through scopes
35813581
// looking for it.
35823582
let mut result_def = None;
@@ -3617,8 +3617,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
36173617
debug!("(resolving type) writing resolution for `{}` \
36183618
(id {}) = {:?}",
36193619
self.path_names_to_string(path),
3620-
path_id, def);
3621-
self.record_def(path_id, def);
3620+
ty.id, def);
3621+
self.record_def(ty.id, def);
36223622
}
36233623
None => {
36243624
let msg = format!("use of undeclared type name `{}`",
@@ -4281,7 +4281,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
42814281
fn extract_path_and_node_id(t: &Ty, allow: FallbackChecks)
42824282
-> Option<(Path, NodeId, FallbackChecks)> {
42834283
match t.node {
4284-
TyPath(ref path, node_id) => Some((path.clone(), node_id, allow)),
4284+
TyPath(ref path) => Some((path.clone(), t.id, allow)),
42854285
TyPtr(ref mut_ty) => extract_path_and_node_id(&*mut_ty.ty, OnlyTraitAndStatics),
42864286
TyRptr(_, ref mut_ty) => extract_path_and_node_id(&*mut_ty.ty, allow),
42874287
// This doesn't handle the remaining `Ty` variants as they are not

branches/auto/src/librustc_trans/save/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -662,9 +662,9 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
662662
let trait_id = trait_ref.as_ref().and_then(|tr| self.lookup_type_ref(tr.ref_id));
663663
match typ.node {
664664
// Common case impl for a struct or something basic.
665-
ast::TyPath(ref path, id) => {
665+
ast::TyPath(ref path) => {
666666
let sub_span = self.span.sub_span_for_type_name(path.span);
667-
let self_id = self.lookup_type_ref(id).map(|id| {
667+
let self_id = self.lookup_type_ref(typ.id).map(|id| {
668668
self.fmt.ref_str(recorder::TypeRef,
669669
path.span,
670670
sub_span,
@@ -1303,8 +1303,8 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DxrVisitor<'l, 'tcx> {
13031303
}
13041304

13051305
match t.node {
1306-
ast::TyPath(ref path, id) => {
1307-
match self.lookup_type_ref(id) {
1306+
ast::TyPath(ref path) => {
1307+
match self.lookup_type_ref(t.id) {
13081308
Some(id) => {
13091309
let sub_span = self.span.sub_span_for_type_name(t.span);
13101310
self.fmt.ref_str(recorder::TypeRef,

branches/auto/src/librustc_typeck/astconv.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -852,8 +852,8 @@ pub fn ast_ty_to_builtin_ty<'tcx>(
852852
}
853853

854854
match ast_ty.node {
855-
ast::TyPath(ref path, id) => {
856-
let a_def = match this.tcx().def_map.borrow().get(&id) {
855+
ast::TyPath(ref path) => {
856+
let a_def = match this.tcx().def_map.borrow().get(&ast_ty.id) {
857857
None => {
858858
this.tcx()
859859
.sess
@@ -912,8 +912,8 @@ fn ast_ty_to_trait_ref<'tcx>(this: &AstConv<'tcx>,
912912
*/
913913

914914
match ty.node {
915-
ast::TyPath(ref path, id) => {
916-
match this.tcx().def_map.borrow().get(&id) {
915+
ast::TyPath(ref path) => {
916+
match this.tcx().def_map.borrow().get(&ty.id) {
917917
Some(&def::DefTrait(trait_def_id)) => {
918918
let mut projection_bounds = Vec::new();
919919
let trait_ref = object_path_to_poly_trait_ref(this,
@@ -1183,8 +1183,8 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
11831183
ast::TyPolyTraitRef(ref bounds) => {
11841184
conv_ty_poly_trait_ref(this, rscope, ast_ty.span, &bounds[..])
11851185
}
1186-
ast::TyPath(ref path, id) => {
1187-
let a_def = match tcx.def_map.borrow().get(&id) {
1186+
ast::TyPath(ref path) => {
1187+
let a_def = match tcx.def_map.borrow().get(&ast_ty.id) {
11881188
None => {
11891189
tcx.sess
11901190
.span_bug(ast_ty.span,

branches/auto/src/librustdoc/clean/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,8 +1496,8 @@ impl Clean<Type> for ast::Ty {
14961496
TyFixedLengthVec(ref ty, ref e) => FixedVector(box ty.clean(cx),
14971497
e.span.to_src(cx)),
14981498
TyTup(ref tys) => Tuple(tys.clean(cx)),
1499-
TyPath(ref p, id) => {
1500-
resolve_type(cx, p.clean(cx), id)
1499+
TyPath(ref p) => {
1500+
resolve_type(cx, p.clean(cx), self.id)
15011501
}
15021502
TyObjectSum(ref lhs, ref bounds) => {
15031503
let lhs_ty = lhs.clean(cx);

branches/auto/src/libsyntax/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,7 @@ pub enum Ty_ {
12571257
/// A path (`module::module::...::Type`) or primitive
12581258
///
12591259
/// Type parameters are stored in the Path itself
1260-
TyPath(Path, NodeId),
1260+
TyPath(Path),
12611261
/// Something like `A+B`. Note that `B` must always be a path.
12621262
TyObjectSum(P<Ty>, TyParamBounds),
12631263
/// A type like `for<'a> Foo<&'a Bar>`

0 commit comments

Comments
 (0)