Skip to content

Commit da050f4

Browse files
committed
---
yaml --- r: 93748 b: refs/heads/try c: ab7fe9d h: refs/heads/master v: v3
1 parent 9f4da81 commit da050f4

File tree

28 files changed

+187
-53
lines changed

28 files changed

+187
-53
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
5-
refs/heads/try: 68024eb4eb55ee6bca1279fc755a0b9bc6ec58cd
5+
refs/heads/try: ab7fe9dd06e93986f6b11512031c891059474653
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libextra/time.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ pub mod rustrt {
2121
use super::Tm;
2222

2323
extern {
24-
pub fn get_time(sec: &mut i64, nsec: &mut i32);
25-
pub fn precise_time_ns(ns: &mut u64);
24+
pub fn rust_get_time(sec: &mut i64, nsec: &mut i32);
25+
pub fn rust_precise_time_ns(ns: &mut u64);
2626
pub fn rust_tzset();
2727
pub fn rust_gmtime(sec: i64, nsec: i32, result: &mut Tm);
2828
pub fn rust_localtime(sec: i64, nsec: i32, result: &mut Tm);
@@ -66,7 +66,7 @@ pub fn get_time() -> Timespec {
6666
unsafe {
6767
let mut sec = 0i64;
6868
let mut nsec = 0i32;
69-
rustrt::get_time(&mut sec, &mut nsec);
69+
rustrt::rust_get_time(&mut sec, &mut nsec);
7070
return Timespec::new(sec, nsec);
7171
}
7272
}
@@ -79,7 +79,7 @@ pub fn get_time() -> Timespec {
7979
pub fn precise_time_ns() -> u64 {
8080
unsafe {
8181
let mut ns = 0u64;
82-
rustrt::precise_time_ns(&mut ns);
82+
rustrt::rust_precise_time_ns(&mut ns);
8383
ns
8484
}
8585
}

branches/try/src/librustc/middle/cfg/construct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl CFGBuilder {
9797
ast::PatEnum(_, None) |
9898
ast::PatLit(*) |
9999
ast::PatRange(*) |
100-
ast::PatWild => {
100+
ast::PatWild | ast::PatWildMulti => {
101101
self.add_node(pat.id, [pred])
102102
}
103103

branches/try/src/librustc/middle/check_match.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ fn is_useful_specialized(cx: &MatchCheckCtxt,
333333
fn pat_ctor_id(cx: &MatchCheckCtxt, p: @Pat) -> Option<ctor> {
334334
let pat = raw_pat(p);
335335
match pat.node {
336-
PatWild => { None }
336+
PatWild | PatWildMulti => { None }
337337
PatIdent(_, _, _) | PatEnum(_, _) => {
338338
match cx.tcx.def_map.find(&pat.id) {
339339
Some(&DefVariant(_, id, _)) => Some(variant(id)),
@@ -369,7 +369,7 @@ fn pat_ctor_id(cx: &MatchCheckCtxt, p: @Pat) -> Option<ctor> {
369369
fn is_wild(cx: &MatchCheckCtxt, p: @Pat) -> bool {
370370
let pat = raw_pat(p);
371371
match pat.node {
372-
PatWild => { true }
372+
PatWild | PatWildMulti => { true }
373373
PatIdent(_, _, _) => {
374374
match cx.tcx.def_map.find(&pat.id) {
375375
Some(&DefVariant(_, _, _)) | Some(&DefStatic(*)) => { false }
@@ -532,6 +532,10 @@ fn wild() -> @Pat {
532532
@Pat {id: 0, node: PatWild, span: dummy_sp()}
533533
}
534534

535+
fn wild_multi() -> @Pat {
536+
@Pat {id: 0, node: PatWildMulti, span: dummy_sp()}
537+
}
538+
535539
fn specialize(cx: &MatchCheckCtxt,
536540
r: &[@Pat],
537541
ctor_id: &ctor,
@@ -546,6 +550,9 @@ fn specialize(cx: &MatchCheckCtxt,
546550
PatWild => {
547551
Some(vec::append(vec::from_elem(arity, wild()), r.tail()))
548552
}
553+
PatWildMulti => {
554+
Some(vec::append(vec::from_elem(arity, wild_multi()), r.tail()))
555+
}
549556
PatIdent(_, _, _) => {
550557
match cx.tcx.def_map.find(&pat_id) {
551558
Some(&DefVariant(_, id, _)) => {
@@ -849,7 +856,7 @@ fn is_refutable(cx: &MatchCheckCtxt, pat: &Pat) -> bool {
849856
PatIdent(_, _, Some(sub)) => {
850857
is_refutable(cx, sub)
851858
}
852-
PatWild | PatIdent(_, _, None) => { false }
859+
PatWild | PatWildMulti | PatIdent(_, _, None) => { false }
853860
PatLit(@Expr {node: ExprLit(@Spanned { node: lit_nil, _}), _}) => {
854861
// "()"
855862
false

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ impl mem_categorization_ctxt {
876876
op(cmt, pat);
877877

878878
match pat.node {
879-
ast::PatWild => {
879+
ast::PatWild | ast::PatWildMulti => {
880880
// _
881881
}
882882

branches/try/src/librustc/middle/pat_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub fn pat_is_binding(dm: resolve::DefMap, pat: @Pat) -> bool {
6565
pub fn pat_is_binding_or_wild(dm: resolve::DefMap, pat: @Pat) -> bool {
6666
match pat.node {
6767
PatIdent(*) => pat_is_binding(dm, pat),
68-
PatWild => true,
68+
PatWild | PatWildMulti => true,
6969
_ => false
7070
}
7171
}

branches/try/src/librustc/middle/trans/_match.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ fn enter_default<'r>(bcx: @mut Block,
545545
// Collect all of the matches that can match against anything.
546546
let matches = do enter_match(bcx, dm, m, col, val) |p| {
547547
match p.node {
548-
ast::PatWild | ast::PatTup(_) => Some(~[]),
548+
ast::PatWild | ast::PatWildMulti | ast::PatTup(_) => Some(~[]),
549549
ast::PatIdent(_, _, None) if pat_is_binding(dm, p) => Some(~[]),
550550
_ => None
551551
}
@@ -2234,7 +2234,7 @@ fn bind_irrefutable_pat(bcx: @mut Block,
22342234
pat.span,
22352235
format!("vector patterns are never irrefutable!"));
22362236
}
2237-
ast::PatWild | ast::PatLit(_) | ast::PatRange(_, _) => ()
2237+
ast::PatWild | ast::PatWildMulti | ast::PatLit(_) | ast::PatRange(_, _) => ()
22382238
}
22392239
return bcx;
22402240
}

branches/try/src/librustc/middle/trans/controlflow.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use middle::trans::base::*;
1414
use middle::trans::build::*;
1515
use middle::trans::callee;
1616
use middle::trans::common::*;
17+
use middle::trans::debuginfo;
1718
use middle::trans::expr;
1819
use middle::ty;
1920
use util::common::indenter;
@@ -75,6 +76,7 @@ pub fn trans_if(bcx: @mut Block,
7576
// if true { .. } [else { .. }]
7677
return do with_scope(bcx, thn.info(), "if_true_then") |bcx| {
7778
let bcx_out = trans_block(bcx, thn, dest);
79+
debuginfo::clear_source_location(bcx.fcx);
7880
trans_block_cleanups(bcx_out, block_cleanups(bcx))
7981
}
8082
} else {
@@ -86,6 +88,7 @@ pub fn trans_if(bcx: @mut Block,
8688
Some(elexpr) => {
8789
return do with_scope(bcx, elexpr.info(), "if_false_then") |bcx| {
8890
let bcx_out = trans_if_else(bcx, elexpr, dest);
91+
debuginfo::clear_source_location(bcx.fcx);
8992
trans_block_cleanups(bcx_out, block_cleanups(bcx))
9093
}
9194
}
@@ -98,6 +101,8 @@ pub fn trans_if(bcx: @mut Block,
98101
let then_bcx_in = scope_block(bcx, thn.info(), "then");
99102

100103
let then_bcx_out = trans_block(then_bcx_in, thn, dest);
104+
105+
debuginfo::clear_source_location(bcx.fcx);
101106
let then_bcx_out = trans_block_cleanups(then_bcx_out,
102107
block_cleanups(then_bcx_in));
103108

@@ -122,6 +127,9 @@ pub fn trans_if(bcx: @mut Block,
122127
debug!("then_bcx_in={}, else_bcx_in={}",
123128
then_bcx_in.to_str(), else_bcx_in.to_str());
124129

130+
// Clear the source location because it is still set to whatever has been translated
131+
// right before.
132+
debuginfo::clear_source_location(else_bcx_in.fcx);
125133
CondBr(bcx, cond_val, then_bcx_in.llbb, else_bcx_in.llbb);
126134
return next_bcx;
127135

@@ -139,6 +147,7 @@ pub fn trans_if(bcx: @mut Block,
139147
// would be nice to have a constraint on ifs
140148
_ => else_bcx_in.tcx().sess.bug("strange alternative in if")
141149
};
150+
debuginfo::clear_source_location(else_bcx_in.fcx);
142151
trans_block_cleanups(else_bcx_out, block_cleanups(else_bcx_in))
143152
}
144153
}

branches/try/src/librustc/middle/trans/debuginfo.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,17 @@ pub fn set_source_location(fcx: &FunctionContext,
509509
}
510510
}
511511

512+
/// Clears the current debug location.
513+
///
514+
/// Instructions generated hereafter won't be assigned a source location.
515+
pub fn clear_source_location(fcx: &FunctionContext) {
516+
if fn_should_be_ignored(fcx) {
517+
return;
518+
}
519+
520+
set_debug_location(fcx.ccx, UnknownLocation);
521+
}
522+
512523
/// Enables emitting source locations for the given functions.
513524
///
514525
/// Since we don't want source locations to be emitted for the function prelude, they are disabled
@@ -2418,7 +2429,7 @@ fn populate_scope_map(cx: &mut CrateContext,
24182429
}
24192430
}
24202431

2421-
ast::PatWild => {
2432+
ast::PatWild | ast::PatWildMulti => {
24222433
scope_map.insert(pat.id, scope_stack.last().scope_metadata);
24232434
}
24242435

branches/try/src/librustc/middle/typeck/check/_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: @ast::Pat, expected: ty::t) {
414414
let tcx = pcx.fcx.ccx.tcx;
415415

416416
match pat.node {
417-
ast::PatWild => {
417+
ast::PatWild | ast::PatWildMulti => {
418418
fcx.write_ty(pat.id, expected);
419419
}
420420
ast::PatLit(lt) => {

branches/try/src/librustc/middle/typeck/check/regionck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ pub mod guarantor {
12191219
rcx.fcx.pat_to_str(pat), guarantor);
12201220

12211221
match pat.node {
1222-
ast::PatWild => {}
1222+
ast::PatWild | ast::PatWildMulti => {}
12231223
ast::PatIdent(ast::BindByRef(_), _, opt_p) => {
12241224
link(rcx, pat.span, pat.id, guarantor);
12251225

branches/try/src/librustdoc/clean.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,7 @@ fn name_from_pat(p: &ast::Pat) -> ~str {
11371137
use syntax::ast::*;
11381138
match p.node {
11391139
PatWild => ~"_",
1140+
PatWildMulti => ~"..",
11401141
PatIdent(_, ref p, _) => path_to_str(p),
11411142
PatEnum(ref p, _) => path_to_str(p),
11421143
PatStruct(*) => fail!("tried to get argument name from pat_struct, \

branches/try/src/libstd/rt/basic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,11 @@ impl Drop for BasicPausible {
241241

242242
fn time() -> Time {
243243
extern {
244-
fn get_time(sec: &mut i64, nsec: &mut i32);
244+
fn rust_get_time(sec: &mut i64, nsec: &mut i32);
245245
}
246246
let mut sec = 0;
247247
let mut nsec = 0;
248-
unsafe { get_time(&mut sec, &mut nsec) }
248+
unsafe { rust_get_time(&mut sec, &mut nsec) }
249249

250250
Time { sec: sec as u64, nsec: nsec as u64 }
251251
}

branches/try/src/libstd/rt/context.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl Context {
5959
// which we will then modify to call the given function when restored
6060
let mut regs = new_regs();
6161
unsafe {
62-
swap_registers(transmute_mut_region(&mut *regs), transmute_region(&*regs));
62+
rust_swap_registers(transmute_mut_region(&mut *regs), transmute_region(&*regs));
6363
};
6464

6565
initialize_call_frame(&mut *regs, fp, argp, sp);
@@ -104,22 +104,22 @@ impl Context {
104104
// stack limit in the OS-specified TLS slot. This also means that
105105
// we cannot call any more rust functions after record_stack_bounds
106106
// returns because they would all likely fail due to the limit being
107-
// invalid for the current task. Lucky for us `swap_registers` is a
108-
// C function so we don't have to worry about that!
107+
// invalid for the current task. Lucky for us `rust_swap_registers`
108+
// is a C function so we don't have to worry about that!
109109
match in_context.stack_bounds {
110110
Some((lo, hi)) => record_stack_bounds(lo, hi),
111111
// If we're going back to one of the original contexts or
112112
// something that's possibly not a "normal task", then reset
113113
// the stack limit to 0 to make morestack never fail
114114
None => record_stack_bounds(0, uint::max_value),
115115
}
116-
swap_registers(out_regs, in_regs)
116+
rust_swap_registers(out_regs, in_regs)
117117
}
118118
}
119119
}
120120

121121
extern {
122-
fn swap_registers(out_regs: *mut Registers, in_regs: *Registers);
122+
fn rust_swap_registers(out_regs: *mut Registers, in_regs: *Registers);
123123
}
124124

125125
// Register contexts used in various architectures
@@ -142,7 +142,7 @@ extern {
142142
//
143143
// These structures/functions are roughly in-sync with the source files inside
144144
// of src/rt/arch/$arch. The only currently used function from those folders is
145-
// the `swap_registers` function, but that's only because for now segmented
145+
// the `rust_swap_registers` function, but that's only because for now segmented
146146
// stacks are disabled.
147147

148148
#[cfg(target_arch = "x86")]

branches/try/src/libsyntax/ast.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ pub enum BindingMode {
337337
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
338338
pub enum Pat_ {
339339
PatWild,
340+
PatWildMulti,
340341
// A pat_ident may either be a new bound variable,
341342
// or a nullary enum (in which case the second field
342343
// is None).

branches/try/src/libsyntax/ast_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ pub fn walk_pat(pat: @Pat, it: &fn(@Pat) -> bool) -> bool {
657657
slice.iter().advance(|&p| walk_pat(p, |p| it(p))) &&
658658
after.iter().advance(|&p| walk_pat(p, |p| it(p)))
659659
}
660-
PatWild | PatLit(_) | PatRange(_, _) | PatIdent(_, _, _) |
660+
PatWild | PatWildMulti | PatLit(_) | PatRange(_, _) | PatIdent(_, _, _) |
661661
PatEnum(_, _) => {
662662
true
663663
}

branches/try/src/libsyntax/fold.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ pub trait ast_fold {
174174
fn fold_pat(&self, p: @Pat) -> @Pat {
175175
let node = match p.node {
176176
PatWild => PatWild,
177+
PatWildMulti => PatWildMulti,
177178
PatIdent(binding_mode, ref pth, ref sub) => {
178179
PatIdent(binding_mode,
179180
self.fold_path(pth),

branches/try/src/libsyntax/parse/obsolete.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ pub enum ObsoleteSyntax {
3939
ObsoleteConstPointer,
4040
ObsoleteEmptyImpl,
4141
ObsoleteLoopAsContinue,
42+
ObsoleteEnumWildcard,
43+
ObsoleteStructWildcard,
44+
ObsoleteVecDotDotWildcard
4245
}
4346

4447
impl to_bytes::IterBytes for ObsoleteSyntax {
@@ -113,6 +116,18 @@ impl ParserObsoleteMethods for Parser {
113116
"`loop` is now only used for loops and `continue` is used for \
114117
skipping iterations"
115118
),
119+
ObsoleteEnumWildcard => (
120+
"enum wildcard",
121+
"use `..` instead of `*` for matching all enum fields"
122+
),
123+
ObsoleteStructWildcard => (
124+
"struct wildcard",
125+
"use `..` instead of `_` for matching trailing struct fields"
126+
),
127+
ObsoleteVecDotDotWildcard => (
128+
"vec slice wildcard",
129+
"use `..` instead of `.._` for matching slices"
130+
),
116131
};
117132

118133
self.report(sp, kind, kind_str, desc);

0 commit comments

Comments
 (0)