Skip to content

Commit 8d5c240

Browse files
committed
---
yaml --- r: 89904 b: refs/heads/master c: 35e6c02 h: refs/heads/master v: v3
1 parent 59b5426 commit 8d5c240

File tree

6 files changed

+71
-22
lines changed

6 files changed

+71
-22
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 9062988610dc28201c552854a2363157fc297fa5
2+
refs/heads/master: 35e6c0252422b178cc3b21f7f1510c80bcd064c8
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8

trunk/src/librustc/middle/trans/controlflow.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use middle::trans::base::*;
1414
use middle::trans::build::*;
1515
use middle::trans::callee;
1616
use middle::trans::common::*;
17-
use middle::trans::debuginfo;
1817
use middle::trans::expr;
1918
use middle::ty;
2019
use util::common::indenter;
@@ -76,7 +75,6 @@ pub fn trans_if(bcx: @mut Block,
7675
// if true { .. } [else { .. }]
7776
return do with_scope(bcx, thn.info(), "if_true_then") |bcx| {
7877
let bcx_out = trans_block(bcx, thn, dest);
79-
debuginfo::clear_source_location(bcx.fcx);
8078
trans_block_cleanups(bcx_out, block_cleanups(bcx))
8179
}
8280
} else {
@@ -88,7 +86,6 @@ pub fn trans_if(bcx: @mut Block,
8886
Some(elexpr) => {
8987
return do with_scope(bcx, elexpr.info(), "if_false_then") |bcx| {
9088
let bcx_out = trans_if_else(bcx, elexpr, dest);
91-
debuginfo::clear_source_location(bcx.fcx);
9289
trans_block_cleanups(bcx_out, block_cleanups(bcx))
9390
}
9491
}
@@ -101,8 +98,6 @@ pub fn trans_if(bcx: @mut Block,
10198
let then_bcx_in = scope_block(bcx, thn.info(), "then");
10299

103100
let then_bcx_out = trans_block(then_bcx_in, thn, dest);
104-
105-
debuginfo::clear_source_location(bcx.fcx);
106101
let then_bcx_out = trans_block_cleanups(then_bcx_out,
107102
block_cleanups(then_bcx_in));
108103

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

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);
133125
CondBr(bcx, cond_val, then_bcx_in.llbb, else_bcx_in.llbb);
134126
return next_bcx;
135127

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

trunk/src/librustc/middle/trans/debuginfo.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -509,17 +509,6 @@ 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-
523512
/// Enables emitting source locations for the given functions.
524513
///
525514
/// Since we don't want source locations to be emitted for the function prelude, they are disabled

trunk/src/libsyntax/parse/obsolete.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ pub enum ObsoleteSyntax {
3939
ObsoleteConstPointer,
4040
ObsoleteEmptyImpl,
4141
ObsoleteLoopAsContinue,
42+
ObsoleteEnumWildcard,
43+
ObsoleteStructWildcard
4244
}
4345

4446
impl to_bytes::IterBytes for ObsoleteSyntax {
@@ -113,6 +115,14 @@ impl ParserObsoleteMethods for Parser {
113115
"`loop` is now only used for loops and `continue` is used for \
114116
skipping iterations"
115117
),
118+
ObsoleteEnumWildcard => (
119+
"enum wildcard",
120+
"use `..` instead of `*` for matching all enum fields"
121+
),
122+
ObsoleteStructWildcard => (
123+
"struct wildcard",
124+
"use `..` instead of `_` for matching trailing struct fields"
125+
),
116126
};
117127

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

trunk/src/libsyntax/parse/parser.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2755,7 +2755,12 @@ impl Parser {
27552755
if first { first = false; }
27562756
else { self.expect(&token::COMMA); }
27572757

2758+
etc = *self.token == token::UNDERSCORE || *self.token == token::DOTDOT;
27582759
if *self.token == token::UNDERSCORE {
2760+
// FIXME #5830 activate after snapshot
2761+
// self.obsolete(*self.span, ObsoleteStructWildcard);
2762+
}
2763+
if etc {
27592764
self.bump();
27602765
if *self.token != token::RBRACE {
27612766
self.fatal(
@@ -3016,9 +3021,19 @@ impl Parser {
30163021
_ => false,
30173022
}
30183023
};
3019-
if is_star {
3024+
let is_dotdot = do self.look_ahead(1) |t| {
3025+
match *t {
3026+
token::DOTDOT => true,
3027+
_ => false,
3028+
}
3029+
};
3030+
if is_star | is_dotdot {
30203031
// This is a "top constructor only" pat
30213032
self.bump();
3033+
if is_star {
3034+
// FIXME #5830 activate after snapshot
3035+
// self.obsolete(*self.span, ObsoleteEnumWildcard);
3036+
}
30223037
self.bump();
30233038
self.expect(&token::RPAREN);
30243039
pat = PatEnum(enum_path, None);
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
struct Foo(int, int, int, int);
12+
struct Bar{a: int, b: int, c: int, d: int}
13+
14+
pub fn main() {
15+
let Foo(..) = Foo(5, 5, 5, 5);
16+
let Foo(*) = Foo(5, 5, 5, 5);
17+
let Bar{..} = Bar{a: 5, b: 5, c: 5, d: 5};
18+
let Bar{_} = Bar{a: 5, b: 5, c: 5, d: 5};
19+
//let (..) = (5, 5, 5, 5);
20+
//let Foo(a, b, ..) = Foo(5, 5, 5, 5);
21+
//let Foo(.., d) = Foo(5, 5, 5, 5);
22+
//let (a, b, ..) = (5, 5, 5, 5);
23+
//let (.., c, d) = (5, 5, 5, 5);
24+
let Bar{b: b, ..} = Bar{a: 5, b: 5, c: 5, d: 5};
25+
let Bar{b: b, _} = Bar{a: 5, b: 5, c: 5, d: 5};
26+
/*match [5, 5, 5, 5] {
27+
[a, ..] => { }
28+
}*/
29+
/*match [5, 5, 5, 5] {
30+
[.., b] => { }
31+
}*/
32+
/*match [5, 5, 5, 5] {
33+
[a, .., b] => { }
34+
}*/
35+
match [5, 5, 5] {
36+
[a, .._] => { }
37+
}
38+
match [5, 5, 5] {
39+
[.._, a] => { }
40+
}
41+
match [5, 5, 5] {
42+
[a, .._, b] => { }
43+
}
44+
}

0 commit comments

Comments
 (0)