Skip to content

Commit 794eb70

Browse files
committed
---
yaml --- r: 172924 b: refs/heads/batch c: 4fd1e62 h: refs/heads/master v: v3
1 parent 09bc8ee commit 794eb70

File tree

19 files changed

+359
-108
lines changed

19 files changed

+359
-108
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/issue-18208-method-dispatch-2: 9e1eae4fb9b6527315b4441cf8a0f5ca911d1671
3030
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
32-
refs/heads/batch: ee1ca88213133a58f0a9d234f03babbebeb7c5d8
32+
refs/heads/batch: 4fd1e6235dd241939475f79c8f58a455f5996690
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3434
refs/heads/beta: 44a287e6eb22ec3c2a687fc156813577464017f7
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928

branches/batch/src/librustc/metadata/filesearch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl<'a> FileSearch<'a> {
5454

5555
debug!("filesearch: searching lib path");
5656
let tlib_path = make_target_lib_path(self.sysroot,
57-
self.triple);
57+
self.triple);
5858
if !visited_dirs.contains(tlib_path.as_vec()) {
5959
match f(&tlib_path) {
6060
FileMatches => found = true,

branches/batch/src/librustc/middle/traits/select.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,14 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11861186
.is_ok()
11871187
})
11881188
}
1189+
(&BuiltinCandidate(_), &ParamCandidate(_)) => {
1190+
// If we have a where-clause like `Option<K> : Send`,
1191+
// then we wind up in a situation where there is a
1192+
// default rule (`Option<K>:Send if K:Send) and the
1193+
// where-clause that both seem applicable. Just take
1194+
// the where-clause in that case.
1195+
true
1196+
}
11891197
(&ProjectionCandidate, &ParamCandidate(_)) => {
11901198
// FIXME(#20297) -- this gives where clauses precedent
11911199
// over projections. Really these are just two means

branches/batch/src/librustc/session/search_paths.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use std::slice;
1212

13-
#[derive(Clone)]
13+
#[derive(Clone, Show)]
1414
pub struct SearchPaths {
1515
paths: Vec<(PathKind, Path)>,
1616
}
@@ -20,7 +20,7 @@ pub struct Iter<'a> {
2020
iter: slice::Iter<'a, (PathKind, Path)>,
2121
}
2222

23-
#[derive(Eq, PartialEq, Clone, Copy)]
23+
#[derive(Eq, PartialEq, Clone, Copy, Show)]
2424
pub enum PathKind {
2525
Native,
2626
Crate,

branches/batch/src/librustc_driver/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ fn run_compiler(args: &[String]) {
186186
list_metadata(&sess, &(*ifile), &mut stdout).unwrap();
187187
}
188188
Input::Str(_) => {
189-
early_error("can not list metadata for stdin");
189+
early_error("cannot list metadata for stdin");
190190
}
191191
}
192192
return;

branches/batch/src/librustc_trans/trans/base.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -702,9 +702,8 @@ pub fn iter_structural_ty<'blk, 'tcx, F>(cx: Block<'blk, 'tcx>,
702702
let mut cx = cx;
703703

704704
for (i, &arg) in variant.args.iter().enumerate() {
705-
cx = (*f)(cx,
706-
adt::trans_field_ptr(cx, repr, av, variant.disr_val, i),
707-
arg.subst(tcx, substs));
705+
let arg = monomorphize::apply_param_substs(tcx, substs, &arg);
706+
cx = f(cx, adt::trans_field_ptr(cx, repr, av, variant.disr_val, i), arg);
708707
}
709708
return cx;
710709
}

branches/batch/src/librustc_trans/trans/debuginfo.rs

Lines changed: 58 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -323,26 +323,28 @@ impl<'tcx> TypeMap<'tcx> {
323323
fn get_unique_type_id_of_type<'a>(&mut self, cx: &CrateContext<'a, 'tcx>,
324324
type_: Ty<'tcx>) -> UniqueTypeId {
325325

326-
// basic type -> {:name of the type:}
327-
// tuple -> {tuple_(:param-uid:)*}
328-
// struct -> {struct_:svh: / :node-id:_<(:param-uid:),*> }
329-
// enum -> {enum_:svh: / :node-id:_<(:param-uid:),*> }
330-
// enum variant -> {variant_:variant-name:_:enum-uid:}
331-
// reference (&) -> {& :pointee-uid:}
332-
// mut reference (&mut) -> {&mut :pointee-uid:}
333-
// ptr (*) -> {* :pointee-uid:}
334-
// mut ptr (*mut) -> {*mut :pointee-uid:}
335-
// unique ptr (~) -> {~ :pointee-uid:}
336-
// @-ptr (@) -> {@ :pointee-uid:}
337-
// sized vec ([T; x]) -> {[:size:] :element-uid:}
338-
// unsized vec ([T]) -> {[] :element-uid:}
339-
// trait (T) -> {trait_:svh: / :node-id:_<(:param-uid:),*> }
340-
// closure -> {<unsafe_> <once_> :store-sigil: |(:param-uid:),* <,_...>| -> \
341-
// :return-type-uid: : (:bounds:)*}
342-
// function -> {<unsafe_> <abi_> fn( (:param-uid:)* <,_...> ) -> \
343-
// :return-type-uid:}
344-
// unique vec box (~[]) -> {HEAP_VEC_BOX<:pointee-uid:>}
345-
// gc box -> {GC_BOX<:pointee-uid:>}
326+
// basic type -> {:name of the type:}
327+
// tuple -> {tuple_(:param-uid:)*}
328+
// struct -> {struct_:svh: / :node-id:_<(:param-uid:),*> }
329+
// enum -> {enum_:svh: / :node-id:_<(:param-uid:),*> }
330+
// enum variant -> {variant_:variant-name:_:enum-uid:}
331+
// reference (&) -> {& :pointee-uid:}
332+
// mut reference (&mut) -> {&mut :pointee-uid:}
333+
// ptr (*) -> {* :pointee-uid:}
334+
// mut ptr (*mut) -> {*mut :pointee-uid:}
335+
// unique ptr (~) -> {~ :pointee-uid:}
336+
// @-ptr (@) -> {@ :pointee-uid:}
337+
// sized vec ([T; x]) -> {[:size:] :element-uid:}
338+
// unsized vec ([T]) -> {[] :element-uid:}
339+
// trait (T) -> {trait_:svh: / :node-id:_<(:param-uid:),*> }
340+
// closure -> {<unsafe_> <once_> :store-sigil:
341+
// |(:param-uid:),* <,_...>| -> \
342+
// :return-type-uid: : (:bounds:)*}
343+
// function -> {<unsafe_> <abi_> fn( (:param-uid:)* <,_...> ) -> \
344+
// :return-type-uid:}
345+
// unique vec box (~[]) -> {HEAP_VEC_BOX<:pointee-uid:>}
346+
// gc box -> {GC_BOX<:pointee-uid:>}
347+
// projection (<T as U>::V) -> {<:ty-uid: as :trait-uid:> :: :name-uid: }
346348

347349
match self.type_to_unique_id.get(&type_).cloned() {
348350
Some(unique_type_id) => return unique_type_id,
@@ -435,6 +437,25 @@ impl<'tcx> TypeMap<'tcx> {
435437
principal.substs,
436438
&mut unique_type_id);
437439
},
440+
ty::ty_projection(ref projection) => {
441+
unique_type_id.push_str("<");
442+
443+
let self_ty = projection.trait_ref.self_ty();
444+
let self_type_id = self.get_unique_type_id_of_type(cx, self_ty);
445+
let self_type_id = self.get_unique_type_id_as_string(self_type_id);
446+
unique_type_id.push_str(&self_type_id[]);
447+
448+
unique_type_id.push_str(" as ");
449+
450+
from_def_id_and_substs(self,
451+
cx,
452+
projection.trait_ref.def_id,
453+
projection.trait_ref.substs,
454+
&mut unique_type_id);
455+
456+
unique_type_id.push_str(">::");
457+
unique_type_id.push_str(token::get_name(projection.item_name).get());
458+
},
438459
ty::ty_bare_fn(_, &ty::BareFnTy{ unsafety, abi, ref sig } ) => {
439460
if unsafety == ast::Unsafety::Unsafe {
440461
unique_type_id.push_str("unsafe ");
@@ -478,7 +499,10 @@ impl<'tcx> TypeMap<'tcx> {
478499
closure_ty,
479500
&mut unique_type_id);
480501
},
481-
_ => {
502+
ty::ty_err |
503+
ty::ty_infer(_) |
504+
ty::ty_open(_) |
505+
ty::ty_param(_) => {
482506
cx.sess().bug(&format!("get_unique_type_id_of_type() - unexpected type: {}, {:?}",
483507
&ppaux::ty_to_string(cx.tcx(), type_)[],
484508
type_.sty)[])
@@ -3855,10 +3879,22 @@ fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
38553879
ty::ty_unboxed_closure(..) => {
38563880
output.push_str("closure");
38573881
}
3882+
ty::ty_projection(ref projection) => {
3883+
output.push_str("<");
3884+
let self_ty = projection.trait_ref.self_ty();
3885+
push_debuginfo_type_name(cx, self_ty, true, output);
3886+
3887+
output.push_str(" as ");
3888+
3889+
push_item_name(cx, projection.trait_ref.def_id, false, output);
3890+
push_type_params(cx, projection.trait_ref.substs, output);
3891+
3892+
output.push_str(">::");
3893+
output.push_str(token::get_name(projection.item_name).get());
3894+
}
38583895
ty::ty_err |
38593896
ty::ty_infer(_) |
38603897
ty::ty_open(_) |
3861-
ty::ty_projection(..) |
38623898
ty::ty_param(_) => {
38633899
cx.sess().bug(&format!("debuginfo: Trying to create type name for \
38643900
unexpected type: {}", ppaux::ty_to_string(cx.tcx(), t))[]);

branches/batch/src/librustc_trans/trans/monomorphize.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
274274
ast_map::NodeArg(..) |
275275
ast_map::NodeBlock(..) |
276276
ast_map::NodePat(..) |
277+
ast_map::NodeViewItem(..) |
277278
ast_map::NodeLocal(..) => {
278279
ccx.sess().bug(&format!("can't monomorphize a {:?}",
279280
map_node)[])

branches/batch/src/librustc_typeck/check/_match.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,8 @@ pub fn check_struct_pat_fields<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
619619
}
620620
};
621621

622+
let field_type = pcx.fcx.normalize_associated_types_in(span, &field_type);
623+
622624
check_pat(pcx, &*field.pat, field_type);
623625
}
624626

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

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2289,6 +2289,34 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
22892289

22902290
obligations.map_move(|o| self.register_predicate(o));
22912291
}
2292+
2293+
// Only for fields! Returns <none> for methods>
2294+
// Indifferent to privacy flags
2295+
pub fn lookup_field_ty(&self,
2296+
span: Span,
2297+
class_id: ast::DefId,
2298+
items: &[ty::field_ty],
2299+
fieldname: ast::Name,
2300+
substs: &subst::Substs<'tcx>)
2301+
-> Option<Ty<'tcx>>
2302+
{
2303+
let o_field = items.iter().find(|f| f.name == fieldname);
2304+
o_field.map(|f| ty::lookup_field_type(self.tcx(), class_id, f.id, substs))
2305+
.map(|t| self.normalize_associated_types_in(span, &t))
2306+
}
2307+
2308+
pub fn lookup_tup_field_ty(&self,
2309+
span: Span,
2310+
class_id: ast::DefId,
2311+
items: &[ty::field_ty],
2312+
idx: uint,
2313+
substs: &subst::Substs<'tcx>)
2314+
-> Option<Ty<'tcx>>
2315+
{
2316+
let o_field = if idx < items.len() { Some(&items[idx]) } else { None };
2317+
o_field.map(|f| ty::lookup_field_type(self.tcx(), class_id, f.id, substs))
2318+
.map(|t| self.normalize_associated_types_in(span, &t))
2319+
}
22922320
}
22932321

22942322
impl<'a, 'tcx> RegionScope for FnCtxt<'a, 'tcx> {
@@ -3043,30 +3071,6 @@ pub fn impl_self_ty<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
30433071
TypeAndSubsts { substs: substs, ty: substd_ty }
30443072
}
30453073

3046-
// Only for fields! Returns <none> for methods>
3047-
// Indifferent to privacy flags
3048-
pub fn lookup_field_ty<'tcx>(tcx: &ty::ctxt<'tcx>,
3049-
class_id: ast::DefId,
3050-
items: &[ty::field_ty],
3051-
fieldname: ast::Name,
3052-
substs: &subst::Substs<'tcx>)
3053-
-> Option<Ty<'tcx>> {
3054-
3055-
let o_field = items.iter().find(|f| f.name == fieldname);
3056-
o_field.map(|f| ty::lookup_field_type(tcx, class_id, f.id, substs))
3057-
}
3058-
3059-
pub fn lookup_tup_field_ty<'tcx>(tcx: &ty::ctxt<'tcx>,
3060-
class_id: ast::DefId,
3061-
items: &[ty::field_ty],
3062-
idx: uint,
3063-
substs: &subst::Substs<'tcx>)
3064-
-> Option<Ty<'tcx>> {
3065-
3066-
let o_field = if idx < items.len() { Some(&items[idx]) } else { None };
3067-
o_field.map(|f| ty::lookup_field_type(tcx, class_id, f.id, substs))
3068-
}
3069-
30703074
// Controls whether the arguments are automatically referenced. This is useful
30713075
// for overloaded binary and unary operators.
30723076
#[derive(Copy, PartialEq)]
@@ -3530,8 +3534,8 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
35303534
ty::ty_struct(base_id, substs) => {
35313535
debug!("struct named {}", ppaux::ty_to_string(tcx, base_t));
35323536
let fields = ty::lookup_struct_fields(tcx, base_id);
3533-
lookup_field_ty(tcx, base_id, &fields[],
3534-
field.node.name, &(*substs))
3537+
fcx.lookup_field_ty(expr.span, base_id, &fields[],
3538+
field.node.name, &(*substs))
35353539
}
35363540
_ => None
35373541
}
@@ -3593,8 +3597,8 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
35933597
if tuple_like {
35943598
debug!("tuple struct named {}", ppaux::ty_to_string(tcx, base_t));
35953599
let fields = ty::lookup_struct_fields(tcx, base_id);
3596-
lookup_tup_field_ty(tcx, base_id, &fields[],
3597-
idx.node, &(*substs))
3600+
fcx.lookup_tup_field_ty(expr.span, base_id, &fields[],
3601+
idx.node, &(*substs))
35983602
} else {
35993603
None
36003604
}

branches/batch/src/libstd/rt/util.rs

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -144,56 +144,6 @@ pub fn abort(args: fmt::Arguments) -> ! {
144144
let _ = write!(&mut w, "{}", args);
145145
let msg = str::from_utf8(&w.buf[0..w.pos]).unwrap_or("aborted");
146146
let msg = if msg.is_empty() {"aborted"} else {msg};
147-
148-
// Give some context to the message
149-
let hash = msg.bytes().fold(0, |accum, val| accum + (val as uint) );
150-
let quote = match hash % 10 {
151-
0 => "
152-
It was from the artists and poets that the pertinent answers came, and I
153-
know that panic would have broken loose had they been able to compare notes.
154-
As it was, lacking their original letters, I half suspected the compiler of
155-
having asked leading questions, or of having edited the correspondence in
156-
corroboration of what he had latently resolved to see.",
157-
1 => "
158-
There are not many persons who know what wonders are opened to them in the
159-
stories and visions of their youth; for when as children we listen and dream,
160-
we think but half-formed thoughts, and when as men we try to remember, we are
161-
dulled and prosaic with the poison of life. But some of us awake in the night
162-
with strange phantasms of enchanted hills and gardens, of fountains that sing
163-
in the sun, of golden cliffs overhanging murmuring seas, of plains that stretch
164-
down to sleeping cities of bronze and stone, and of shadowy companies of heroes
165-
that ride caparisoned white horses along the edges of thick forests; and then
166-
we know that we have looked back through the ivory gates into that world of
167-
wonder which was ours before we were wise and unhappy.",
168-
2 => "
169-
Instead of the poems I had hoped for, there came only a shuddering blackness
170-
and ineffable loneliness; and I saw at last a fearful truth which no one had
171-
ever dared to breathe before — the unwhisperable secret of secrets — The fact
172-
that this city of stone and stridor is not a sentient perpetuation of Old New
173-
York as London is of Old London and Paris of Old Paris, but that it is in fact
174-
quite dead, its sprawling body imperfectly embalmed and infested with queer
175-
animate things which have nothing to do with it as it was in life.",
176-
3 => "
177-
The ocean ate the last of the land and poured into the smoking gulf, thereby
178-
giving up all it had ever conquered. From the new-flooded lands it flowed
179-
again, uncovering death and decay; and from its ancient and immemorial bed it
180-
trickled loathsomely, uncovering nighted secrets of the years when Time was
181-
young and the gods unborn. Above the waves rose weedy remembered spires. The
182-
moon laid pale lilies of light on dead London, and Paris stood up from its damp
183-
grave to be sanctified with star-dust. Then rose spires and monoliths that were
184-
weedy but not remembered; terrible spires and monoliths of lands that men never
185-
knew were lands...",
186-
4 => "
187-
There was a night when winds from unknown spaces whirled us irresistibly into
188-
limitless vacuum beyond all thought and entity. Perceptions of the most
189-
maddeningly untransmissible sort thronged upon us; perceptions of infinity
190-
which at the time convulsed us with joy, yet which are now partly lost to my
191-
memory and partly incapable of presentation to others.",
192-
_ => "You've met with a terrible fate, haven't you?"
193-
};
194-
rterrln!("{}", "");
195-
rterrln!("{}", quote);
196-
rterrln!("{}", "");
197147
rterrln!("fatal runtime error: {}", msg);
198148
unsafe { intrinsics::abort(); }
199149
}

branches/batch/src/libsyntax/ast.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,6 +1528,19 @@ pub struct ViewItem {
15281528
pub span: Span,
15291529
}
15301530

1531+
impl ViewItem {
1532+
pub fn id(&self) -> NodeId {
1533+
match self.node {
1534+
ViewItemExternCrate(_, _, id) => id,
1535+
ViewItemUse(ref vp) => match vp.node {
1536+
ViewPathSimple(_, _, id) => id,
1537+
ViewPathGlob(_, id) => id,
1538+
ViewPathList(_, _, id) => id,
1539+
}
1540+
}
1541+
}
1542+
}
1543+
15311544
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
15321545
pub enum ViewItem_ {
15331546
/// Ident: name used to refer to this crate in the code

0 commit comments

Comments
 (0)