Skip to content

Commit 302251e

Browse files
committed
---
yaml --- r: 138102 b: refs/heads/try c: 412f4d1 h: refs/heads/master v: v3
1 parent c4eb886 commit 302251e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+779
-1015
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: b6e0d3a5bf4c88650a22f605f822e02c6b163580
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
5-
refs/heads/try: c56c9fcf08603ab88ec36a7e0757d29129339097
5+
refs/heads/try: 412f4d1fc7ec8858ee4c91abd78097ac48cb15ef
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ fetch snapshots, and an OS that can execute the available snapshot binaries.
8787

8888
Snapshot binaries are currently built and tested on several platforms:
8989

90-
* Windows (7, 8, Server 2008 R2), x86 only
90+
* Windows (7, 8, Server 2008 R2), x86 and x86-64 (64-bit support added in Rust 0.12.0)
9191
* Linux (2.6.18 or later, various distributions), x86 and x86-64
9292
* OSX 10.7 (Lion) or greater, x86 and x86-64
9393

branches/try/src/doc/guide-ffi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ conventions. Rust provides a way to tell the compiler which convention to use:
475475
~~~~
476476
extern crate libc;
477477

478-
#[cfg(target_os = "win32", target_arch = "x86")]
478+
#[cfg(all(target_os = "win32", target_arch = "x86"))]
479479
#[link(name = "kernel32")]
480480
#[allow(non_snake_case)]
481481
extern "stdcall" {

branches/try/src/doc/guide-unsafe.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -313,17 +313,15 @@ literal string (i.e `""`)
313313
```
314314
#![feature(asm)]
315315
316-
#[cfg(target_arch = "x86")]
317-
#[cfg(target_arch = "x86_64")]
316+
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
318317
fn foo() {
319318
unsafe {
320319
asm!("NOP");
321320
}
322321
}
323322
324323
// other platforms
325-
#[cfg(not(target_arch = "x86"),
326-
not(target_arch = "x86_64"))]
324+
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
327325
fn foo() { /* ... */ }
328326
329327
fn main() {
@@ -340,7 +338,7 @@ but you must add the right number of `:` if you skip them:
340338

341339
```
342340
# #![feature(asm)]
343-
# #[cfg(target_arch = "x86")] #[cfg(target_arch = "x86_64")]
341+
# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
344342
# fn main() { unsafe {
345343
asm!("xor %eax, %eax"
346344
:
@@ -354,7 +352,7 @@ Whitespace also doesn't matter:
354352

355353
```
356354
# #![feature(asm)]
357-
# #[cfg(target_arch = "x86")] #[cfg(target_arch = "x86_64")]
355+
# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
358356
# fn main() { unsafe {
359357
asm!("xor %eax, %eax" ::: "eax");
360358
# } }
@@ -368,7 +366,7 @@ expressions must be mutable lvalues:
368366

369367
```
370368
# #![feature(asm)]
371-
# #[cfg(target_arch = "x86")] #[cfg(target_arch = "x86_64")]
369+
# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
372370
fn add(a: int, b: int) -> int {
373371
let mut c = 0;
374372
unsafe {
@@ -379,7 +377,7 @@ fn add(a: int, b: int) -> int {
379377
}
380378
c
381379
}
382-
# #[cfg(not(target_arch = "x86"), not(target_arch = "x86_64"))]
380+
# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
383381
# fn add(a: int, b: int) -> int { a + b }
384382
385383
fn main() {
@@ -396,7 +394,7 @@ stay valid.
396394

397395
```
398396
# #![feature(asm)]
399-
# #[cfg(target_arch = "x86")] #[cfg(target_arch = "x86_64")]
397+
# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
400398
# fn main() { unsafe {
401399
// Put the value 0x200 in eax
402400
asm!("mov $$0x200, %eax" : /* no outputs */ : /* no inputs */ : "eax");

branches/try/src/doc/reference.md

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,23 +1328,6 @@ let c = [Cookie, Cookie, Cookie, Cookie];
13281328
The precise memory layout of a structure is not specified. One can specify a
13291329
particular layout using the [`repr` attribute](#ffi-attributes).
13301330

1331-
By using the `struct_inherit` feature gate, structures may use single
1332-
inheritance. A Structure may only inherit from a single other structure, called
1333-
the _super-struct_. The inheriting structure (sub-struct) acts as if all fields
1334-
in the super-struct were present in the sub-struct. Fields declared in a
1335-
sub-struct must not have the same name as any field in any (transitive)
1336-
super-struct. All fields (both declared and inherited) must be specified in any
1337-
initializers. Inheritance between structures does not give subtyping or
1338-
coercion. The super-struct and sub-struct must be defined in the same crate.
1339-
The super-struct must be declared using the `virtual` keyword. For example:
1340-
1341-
```{.ignore}
1342-
virtual struct Sup { x: int }
1343-
struct Sub : Sup { y: int }
1344-
let s = Sub {x: 10, y: 11};
1345-
let sx = s.x;
1346-
```
1347-
13481331
### Enumerations
13491332

13501333
An _enumeration_ is a simultaneous definition of a nominal [enumerated
@@ -2066,26 +2049,28 @@ fn macos_only() {
20662049
}
20672050
20682051
// This function is only included when either foo or bar is defined
2069-
#[cfg(foo)]
2070-
#[cfg(bar)]
2052+
#[cfg(any(foo, bar))]
20712053
fn needs_foo_or_bar() {
20722054
// ...
20732055
}
20742056
20752057
// This function is only included when compiling for a unixish OS with a 32-bit
20762058
// architecture
2077-
#[cfg(unix, target_word_size = "32")]
2059+
#[cfg(all(unix, target_word_size = "32"))]
20782060
fn on_32bit_unix() {
20792061
// ...
20802062
}
2063+
2064+
// This function is only included when foo is not defined
2065+
#[cfg(not(foo))]
2066+
fn needs_not_foo() {
2067+
// ...
2068+
}
20812069
```
20822070

20832071
This illustrates some conditional compilation can be achieved using the
2084-
`#[cfg(...)]` attribute. Note that `#[cfg(foo, bar)]` is a condition that needs
2085-
both `foo` and `bar` to be defined while `#[cfg(foo)] #[cfg(bar)]` only needs
2086-
one of `foo` and `bar` to be defined (this resembles in the disjunctive normal
2087-
form). Additionally, one can reverse a condition by enclosing it in a
2088-
`not(...)`, like e. g. `#[cfg(not(target_os = "win32"))]`.
2072+
`#[cfg(...)]` attribute. `any`, `all` and `not` can be used to assemble
2073+
arbitrarily complex configurations through nesting.
20892074

20902075
The following configurations must be defined by the implementation:
20912076

@@ -2503,6 +2488,8 @@ The currently implemented features of the reference compiler are:
25032488

25042489
* `if_let` - Allows use of the `if let` syntax.
25052490

2491+
* `while_let` - Allows use of the `while let` syntax.
2492+
25062493
* `intrinsics` - Allows use of the "rust-intrinsics" ABI. Compiler intrinsics
25072494
are inherently unstable and no promise about them is made.
25082495

@@ -3509,6 +3496,18 @@ of a condition expression it expects a refutable let statement. If the value of
35093496
expression on the right hand side of the let statement matches the pattern, the corresponding
35103497
block will execute, otherwise flow proceeds to the first `else` block that follows.
35113498

3499+
### While let loops
3500+
3501+
```{.ebnf .gram}
3502+
while_let_expr : "while" "let" pat '=' expr '{' block '}' ;
3503+
```
3504+
3505+
A `while let` loop is semantically identical to a `while` loop but in place of a
3506+
condition expression it expects a refutable let statement. If the value of the
3507+
expression on the right hand side of the let statement matches the pattern, the
3508+
loop body block executes and control returns to the pattern matching statement.
3509+
Otherwise, the while expression completes.
3510+
35123511
### Return expressions
35133512

35143513
```{.ebnf .gram}

branches/try/src/libcollections/bitv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
//! bv.set(0, false);
3434
//! bv.set(1, false);
3535
//!
36-
//! for i in range(2, max_prime) {
36+
//! for i in iter::range_inclusive(2, (max_prime as f64).sqrt() as uint) {
3737
//! // if i is a prime
3838
//! if bv[i] {
3939
//! // Mark all multiples of i as non-prime (any multiples below i * i

branches/try/src/librustc/back/write.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ use std::sync::{Arc, Mutex};
3434
use std::task::TaskBuilder;
3535
use libc::{c_uint, c_int, c_void};
3636

37-
3837
#[deriving(Clone, PartialEq, PartialOrd, Ord, Eq)]
3938
pub enum OutputType {
4039
OutputTypeBitcode,
@@ -44,7 +43,6 @@ pub enum OutputType {
4443
OutputTypeExe,
4544
}
4645

47-
4846
pub fn llvm_err(handler: &diagnostic::Handler, msg: String) -> ! {
4947
unsafe {
5048
let cstr = llvm::LLVMRustGetLastError();
@@ -202,6 +200,10 @@ fn create_target_machine(sess: &Session) -> TargetMachineRef {
202200
(sess.targ_cfg.os == abi::OsMacos &&
203201
sess.targ_cfg.arch == abi::X86_64);
204202

203+
let any_library = sess.crate_types.borrow().iter().any(|ty| {
204+
*ty != config::CrateTypeExecutable
205+
});
206+
205207
// OSX has -dead_strip, which doesn't rely on ffunction_sections
206208
// FIXME(#13846) this should be enabled for windows
207209
let ffunction_sections = sess.targ_cfg.os != abi::OsMacos &&
@@ -240,6 +242,7 @@ fn create_target_machine(sess: &Session) -> TargetMachineRef {
240242
true /* EnableSegstk */,
241243
use_softfp,
242244
no_fp_elim,
245+
!any_library && reloc_model == llvm::RelocPIC,
243246
ffunction_sections,
244247
fdata_sections,
245248
)

branches/try/src/librustc/diagnostics.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ register_diagnostics!(
5656
E0038,
5757
E0039,
5858
E0040,
59-
E0041,
6059
E0044,
6160
E0045,
6261
E0046,
@@ -123,7 +122,6 @@ register_diagnostics!(
123122
E0121,
124123
E0122,
125124
E0124,
126-
E0126,
127125
E0127,
128126
E0128,
129127
E0129,
@@ -141,14 +139,12 @@ register_diagnostics!(
141139
E0141,
142140
E0152,
143141
E0153,
144-
E0154,
145-
E0155,
146-
E0156,
147142
E0157,
148143
E0158,
149144
E0159,
150145
E0161,
151146
E0162,
152147
E0163,
153-
E0164
148+
E0164,
149+
E0165
154150
)

branches/try/src/librustc/lint/builtin.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,8 @@ impl LintPass for UnnecessaryParens {
10821082
ast::ExprWhile(ref cond, _, _) => (cond, "`while` condition", true),
10831083
ast::ExprMatch(ref head, _, source) => match source {
10841084
ast::MatchNormal => (head, "`match` head expression", true),
1085-
ast::MatchIfLetDesugar => (head, "`if let` head expression", true)
1085+
ast::MatchIfLetDesugar => (head, "`if let` head expression", true),
1086+
ast::MatchWhileLetDesugar => (head, "`while let` head expression", true),
10861087
},
10871088
ast::ExprRet(Some(ref value)) => (value, "`return` value", false),
10881089
ast::ExprAssign(_, ref value) => (value, "assigned value", false),

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
259259
expr_exit
260260
}
261261

262+
ast::ExprWhileLet(..) => {
263+
self.tcx.sess.span_bug(expr.span, "non-desugared ExprWhileLet");
264+
}
265+
262266
ast::ExprForLoop(ref pat, ref head, ref body, _) => {
263267
//
264268
// [pred]

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

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -261,20 +261,32 @@ fn check_arms(cx: &MatchCheckCtxt, arms: &[(Vec<P<Pat>>, Option<&Expr>)], source
261261

262262
match is_useful(cx, &seen, v.as_slice(), LeaveOutWitness) {
263263
NotUseful => {
264-
if source == MatchIfLetDesugar {
265-
if printed_if_let_err {
266-
// we already printed an irrefutable if-let pattern error.
267-
// We don't want two, that's just confusing.
268-
} else {
264+
match source {
265+
MatchIfLetDesugar => {
266+
if printed_if_let_err {
267+
// we already printed an irrefutable if-let pattern error.
268+
// We don't want two, that's just confusing.
269+
} else {
270+
// find the first arm pattern so we can use its span
271+
let &(ref first_arm_pats, _) = &arms[0];
272+
let first_pat = first_arm_pats.get(0);
273+
let span = first_pat.span;
274+
span_err!(cx.tcx.sess, span, E0162, "irrefutable if-let pattern");
275+
printed_if_let_err = true;
276+
}
277+
},
278+
279+
MatchWhileLetDesugar => {
269280
// find the first arm pattern so we can use its span
270281
let &(ref first_arm_pats, _) = &arms[0];
271282
let first_pat = first_arm_pats.get(0);
272283
let span = first_pat.span;
273-
span_err!(cx.tcx.sess, span, E0162, "irrefutable if-let pattern");
274-
printed_if_let_err = true;
275-
}
276-
} else {
277-
span_err!(cx.tcx.sess, pat.span, E0001, "unreachable pattern");
284+
span_err!(cx.tcx.sess, span, E0165, "irrefutable while-let pattern");
285+
},
286+
287+
MatchNormal => {
288+
span_err!(cx.tcx.sess, pat.span, E0001, "unreachable pattern")
289+
},
278290
}
279291
}
280292
Useful => (),
@@ -634,15 +646,15 @@ fn pat_constructors(cx: &MatchCheckCtxt, p: &Pat,
634646
PatEnum(..) =>
635647
match cx.tcx.def_map.borrow().find(&pat.id) {
636648
Some(&DefConst(..)) =>
637-
cx.tcx.sess.span_bug(pat.span, "static pattern should've \
649+
cx.tcx.sess.span_bug(pat.span, "const pattern should've \
638650
been rewritten"),
639651
Some(&DefVariant(_, id, _)) => vec!(Variant(id)),
640652
_ => vec!(Single)
641653
},
642654
PatStruct(..) =>
643655
match cx.tcx.def_map.borrow().find(&pat.id) {
644656
Some(&DefConst(..)) =>
645-
cx.tcx.sess.span_bug(pat.span, "static pattern should've \
657+
cx.tcx.sess.span_bug(pat.span, "const pattern should've \
646658
been rewritten"),
647659
Some(&DefVariant(_, id, _)) => vec!(Variant(id)),
648660
_ => vec!(Single)

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,10 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,TYPER> {
429429
self.walk_block(&**blk);
430430
}
431431

432+
ast::ExprWhileLet(..) => {
433+
self.tcx().sess.span_bug(expr.span, "non-desugared ExprWhileLet");
434+
}
435+
432436
ast::ExprForLoop(ref pat, ref head, ref blk, _) => {
433437
// The pattern lives as long as the block.
434438
debug!("walk_expr for loop case: blk id={}", blk.id);

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,9 @@ fn visit_expr(ir: &mut IrMaps, expr: &Expr) {
484484
ExprIfLet(..) => {
485485
ir.tcx.sess.span_bug(expr.span, "non-desugared ExprIfLet");
486486
}
487+
ExprWhileLet(..) => {
488+
ir.tcx.sess.span_bug(expr.span, "non-desugared ExprWhileLet");
489+
}
487490
ExprForLoop(ref pat, _, _, _) => {
488491
pat_util::pat_bindings(&ir.tcx.def_map, &**pat, |bm, p_id, sp, path1| {
489492
debug!("adding local variable {} from for loop with bm {:?}",
@@ -1022,6 +1025,10 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
10221025
self.propagate_through_loop(expr, WhileLoop(&**cond), &**blk, succ)
10231026
}
10241027

1028+
ExprWhileLet(..) => {
1029+
self.ir.tcx.sess.span_bug(expr.span, "non-desugared ExprWhileLet");
1030+
}
1031+
10251032
ExprForLoop(ref pat, ref head, ref blk, _) => {
10261033
let ln = self.propagate_through_loop(expr, ForLoop(&**pat), &**blk, succ);
10271034
self.propagate_through_expr(&**head, ln)
@@ -1480,6 +1487,9 @@ fn check_expr(this: &mut Liveness, expr: &Expr) {
14801487
ExprIfLet(..) => {
14811488
this.ir.tcx.sess.span_bug(expr.span, "non-desugared ExprIfLet");
14821489
}
1490+
ExprWhileLet(..) => {
1491+
this.ir.tcx.sess.span_bug(expr.span, "non-desugared ExprWhileLet");
1492+
}
14831493
}
14841494
}
14851495

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,9 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
530530
ast::ExprIfLet(..) => {
531531
self.tcx().sess.span_bug(expr.span, "non-desugared ExprIfLet");
532532
}
533+
ast::ExprWhileLet(..) => {
534+
self.tcx().sess.span_bug(expr.span, "non-desugared ExprWhileLet");
535+
}
533536
}
534537
}
535538

0 commit comments

Comments
 (0)