Skip to content

Commit c2c29bc

Browse files
committed
---
yaml --- r: 156267 b: refs/heads/snap-stage3 c: 4a382d7 h: refs/heads/master i: 156265: fb1c142 156263: 06c5e7b v: v3
1 parent 98fb4cc commit c2c29bc

Some content is hidden

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

58 files changed

+528
-1016
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: c29a7520e7fb4a5b4d4eccfc594e05793ef6688d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: b6397da105f4615d84f1164a1d3d24ffae3f7d76
4+
refs/heads/snap-stage3: 4a382d7c4743775e9ee87735ed606b0a673d8ed5
55
refs/heads/try: 6601b0501e31d08d3892a2d5a7d8a57ab120bf75
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/compiletest/runtest.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -952,10 +952,10 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
952952
to_lower(line).as_slice().starts_with(to_lower(prefix).as_slice())
953953
}
954954

955-
#[cfg(target_os = "linux")]
956-
#[cfg(target_os = "macos")]
957-
#[cfg(target_os = "freebsd")]
958-
#[cfg(target_os = "dragonfly")]
955+
#[cfg(any(target_os = "linux",
956+
target_os = "macos",
957+
target_os = "freebsd",
958+
target_os = "dragonfly"))]
959959
fn prefix_matches( line : &str, prefix : &str ) -> bool {
960960
line.starts_with( prefix )
961961
}
@@ -1356,10 +1356,10 @@ fn program_output(config: &Config, testfile: &Path, lib_path: &str, prog: String
13561356
}
13571357

13581358
// Linux and mac don't require adjusting the library search path
1359-
#[cfg(target_os = "linux")]
1360-
#[cfg(target_os = "macos")]
1361-
#[cfg(target_os = "freebsd")]
1362-
#[cfg(target_os = "dragonfly")]
1359+
#[cfg(any(target_os = "linux",
1360+
target_os = "macos",
1361+
target_os = "freebsd",
1362+
target_os = "dragonfly"))]
13631363
fn make_cmdline(_libpath: &str, prog: &str, args: &[String]) -> String {
13641364
format!("{} {}", prog, args.connect(" "))
13651365
}

branches/snap-stage3/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/snap-stage3/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/snap-stage3/src/doc/reference.md

Lines changed: 10 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

branches/snap-stage3/src/libcoretest/mem.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ fn size_of_basic() {
1919
}
2020

2121
#[test]
22-
#[cfg(target_arch = "x86")]
23-
#[cfg(target_arch = "arm")]
24-
#[cfg(target_arch = "mips")]
25-
#[cfg(target_arch = "mipsel")]
22+
#[cfg(any(target_arch = "x86",
23+
target_arch = "arm",
24+
target_arch = "mips",
25+
target_arch = "mipsel"))]
2626
fn size_of_32() {
2727
assert_eq!(size_of::<uint>(), 4u);
2828
assert_eq!(size_of::<*const uint>(), 4u);
@@ -51,10 +51,10 @@ fn align_of_basic() {
5151
}
5252

5353
#[test]
54-
#[cfg(target_arch = "x86")]
55-
#[cfg(target_arch = "arm")]
56-
#[cfg(target_arch = "mips")]
57-
#[cfg(target_arch = "mipsel")]
54+
#[cfg(any(target_arch = "x86",
55+
target_arch = "arm",
56+
target_arch = "mips",
57+
target_arch = "mipsel"))]
5858
fn align_of_32() {
5959
assert_eq!(align_of::<uint>(), 4u);
6060
assert_eq!(align_of::<*const uint>(), 4u);

branches/snap-stage3/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/snap-stage3/src/librustc/diagnostics.rs

Lines changed: 0 additions & 5 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,9 +139,6 @@ register_diagnostics!(
141139
E0141,
142140
E0152,
143141
E0153,
144-
E0154,
145-
E0155,
146-
E0156,
147142
E0157,
148143
E0158,
149144
E0159,

branches/snap-stage3/src/librustc/middle/check_match.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,15 +638,15 @@ fn pat_constructors(cx: &MatchCheckCtxt, p: &Pat,
638638
PatEnum(..) =>
639639
match cx.tcx.def_map.borrow().find(&pat.id) {
640640
Some(&DefConst(..)) =>
641-
cx.tcx.sess.span_bug(pat.span, "static pattern should've \
641+
cx.tcx.sess.span_bug(pat.span, "const pattern should've \
642642
been rewritten"),
643643
Some(&DefVariant(_, id, _)) => vec!(Variant(id)),
644644
_ => vec!(Single)
645645
},
646646
PatStruct(..) =>
647647
match cx.tcx.def_map.borrow().find(&pat.id) {
648648
Some(&DefConst(..)) =>
649-
cx.tcx.sess.span_bug(pat.span, "static pattern should've \
649+
cx.tcx.sess.span_bug(pat.span, "const pattern should've \
650650
been rewritten"),
651651
Some(&DefVariant(_, id, _)) => vec!(Variant(id)),
652652
_ => vec!(Single)

branches/snap-stage3/src/librustc/middle/pat_util.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,25 @@ pub type PatIdMap = HashMap<Ident, NodeId>;
2525
pub fn pat_id_map(dm: &resolve::DefMap, pat: &Pat) -> PatIdMap {
2626
let mut map = HashMap::new();
2727
pat_bindings(dm, pat, |_bm, p_id, _s, path1| {
28-
map.insert(path1.node, p_id);
28+
map.insert(path1.node, p_id);
2929
});
3030
map
3131
}
3232

33+
pub fn pat_is_refutable(dm: &resolve::DefMap, pat: &Pat) -> bool {
34+
match pat.node {
35+
PatLit(_) | PatRange(_, _) => true,
36+
PatEnum(_, _) | PatIdent(_, _, None) | PatStruct(..) => {
37+
match dm.borrow().find(&pat.id) {
38+
Some(&DefVariant(..)) => true,
39+
_ => false
40+
}
41+
}
42+
PatVec(_, _, _) => true,
43+
_ => false
44+
}
45+
}
46+
3347
pub fn pat_is_variant_or_struct(dm: &resolve::DefMap, pat: &Pat) -> bool {
3448
match pat.node {
3549
PatEnum(_, _) | PatIdent(_, _, None) | PatStruct(..) => {

branches/snap-stage3/src/librustc/middle/resolve.rs

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ use syntax::parse::token::special_idents;
5454
use syntax::parse::token;
5555
use syntax::codemap::{Span, DUMMY_SP, Pos};
5656
use syntax::owned_slice::OwnedSlice;
57-
use syntax::ptr::P;
5857
use syntax::visit;
5958
use syntax::visit::Visitor;
6059

@@ -4179,7 +4178,6 @@ impl<'a> Resolver<'a> {
41794178
ItemStruct(ref struct_def, ref generics) => {
41804179
self.resolve_struct(item.id,
41814180
generics,
4182-
&struct_def.super_struct,
41834181
struct_def.fields.as_slice());
41844182
}
41854183

@@ -4505,7 +4503,6 @@ impl<'a> Resolver<'a> {
45054503
fn resolve_struct(&mut self,
45064504
id: NodeId,
45074505
generics: &Generics,
4508-
super_struct: &Option<P<Ty>>,
45094506
fields: &[StructField]) {
45104507
// If applicable, create a rib for the type parameters.
45114508
self.with_type_parameter_rib(HasTypeParameters(generics,
@@ -4517,42 +4514,6 @@ impl<'a> Resolver<'a> {
45174514
this.resolve_type_parameters(&generics.ty_params);
45184515
this.resolve_where_clause(&generics.where_clause);
45194516

4520-
// Resolve the super struct.
4521-
match *super_struct {
4522-
Some(ref t) => match t.node {
4523-
TyPath(ref path, None, path_id) => {
4524-
match this.resolve_path(id, path, TypeNS, true) {
4525-
Some((DefTy(def_id, _), lp)) if this.structs.contains_key(&def_id) => {
4526-
let def = DefStruct(def_id);
4527-
debug!("(resolving struct) resolved `{}` to type {:?}",
4528-
token::get_ident(path.segments
4529-
.last().unwrap()
4530-
.identifier),
4531-
def);
4532-
debug!("(resolving struct) writing resolution for `{}` (id {})",
4533-
this.path_idents_to_string(path),
4534-
path_id);
4535-
this.record_def(path_id, (def, lp));
4536-
}
4537-
Some((DefStruct(_), _)) => {
4538-
span_err!(this.session, t.span, E0154,
4539-
"super-struct is defined in a different crate");
4540-
},
4541-
Some(_) => {
4542-
span_err!(this.session, t.span, E0155,
4543-
"super-struct is not a struct type");
4544-
}
4545-
None => {
4546-
span_err!(this.session, t.span, E0156,
4547-
"super-struct could not be resolved");
4548-
}
4549-
}
4550-
},
4551-
_ => this.session.span_bug(t.span, "path not mapped to a TyPath")
4552-
},
4553-
None => {}
4554-
}
4555-
45564517
// Resolve fields.
45574518
for field in fields.iter() {
45584519
this.resolve_type(&*field.node.ty);
@@ -5112,10 +5073,15 @@ impl<'a> Resolver<'a> {
51125073
Some(def @ (DefFn(..), _)) |
51135074
Some(def @ (DefVariant(..), _)) |
51145075
Some(def @ (DefStruct(..), _)) |
5115-
Some(def @ (DefConst(..), _)) |
5116-
Some(def @ (DefStatic(..), _)) => {
5076+
Some(def @ (DefConst(..), _)) => {
51175077
self.record_def(pattern.id, def);
51185078
}
5079+
Some((DefStatic(..), _)) => {
5080+
self.resolve_error(path.span,
5081+
"static variables cannot be \
5082+
referenced in a pattern, \
5083+
use a `const` instead");
5084+
}
51195085
Some(_) => {
51205086
self.resolve_error(path.span,
51215087
format!("`{}` is not an enum variant, struct or const",

0 commit comments

Comments
 (0)