Skip to content

Commit 5ac9ffc

Browse files
committed
---
yaml --- r: 187725 b: refs/heads/tmp c: 5809f8a h: refs/heads/master i: 187723: eeafc5f v: v3
1 parent 7f9353c commit 5ac9ffc

27 files changed

+336
-723
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3434
refs/heads/beta: 522d09dfecbeca1595f25ac58c6d0178bbd21d7d
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
37-
refs/heads/tmp: ffb8092ccf8dd186a9a03e6808d04a7276206793
37+
refs/heads/tmp: 5809f8ae746dbde96e0924b8e422b9e0d092375b
3838
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

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

Lines changed: 22 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -35,55 +35,36 @@ pub fn check_path_args(tcx: &ty::ctxt,
3535
if (flags & NO_REGIONS) != 0 {
3636
if path.segments.iter().any(|s| s.parameters.has_lifetimes()) {
3737
span_err!(tcx.sess, path.span, E0110,
38-
"region parameters are not allowed on this type");
38+
"lifetime parameters are not allowed on this type");
3939
}
4040
}
4141
}
4242

4343
pub fn ast_ty_to_prim_ty<'tcx>(tcx: &ty::ctxt<'tcx>, ast_ty: &ast::Ty)
4444
-> Option<Ty<'tcx>> {
45-
match ast_ty.node {
46-
ast::TyPath(ref path) => {
47-
let a_def = match tcx.def_map.borrow().get(&ast_ty.id) {
48-
None => {
49-
tcx.sess.span_bug(ast_ty.span,
50-
&format!("unbound path {}",
51-
path.repr(tcx)))
52-
}
53-
Some(&d) => d
54-
};
55-
match a_def {
56-
def::DefPrimTy(nty) => {
57-
match nty {
58-
ast::TyBool => {
59-
check_path_args(tcx, path, NO_TPS | NO_REGIONS);
60-
Some(tcx.types.bool)
61-
}
62-
ast::TyChar => {
63-
check_path_args(tcx, path, NO_TPS | NO_REGIONS);
64-
Some(tcx.types.char)
65-
}
66-
ast::TyInt(it) => {
67-
check_path_args(tcx, path, NO_TPS | NO_REGIONS);
68-
Some(ty::mk_mach_int(tcx, it))
69-
}
70-
ast::TyUint(uit) => {
71-
check_path_args(tcx, path, NO_TPS | NO_REGIONS);
72-
Some(ty::mk_mach_uint(tcx, uit))
73-
}
74-
ast::TyFloat(ft) => {
75-
check_path_args(tcx, path, NO_TPS | NO_REGIONS);
76-
Some(ty::mk_mach_float(tcx, ft))
77-
}
78-
ast::TyStr => {
79-
Some(ty::mk_str(tcx))
80-
}
81-
}
82-
}
83-
_ => None
45+
if let ast::TyPath(ref path) = ast_ty.node {
46+
let def = match tcx.def_map.borrow().get(&ast_ty.id) {
47+
None => {
48+
tcx.sess.span_bug(ast_ty.span,
49+
&format!("unbound path {}", path.repr(tcx)))
8450
}
51+
Some(&d) => d
52+
};
53+
if let def::DefPrimTy(nty) = def {
54+
check_path_args(tcx, path, NO_TPS | NO_REGIONS);
55+
Some(match nty {
56+
ast::TyBool => tcx.types.bool,
57+
ast::TyChar => tcx.types.char,
58+
ast::TyInt(it) => ty::mk_mach_int(tcx, it),
59+
ast::TyUint(uit) => ty::mk_mach_uint(tcx, uit),
60+
ast::TyFloat(ft) => ty::mk_mach_float(tcx, ft),
61+
ast::TyStr => ty::mk_str(tcx)
62+
})
63+
} else {
64+
None
8565
}
86-
_ => None
66+
} else {
67+
None
8768
}
8869
}
8970

branches/tmp/src/librustc/middle/astencode.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,6 @@ impl tr for def::Def {
456456
}
457457
def::DefStruct(did) => def::DefStruct(did.tr(dcx)),
458458
def::DefRegion(nid) => def::DefRegion(dcx.tr_id(nid)),
459-
def::DefTyParamBinder(nid) => {
460-
def::DefTyParamBinder(dcx.tr_id(nid))
461-
}
462459
def::DefLabel(nid) => def::DefLabel(dcx.tr_id(nid))
463460
}
464461
}

branches/tmp/src/librustc/middle/def.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ pub enum Def {
5454
/// - If it's an ExprPath referring to some tuple struct, then DefMap maps
5555
/// it to a def whose id is the StructDef.ctor_id.
5656
DefStruct(ast::DefId),
57-
DefTyParamBinder(ast::NodeId), /* struct, impl or trait with ty params */
5857
DefRegion(ast::NodeId),
5958
DefLabel(ast::NodeId),
6059
DefMethod(ast::DefId /* method */, Option<ast::DefId> /* trait */, MethodProvenance),
@@ -145,7 +144,6 @@ impl Def {
145144
DefSelfTy(id) |
146145
DefUpvar(id, _) |
147146
DefRegion(id) |
148-
DefTyParamBinder(id) |
149147
DefLabel(id) => {
150148
local_def(id)
151149
}

branches/tmp/src/librustc/middle/mem_categorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
580580
}
581581
def::DefMod(_) | def::DefForeignMod(_) | def::DefUse(_) |
582582
def::DefTrait(_) | def::DefTy(..) | def::DefPrimTy(_) |
583-
def::DefTyParam(..) | def::DefTyParamBinder(..) | def::DefRegion(_) |
583+
def::DefTyParam(..) | def::DefRegion(_) |
584584
def::DefLabel(_) | def::DefSelfTy(..) |
585585
def::DefAssociatedTy(..) | def::DefAssociatedPath(..)=> {
586586
Ok(Rc::new(cmt_ {

branches/tmp/src/librustc_resolve/build_reduced_graph.rs

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,15 @@ use Namespace::{TypeNS, ValueNS};
2323
use NameBindings;
2424
use ParentLink::{self, ModuleParentLink, BlockParentLink};
2525
use Resolver;
26-
use RibKind::*;
2726
use Shadowable;
2827
use TypeNsDef;
29-
use TypeParameters::HasTypeParameters;
3028

3129
use self::DuplicateCheckingMode::*;
3230
use self::NamespaceError::*;
3331

3432
use rustc::metadata::csearch;
3533
use rustc::metadata::decoder::{DefLike, DlDef, DlField, DlImpl};
3634
use rustc::middle::def::*;
37-
use rustc::middle::subst::FnSpace;
3835

3936
use syntax::ast::{Block, Crate};
4037
use syntax::ast::{DeclItem, DefId};
@@ -773,38 +770,25 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
773770
}
774771

775772
/// Constructs the reduced graph for one foreign item.
776-
fn build_reduced_graph_for_foreign_item<F>(&mut self,
777-
foreign_item: &ForeignItem,
778-
parent: &Rc<Module>,
779-
f: F) where
780-
F: FnOnce(&mut Resolver),
781-
{
773+
fn build_reduced_graph_for_foreign_item(&mut self,
774+
foreign_item: &ForeignItem,
775+
parent: &Rc<Module>) {
782776
let name = foreign_item.ident.name;
783777
let is_public = foreign_item.vis == ast::Public;
784778
let modifiers = if is_public { PUBLIC } else { DefModifiers::empty() } | IMPORTABLE;
785779
let name_bindings =
786780
self.add_child(name, parent, ForbidDuplicateValues,
787781
foreign_item.span);
788782

789-
match foreign_item.node {
790-
ForeignItemFn(_, ref generics) => {
791-
let def = DefFn(local_def(foreign_item.id), false);
792-
name_bindings.define_value(def, foreign_item.span, modifiers);
793-
794-
self.with_type_parameter_rib(
795-
HasTypeParameters(generics,
796-
FnSpace,
797-
foreign_item.id,
798-
NormalRibKind),
799-
f);
783+
let def = match foreign_item.node {
784+
ForeignItemFn(..) => {
785+
DefFn(local_def(foreign_item.id), false)
800786
}
801787
ForeignItemStatic(_, m) => {
802-
let def = DefStatic(local_def(foreign_item.id), m);
803-
name_bindings.define_value(def, foreign_item.span, modifiers);
804-
805-
f(self.resolver)
788+
DefStatic(local_def(foreign_item.id), m)
806789
}
807-
}
790+
};
791+
name_bindings.define_value(def, foreign_item.span, modifiers);
808792
}
809793

810794
fn build_reduced_graph_for_block(&mut self, block: &Block, parent: &Rc<Module>) -> Rc<Module> {
@@ -980,7 +964,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
980964
}
981965
DefLocal(..) | DefPrimTy(..) | DefTyParam(..) |
982966
DefUse(..) | DefUpvar(..) | DefRegion(..) |
983-
DefTyParamBinder(..) | DefLabel(..) | DefSelfTy(..) => {
967+
DefLabel(..) | DefSelfTy(..) => {
984968
panic!("didn't expect `{:?}`", def);
985969
}
986970
}
@@ -1241,16 +1225,7 @@ impl<'a, 'b, 'v, 'tcx> Visitor<'v> for BuildReducedGraphVisitor<'a, 'b, 'tcx> {
12411225
}
12421226

12431227
fn visit_foreign_item(&mut self, foreign_item: &ForeignItem) {
1244-
let parent = &self.parent;
1245-
self.builder.build_reduced_graph_for_foreign_item(foreign_item,
1246-
parent,
1247-
|r| {
1248-
let mut v = BuildReducedGraphVisitor {
1249-
builder: GraphBuilder { resolver: r },
1250-
parent: parent.clone()
1251-
};
1252-
visit::walk_foreign_item(&mut v, foreign_item);
1253-
})
1228+
self.builder.build_reduced_graph_for_foreign_item(foreign_item, &self.parent);
12541229
}
12551230

12561231
fn visit_block(&mut self, block: &Block) {

0 commit comments

Comments
 (0)