Skip to content

Commit 5374bff

Browse files
committed
---
yaml --- r: 96151 b: refs/heads/dist-snap c: 35e6c02 h: refs/heads/master i: 96149: dd5ce50 96147: 3dfe2d6 96143: a7be03c v: v3
1 parent a2af726 commit 5374bff

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
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 9062988610dc28201c552854a2363157fc297fa5
9+
refs/heads/dist-snap: 35e6c0252422b178cc3b21f7f1510c80bcd064c8
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/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
}

branches/dist-snap/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

branches/dist-snap/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);

branches/dist-snap/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)