Skip to content

Commit ac07df8

Browse files
committed
---
yaml --- r: 185836 b: refs/heads/auto c: ffb8092 h: refs/heads/master v: v3
1 parent 5337633 commit ac07df8

File tree

18 files changed

+178
-252
lines changed

18 files changed

+178
-252
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: 326711e9bdee2e8f467ad716109b5a270b61478d
13+
refs/heads/auto: ffb8092ccf8dd186a9a03e6808d04a7276206793
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -717,11 +717,6 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> {
717717
visit::walk_path(self, p);
718718
}
719719

720-
fn visit_qpath(&mut self, p: &ast::QPath, id: ast::NodeId) {
721-
run_lints!(self, check_qpath, p, id);
722-
visit::walk_qpath(self, p);
723-
}
724-
725720
fn visit_attribute(&mut self, attr: &ast::Attribute) {
726721
run_lints!(self, check_attribute, attr);
727722
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ pub trait LintPass {
157157
fn check_explicit_self(&mut self, _: &Context, _: &ast::ExplicitSelf) { }
158158
fn check_mac(&mut self, _: &Context, _: &ast::Mac) { }
159159
fn check_path(&mut self, _: &Context, _: &ast::Path, _: ast::NodeId) { }
160-
fn check_qpath(&mut self, _: &Context, _: &ast::QPath, _: ast::NodeId) { }
161160
fn check_attribute(&mut self, _: &Context, _: &ast::Attribute) { }
162161

163162
/// Called when entering a syntax node that can have lint attributes such

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,6 @@ impl<'a, 'tcx, 'v> Visitor<'v> for MarkSymbolVisitor<'a, 'tcx> {
306306
visit::walk_path(self, path);
307307
}
308308

309-
fn visit_qpath(&mut self, qpath: &ast::QPath, id: ast::NodeId) {
310-
self.lookup_and_handle_definition(&id);
311-
visit::walk_qpath(self, qpath);
312-
}
313-
314309
fn visit_item(&mut self, _: &ast::Item) {
315310
// Do not recurse into items. These items will be added to the
316311
// worklist and recursed into manually if necessary.

branches/auto/src/librustc_back/svh.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ mod svh_visitor {
194194
SawVariant,
195195
SawExplicitSelf,
196196
SawPath,
197-
SawQPath,
198197
SawOptLifetimeRef,
199198
SawBlock,
200199
SawPat,
@@ -486,10 +485,6 @@ mod svh_visitor {
486485
SawPath.hash(self.st); visit::walk_path(self, path)
487486
}
488487

489-
fn visit_qpath(&mut self, qpath: &QPath, _: ast::NodeId) {
490-
SawQPath.hash(self.st); visit::walk_qpath(self, qpath)
491-
}
492-
493488
fn visit_block(&mut self, b: &Block) {
494489
SawBlock.hash(self.st); visit::walk_block(self, b)
495490
}

branches/auto/src/librustc_privacy/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,11 +1021,6 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
10211021
self.check_path(path.span, id, path.segments.last().unwrap().identifier);
10221022
visit::walk_path(self, path);
10231023
}
1024-
1025-
fn visit_qpath(&mut self, qpath: &ast::QPath, id: ast::NodeId) {
1026-
self.check_path(qpath.trait_path.span, id, qpath.item_path.identifier);
1027-
visit::walk_qpath(self, qpath);
1028-
}
10291024
}
10301025

10311026
////////////////////////////////////////////////////////////////////////////////

branches/auto/src/librustc_resolve/lib.rs

Lines changed: 74 additions & 84 deletions
Large diffs are not rendered by default.

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,16 +1334,10 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DxrVisitor<'l, 'tcx> {
13341334
// Don't need to do anything for function calls,
13351335
// because just walking the callee path does what we want.
13361336
visit::walk_expr(self, ex);
1337-
},
1338-
ast::ExprPath(ref path) => {
1339-
self.process_path(ex.id, path.span, path, None);
1340-
visit::walk_path(self, path);
13411337
}
1342-
ast::ExprQPath(ref qpath) => {
1343-
let mut path = qpath.trait_path.clone();
1344-
path.segments.push(qpath.item_path.clone());
1345-
self.process_path(ex.id, ex.span, &path, None);
1346-
visit::walk_qpath(self, &**qpath);
1338+
ast::ExprPath(ref path) | ast::ExprQPath(ast::QPath { ref path, .. }) => {
1339+
self.process_path(ex.id, path.span, path, None);
1340+
visit::walk_expr(self, ex);
13471341
}
13481342
ast::ExprStruct(ref path, ref fields, ref base) =>
13491343
self.process_struct_lit(ex, path, fields, base),

branches/auto/src/librustc_typeck/astconv.rs

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,7 @@ pub fn instantiate_poly_trait_ref<'tcx>(
575575
let shifted_rscope = ShiftedRscope::new(rscope);
576576

577577
let trait_ref = instantiate_trait_ref(this, &shifted_rscope,
578-
&ast_trait_ref.trait_ref.path,
579-
ast_trait_ref.trait_ref.ref_id,
578+
&ast_trait_ref.trait_ref,
580579
None, self_ty, Some(&mut projections));
581580

582581
for projection in projections {
@@ -595,14 +594,14 @@ pub fn instantiate_poly_trait_ref<'tcx>(
595594
pub fn instantiate_trait_ref<'tcx>(
596595
this: &AstConv<'tcx>,
597596
rscope: &RegionScope,
598-
path: &ast::Path,
599-
path_id: ast::NodeId,
597+
trait_ref: &ast::TraitRef,
600598
impl_id: Option<ast::NodeId>,
601599
self_ty: Option<Ty<'tcx>>,
602600
projections: Option<&mut Vec<ty::ProjectionPredicate<'tcx>>>)
603601
-> Rc<ty::TraitRef<'tcx>>
604602
{
605-
match ::lookup_def_tcx(this.tcx(), path.span, path_id) {
603+
let path = &trait_ref.path;
604+
match ::lookup_def_tcx(this.tcx(), path.span, trait_ref.ref_id) {
606605
def::DefTrait(trait_def_id) => {
607606
let trait_ref = ast_path_to_trait_ref(this,
608607
rscope,
@@ -1201,11 +1200,7 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
12011200
ast::TyPolyTraitRef(ref bounds) => {
12021201
conv_ty_poly_trait_ref(this, rscope, ast_ty.span, &bounds[..])
12031202
}
1204-
ast::TyPath(_) | ast::TyQPath(_) => {
1205-
let simple_path = |&:| match ast_ty.node {
1206-
ast::TyPath(ref path) => path,
1207-
_ => tcx.sess.span_bug(ast_ty.span, "expected non-qualified path")
1208-
};
1203+
ast::TyPath(ref path) | ast::TyQPath(ast::QPath { ref path, .. }) => {
12091204
let a_def = match tcx.def_map.borrow().get(&ast_ty.id) {
12101205
None => {
12111206
tcx.sess
@@ -1224,24 +1219,24 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
12241219
let trait_ref = object_path_to_poly_trait_ref(this,
12251220
rscope,
12261221
trait_def_id,
1227-
simple_path(),
1222+
path,
12281223
&mut projection_bounds);
12291224

12301225
trait_ref_to_object_type(this, rscope, ast_ty.span,
12311226
trait_ref, projection_bounds, &[])
12321227
}
12331228
def::DefTy(did, _) | def::DefStruct(did) => {
1234-
ast_path_to_ty(this, rscope, did, simple_path()).ty
1229+
ast_path_to_ty(this, rscope, did, path).ty
12351230
}
12361231
def::DefTyParam(space, index, _, name) => {
1237-
check_path_args(tcx, simple_path(), NO_TPS | NO_REGIONS);
1232+
check_path_args(tcx, path, NO_TPS | NO_REGIONS);
12381233
ty::mk_param(tcx, space, index, name)
12391234
}
12401235
def::DefSelfTy(_) => {
12411236
// n.b.: resolve guarantees that the this type only appears in a
12421237
// trait, which we rely upon in various places when creating
12431238
// substs
1244-
check_path_args(tcx, simple_path(), NO_TPS | NO_REGIONS);
1239+
check_path_args(tcx, path, NO_TPS | NO_REGIONS);
12451240
ty::mk_self_type(tcx)
12461241
}
12471242
def::DefMod(id) => {
@@ -1253,19 +1248,14 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
12531248
panic!("DefPrimTy arm missed in previous ast_ty_to_prim_ty call");
12541249
}
12551250
def::DefAssociatedTy(trait_did, _) => {
1256-
let (opt_self_ty, trait_segment, item_segment) = match ast_ty.node {
1257-
ast::TyQPath(ref qpath) => {
1258-
(Some(&*qpath.self_type), qpath.trait_path.segments.last().unwrap(),
1259-
&qpath.item_path)
1260-
}
1261-
ast::TyPath(ref path) => {
1262-
(None, &path.segments[path.segments.len()-2],
1263-
path.segments.last().unwrap())
1264-
}
1265-
_ => unreachable!()
1251+
let opt_self_ty = if let ast::TyQPath(ref qpath) = ast_ty.node {
1252+
Some(&*qpath.self_type)
1253+
} else {
1254+
None
12661255
};
1267-
qpath_to_ty(this, rscope, ast_ty.span, opt_self_ty,
1268-
trait_did, trait_segment, item_segment)
1256+
qpath_to_ty(this, rscope, ast_ty.span, opt_self_ty, trait_did,
1257+
&path.segments[path.segments.len()-2],
1258+
path.segments.last().unwrap())
12691259
}
12701260
def::DefAssociatedPath(provenance, assoc_ident) => {
12711261
associated_path_def_to_ty(this, ast_ty, provenance, assoc_ident.name)

branches/auto/src/librustc_typeck/check/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3614,9 +3614,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
36143614
let self_ty = fcx.to_ty(&*qpath.self_type);
36153615
let defn = lookup_def(fcx, expr.span, id);
36163616
let (scheme, predicates) = type_scheme_and_predicates_for_def(fcx, expr.span, defn);
3617-
let mut path = qpath.trait_path.clone();
3618-
path.segments.push(qpath.item_path.clone());
3619-
instantiate_path(fcx, &path, scheme, &predicates, Some(self_ty),
3617+
instantiate_path(fcx, &qpath.path, scheme, &predicates, Some(self_ty),
36203618
defn, expr.span, expr.id);
36213619

36223620
// We always require that the type provided as the value for

branches/auto/src/librustc_typeck/collect.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,8 +740,7 @@ fn convert_item(ccx: &CollectCtxt, it: &ast::Item) {
740740
if let Some(ref trait_ref) = *opt_trait_ref {
741741
astconv::instantiate_trait_ref(ccx,
742742
&ExplicitRscope,
743-
&trait_ref.path,
744-
trait_ref.ref_id,
743+
trait_ref,
745744
Some(it.id),
746745
Some(selfty),
747746
None);

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,10 +1500,12 @@ impl Clean<Type> for ast::Ty {
15001500
resolve_type(cx, p.clean(cx), self.id)
15011501
}
15021502
TyQPath(ref qp) => {
1503+
let mut trait_path = qp.path.clone();
1504+
trait_path.segments.pop();
15031505
Type::QPath {
1504-
name: qp.item_path.identifier.clean(cx),
1506+
name: qp.path.segments.last().unwrap().identifier.clean(cx),
15051507
self_type: box qp.self_type.clean(cx),
1506-
trait_: box resolve_type(cx, qp.trait_path.clean(cx), self.id)
1508+
trait_: box resolve_type(cx, trait_path.clean(cx), self.id)
15071509
}
15081510
}
15091511
TyObjectSum(ref lhs, ref bounds) => {

branches/auto/src/libsyntax/ast.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ pub enum Expr_ {
757757
/// type parameters, e.g. foo::bar::<baz>
758758
ExprPath(Path),
759759
/// A "qualified path", e.g. `<Vec<T> as SomeTrait>::SomeType`
760-
ExprQPath(P<QPath>),
760+
ExprQPath(QPath),
761761

762762
ExprAddrOf(Mutability, P<Expr>),
763763
ExprBreak(Option<Ident>),
@@ -781,13 +781,12 @@ pub enum Expr_ {
781781
/// A "qualified path":
782782
///
783783
/// <Vec<T> as SomeTrait>::SomeAssociatedItem
784-
/// ^~~~~ ^~~~~~~~~ ^~~~~~~~~~~~~~~~~~
785-
/// self_type trait_path item_path
784+
/// ^~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
785+
/// self_type path
786786
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
787787
pub struct QPath {
788788
pub self_type: P<Ty>,
789-
pub trait_path: Path,
790-
pub item_path: PathSegment,
789+
pub path: Path,
791790
}
792791

793792
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
@@ -1259,7 +1258,7 @@ pub enum Ty_ {
12591258
/// Type parameters are stored in the Path itself
12601259
TyPath(Path),
12611260
/// A "qualified path", e.g. `<Vec<T> as SomeTrait>::SomeType`
1262-
TyQPath(P<QPath>),
1261+
TyQPath(QPath),
12631262
/// Something like `A+B`. Note that `B` must always be a path.
12641263
TyObjectSum(P<Ty>, TyParamBounds),
12651264
/// A type like `for<'a> Foo<&'a Bar>`

branches/auto/src/libsyntax/ext/build.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ pub trait AstBuilder {
4141
-> ast::Path;
4242

4343
fn qpath(&self, self_type: P<ast::Ty>,
44-
trait_ref: P<ast::TraitRef>,
45-
ident: ast::Ident )
46-
-> P<ast::QPath>;
44+
trait_path: ast::Path,
45+
ident: ast::Ident)
46+
-> ast::QPath;
4747
fn qpath_all(&self, self_type: P<ast::Ty>,
48-
trait_ref: P<ast::TraitRef>,
48+
trait_path: ast::Path,
4949
ident: ast::Ident,
5050
lifetimes: Vec<ast::Lifetime>,
5151
types: Vec<P<ast::Ty>>,
52-
bindings: Vec<P<ast::TypeBinding>> )
53-
-> P<ast::QPath>;
52+
bindings: Vec<P<ast::TypeBinding>>)
53+
-> ast::QPath;
5454

5555
// types
5656
fn ty_mt(&self, ty: P<ast::Ty>, mutbl: ast::Mutability) -> ast::MutTy;
@@ -114,7 +114,7 @@ pub trait AstBuilder {
114114
// expressions
115115
fn expr(&self, span: Span, node: ast::Expr_) -> P<ast::Expr>;
116116
fn expr_path(&self, path: ast::Path) -> P<ast::Expr>;
117-
fn expr_qpath(&self, span: Span, qpath: P<ast::QPath>) -> P<ast::Expr>;
117+
fn expr_qpath(&self, span: Span, qpath: ast::QPath) -> P<ast::Expr>;
118118
fn expr_ident(&self, span: Span, id: ast::Ident) -> P<ast::Expr>;
119119

120120
fn expr_self(&self, span: Span) -> P<ast::Expr>;
@@ -346,40 +346,40 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
346346

347347
/// Constructs a qualified path.
348348
///
349-
/// Constructs a path like `<self_type as trait_ref>::ident`.
349+
/// Constructs a path like `<self_type as trait_path>::ident`.
350350
fn qpath(&self,
351351
self_type: P<ast::Ty>,
352-
trait_ref: P<ast::TraitRef>,
352+
trait_path: ast::Path,
353353
ident: ast::Ident)
354-
-> P<ast::QPath> {
355-
self.qpath_all(self_type, trait_ref, ident, Vec::new(), Vec::new(), Vec::new())
354+
-> ast::QPath {
355+
self.qpath_all(self_type, trait_path, ident, vec![], vec![], vec![])
356356
}
357357

358358
/// Constructs a qualified path.
359359
///
360-
/// Constructs a path like `<self_type as trait_ref>::ident<a, T, A=Bar>`.
360+
/// Constructs a path like `<self_type as trait_path>::ident<'a, T, A=Bar>`.
361361
fn qpath_all(&self,
362362
self_type: P<ast::Ty>,
363-
trait_ref: P<ast::TraitRef>,
363+
trait_path: ast::Path,
364364
ident: ast::Ident,
365365
lifetimes: Vec<ast::Lifetime>,
366366
types: Vec<P<ast::Ty>>,
367-
bindings: Vec<P<ast::TypeBinding>> )
368-
-> P<ast::QPath> {
369-
let segment = ast::PathSegment {
367+
bindings: Vec<P<ast::TypeBinding>>)
368+
-> ast::QPath {
369+
let mut path = trait_path;
370+
path.segments.push(ast::PathSegment {
370371
identifier: ident,
371372
parameters: ast::AngleBracketedParameters(ast::AngleBracketedParameterData {
372373
lifetimes: lifetimes,
373374
types: OwnedSlice::from_vec(types),
374375
bindings: OwnedSlice::from_vec(bindings),
375376
})
376-
};
377+
});
377378

378-
P(ast::QPath {
379+
ast::QPath {
379380
self_type: self_type,
380-
trait_ref: trait_ref,
381-
item_path: segment,
382-
})
381+
path: path
382+
}
383383
}
384384

385385
fn ty_mt(&self, ty: P<ast::Ty>, mutbl: ast::Mutability) -> ast::MutTy {
@@ -607,7 +607,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
607607
}
608608

609609
/// Constructs a QPath expression.
610-
fn expr_qpath(&self, span: Span, qpath: P<ast::QPath>) -> P<ast::Expr> {
610+
fn expr_qpath(&self, span: Span, qpath: ast::QPath) -> P<ast::Expr> {
611611
self.expr(span, ast::ExprQPath(qpath))
612612
}
613613

0 commit comments

Comments
 (0)