Skip to content

Commit b53a4d1

Browse files
committed
---
yaml --- r: 136059 b: refs/heads/master c: 7c8fc95 h: refs/heads/master i: 136057: c7d4ef1 136055: bd543cb v: v3
1 parent 1ca3d74 commit b53a4d1

File tree

25 files changed

+297
-152
lines changed

25 files changed

+297
-152
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: 1694bf64ba1764f8c7a84b83e2bbe34b1e0ab0ab
2+
refs/heads/master: 7c8fc95acae5bd570d1707787185f42442b66571
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 749ff5e76a0d08837964e44c66654679a3a88bb8
55
refs/heads/try: ca87704735687dad44b26788c773df2d87b3b710

trunk/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,7 @@ fn compose_and_run_compiler(
11961196

11971197
fn ensure_dir(path: &Path) {
11981198
if path.is_dir() { return; }
1199-
fs::mkdir(path, io::UserRWX).unwrap();
1199+
fs::mkdir(path, io::USER_RWX).unwrap();
12001200
}
12011201

12021202
fn compose_and_run(config: &Config, testfile: &Path,

trunk/src/libcollections/string.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,8 @@ impl String {
613613
///
614614
/// # Failure
615615
///
616-
/// Fails if `len` > current length.
616+
/// Fails if `new_len` > current length,
617+
/// or if `new_len` is not a character boundary.
617618
///
618619
/// # Example
619620
///
@@ -624,9 +625,9 @@ impl String {
624625
/// ```
625626
#[inline]
626627
#[unstable = "the failure conventions for strings are under development"]
627-
pub fn truncate(&mut self, len: uint) {
628-
assert!(self.as_slice().is_char_boundary(len));
629-
self.vec.truncate(len)
628+
pub fn truncate(&mut self, new_len: uint) {
629+
assert!(self.as_slice().is_char_boundary(new_len));
630+
self.vec.truncate(new_len)
630631
}
631632

632633
/// Appends a byte to this string buffer.

trunk/src/libnative/io/c_unix.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,9 @@ mod signal {
232232
pub static SA_SIGINFO: libc::c_int = 0x0040;
233233
pub static SIGCHLD: libc::c_int = 20;
234234

235-
#[cfg(target_os = "macos")]
236-
#[cfg(target_os = "ios")]
235+
#[cfg(any(target_os = "macos", target_os = "ios"))]
237236
pub type sigset_t = u32;
238-
#[cfg(target_os = "freebsd")]
239-
#[cfg(target_os = "dragonfly")]
237+
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
240238
#[repr(C)]
241239
pub struct sigset_t {
242240
bits: [u32, ..4],
@@ -254,8 +252,7 @@ mod signal {
254252
pub status: libc::c_int,
255253
}
256254

257-
#[cfg(target_os = "macos")]
258-
#[cfg(target_os = "ios")]
255+
#[cfg(any(target_os = "macos", target_os = "ios"))]
259256
#[repr(C)]
260257
pub struct sigaction {
261258
pub sa_handler: extern fn(libc::c_int),
@@ -264,8 +261,7 @@ mod signal {
264261
pub sa_flags: libc::c_int,
265262
}
266263

267-
#[cfg(target_os = "freebsd")]
268-
#[cfg(target_os = "dragonfly")]
264+
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
269265
#[repr(C)]
270266
pub struct sigaction {
271267
pub sa_handler: extern fn(libc::c_int),

trunk/src/librustc/back/link.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ pub fn invalid_output_for_target(sess: &Session,
466466
fn is_writeable(p: &Path) -> bool {
467467
match p.stat() {
468468
Err(..) => true,
469-
Ok(m) => m.perm & io::UserWrite == io::UserWrite
469+
Ok(m) => m.perm & io::USER_WRITE == io::USER_WRITE
470470
}
471471
}
472472

@@ -1025,10 +1025,10 @@ fn link_args(cmd: &mut Command,
10251025
cmd.arg("-Wl,--nxcompat");
10261026

10271027
// Mark all dynamic libraries and executables as compatible with ASLR
1028-
// FIXME #17098: ASLR breaks gdb
1029-
if sess.opts.debuginfo == NoDebugInfo {
1030-
cmd.arg("-Wl,--dynamicbase");
1031-
}
1028+
// FIXME #16514: ASLR is disabled on Windows due to MinGW-w64 bugs:
1029+
// FIXME #17098: ASLR breaks gdb on Windows
1030+
// FIXME #17684: ASLR breaks thread-local storage on Windows
1031+
//cmd.arg("-Wl,--dynamicbase");
10321032

10331033
// Mark all dynamic libraries and executables as compatible with the larger 4GiB address
10341034
// space available to x86 Windows binaries on x86_64.
@@ -1322,7 +1322,7 @@ fn add_upstream_rust_crates(cmd: &mut Command, sess: &Session,
13221322
// Fix up permissions of the copy, as fs::copy() preserves
13231323
// permissions, but the original file may have been installed
13241324
// by a package manager and may be read-only.
1325-
match fs::chmod(&dst, io::UserRead | io::UserWrite) {
1325+
match fs::chmod(&dst, io::USER_READ | io::USER_WRITE) {
13261326
Ok(..) => {}
13271327
Err(e) => {
13281328
sess.err(format!("failed to chmod {} when preparing \

trunk/src/librustc/diagnostics.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ register_diagnostics!(
3838
E0017,
3939
E0019,
4040
E0020,
41-
E0021,
4241
E0022,
4342
E0023,
4443
E0024,
@@ -62,7 +61,6 @@ register_diagnostics!(
6261
E0045,
6362
E0046,
6463
E0047,
65-
E0048,
6664
E0049,
6765
E0050,
6866
E0051,
@@ -117,8 +115,6 @@ register_diagnostics!(
117115
E0109,
118116
E0110,
119117
E0113,
120-
E0114,
121-
E0115,
122118
E0116,
123119
E0117,
124120
E0118,
@@ -152,5 +148,7 @@ register_diagnostics!(
152148
E0158,
153149
E0159,
154150
E0161,
155-
E0162
151+
E0162,
152+
E0163,
153+
E0164
156154
)

trunk/src/librustc/middle/save/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,7 @@ pub fn process_crate(sess: &Session,
14671467
},
14681468
};
14691469

1470-
match fs::mkdir_recursive(&root_path, io::UserRWX) {
1470+
match fs::mkdir_recursive(&root_path, io::USER_RWX) {
14711471
Err(e) => sess.err(format!("Could not create directory {}: {}",
14721472
root_path.display(), e).as_slice()),
14731473
_ => (),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ fn make_drop_glue<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v0: ValueRef, t: ty::t)
429429
tvec::make_drop_glue_unboxed(bcx, v0, ty, true)
430430
}
431431
ty::ty_str => {
432-
let unit_ty = ty::sequence_element_type(bcx.tcx(), t);
432+
let unit_ty = ty::sequence_element_type(bcx.tcx(), content_ty);
433433
tvec::make_drop_glue_unboxed(bcx, v0, unit_ty, true)
434434
}
435435
ty::ty_trait(..) => {

trunk/src/librustc/middle/typeck/check/_match.rs

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -382,26 +382,43 @@ pub fn check_struct_like_enum_variant_pat(pcx: &pat_ctxt,
382382

383383
// Find the variant that was specified.
384384
match tcx.def_map.borrow().find(&pat_id) {
385-
Some(&def::DefVariant(found_enum_id, variant_id, _))
385+
Some(&def::DefVariant(found_enum_id, variant_id, true))
386386
if found_enum_id == enum_id => {
387387
// Get the struct fields from this struct-like enum variant.
388-
let class_fields = ty::lookup_struct_fields(tcx, variant_id);
389-
390-
check_struct_pat_fields(pcx, span, fields, class_fields,
388+
let struct_fields = ty::lookup_struct_fields(tcx, variant_id);
389+
check_struct_pat_fields(pcx, span, fields, struct_fields,
391390
variant_id, substitutions, etc);
391+
fcx.write_ty(pat_id, expected);
392+
}
393+
Some(&def::DefVariant(_, _, false)) => {
394+
let name = pprust::path_to_string(path);
395+
span_err!(tcx.sess, span, E0163,
396+
"`{}` does not name a struct variant", name);
397+
fcx.write_error(pat_id);
398+
}
399+
Some(&def::DefVariant(_, _, true)) => {
400+
let name = pprust::path_to_string(path);
401+
span_err!(tcx.sess, span, E0164,
402+
"`{}` does not name a variant of the type being matched against", name);
403+
fcx.write_error(pat_id);
392404
}
393405
Some(&def::DefStruct(..)) |
394-
Some(&def::DefVariant(..)) |
395406
Some(&def::DefTy(..)) => {
396407
let name = pprust::path_to_string(path);
397408
span_err!(tcx.sess, span, E0028,
398-
"mismatched types: expected `{}`, found `{}`",
399-
fcx.infcx().ty_to_string(expected), name);
409+
"`{}` does not name a variant", name);
410+
fcx.write_error(pat_id);
400411
}
401412
_ => {
402413
tcx.sess.span_bug(span, "resolve didn't write in variant");
403414
}
404415
}
416+
417+
if ty::type_is_error(fcx.node_ty(pat_id)) {
418+
for field in fields.iter() {
419+
check_pat(pcx, &*field.pat, ty::mk_err());
420+
}
421+
}
405422
}
406423

407424
// Pattern checking is top-down rather than bottom-up so that bindings get

trunk/src/librustc/middle/typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4330,7 +4330,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
43304330
// Resolve the path.
43314331
let def = tcx.def_map.borrow().find(&id).map(|i| *i);
43324332
let struct_id = match def {
4333-
Some(def::DefVariant(enum_id, variant_id, _)) => {
4333+
Some(def::DefVariant(enum_id, variant_id, true)) => {
43344334
check_struct_enum_variant(fcx, id, expr.span, enum_id,
43354335
variant_id, fields.as_slice());
43364336
enum_id

trunk/src/librustc_back/fs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ mod test {
6868
let linkdir = tmpdir.join("test3");
6969

7070
File::create(&file).unwrap();
71-
mkdir(&dir, io::UserRWX).unwrap();
71+
mkdir(&dir, io::USER_RWX).unwrap();
7272
symlink(&file, &link).unwrap();
7373
symlink(&dir, &linkdir).unwrap();
7474

@@ -91,8 +91,8 @@ mod test {
9191
let e = d.join("e");
9292
let f = a.join("f");
9393

94-
mkdir_recursive(&b, io::UserRWX).unwrap();
95-
mkdir_recursive(&d, io::UserRWX).unwrap();
94+
mkdir_recursive(&b, io::USER_RWX).unwrap();
95+
mkdir_recursive(&d, io::USER_RWX).unwrap();
9696
File::create(&f).unwrap();
9797
symlink(&Path::new("../d/e"), &c).unwrap();
9898
symlink(&Path::new("../f"), &e).unwrap();

trunk/src/librustdoc/html/render.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ fn write(dst: Path, contents: &[u8]) -> io::IoResult<()> {
618618
/// skipping if the directory already exists.
619619
fn mkdir(path: &Path) -> io::IoResult<()> {
620620
if !path.exists() {
621-
fs::mkdir(path, io::UserRWX)
621+
fs::mkdir(path, io::USER_RWX)
622622
} else {
623623
Ok(())
624624
}

trunk/src/libstd/bitflags.rs

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@
2424
/// ```{.rust}
2525
/// bitflags! {
2626
/// flags Flags: u32 {
27-
/// static FlagA = 0x00000001,
28-
/// static FlagB = 0x00000010,
29-
/// static FlagC = 0x00000100,
30-
/// static FlagABC = FlagA.bits
31-
/// | FlagB.bits
32-
/// | FlagC.bits,
27+
/// static FLAG_A = 0x00000001,
28+
/// static FLAG_B = 0x00000010,
29+
/// static FLAG_C = 0x00000100,
30+
/// static FLAG_ABC = FLAG_A.bits
31+
/// | FLAG_B.bits
32+
/// | FLAG_C.bits,
3333
/// }
3434
/// }
3535
///
3636
/// fn main() {
37-
/// let e1 = FlagA | FlagC;
38-
/// let e2 = FlagB | FlagC;
39-
/// assert!((e1 | e2) == FlagABC); // union
40-
/// assert!((e1 & e2) == FlagC); // intersection
41-
/// assert!((e1 - e2) == FlagA); // set difference
42-
/// assert!(!e2 == FlagA); // set complement
37+
/// let e1 = FLAG_A | FLAG_C;
38+
/// let e2 = FLAG_B | FLAG_C;
39+
/// assert!((e1 | e2) == FLAG_ABC); // union
40+
/// assert!((e1 & e2) == FLAG_C); // intersection
41+
/// assert!((e1 - e2) == FLAG_A); // set difference
42+
/// assert!(!e2 == FLAG_A); // set complement
4343
/// }
4444
/// ```
4545
///
@@ -50,8 +50,8 @@
5050
///
5151
/// bitflags! {
5252
/// flags Flags: u32 {
53-
/// static FlagA = 0x00000001,
54-
/// static FlagB = 0x00000010,
53+
/// static FLAG_A = 0x00000001,
54+
/// static FLAG_B = 0x00000010,
5555
/// }
5656
/// }
5757
///
@@ -69,7 +69,7 @@
6969
/// }
7070
///
7171
/// fn main() {
72-
/// let mut flags = FlagA | FlagB;
72+
/// let mut flags = FLAG_A | FLAG_B;
7373
/// flags.clear();
7474
/// assert!(flags.is_empty());
7575
/// assert_eq!(format!("{}", flags).as_slice(), "hi!");
@@ -123,10 +123,7 @@ macro_rules! bitflags {
123123
bits: $T,
124124
}
125125

126-
$(
127-
#[allow(non_uppercase_statics)]
128-
$(#[$Flag_attr])* pub static $Flag: $BitFlags = $BitFlags { bits: $value };
129-
)+
126+
$($(#[$Flag_attr])* pub static $Flag: $BitFlags = $BitFlags { bits: $value };)+
130127

131128
impl $BitFlags {
132129
/// Returns an empty set of flags.
@@ -243,16 +240,14 @@ macro_rules! bitflags {
243240
bitflags! {
244241
$(#[$attr])*
245242
flags $BitFlags: $T {
246-
$(
247-
#[allow(non_uppercase_statics)]
248-
$(#[$Flag_attr])* static $Flag = $value
249-
),+
243+
$($(#[$Flag_attr])* static $Flag = $value),+
250244
}
251245
}
252246
};
253247
}
254248

255249
#[cfg(test)]
250+
#[allow(non_uppercase_statics)]
256251
mod tests {
257252
use hash;
258253
use option::{Some, None};

0 commit comments

Comments
 (0)