Skip to content

Commit 6670f6c

Browse files
committed
---
yaml --- r: 136063 b: refs/heads/master c: 0d94fda h: refs/heads/master i: 136061: 0f3147a 136059: b53a4d1 136055: bd543cb 136047: af409e0 136031: fb7c7bd 135999: 0143691 135935: 73b2e1b v: v3
1 parent d6c5828 commit 6670f6c

File tree

24 files changed

+339
-190
lines changed

24 files changed

+339
-190
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: 893a114db54ec95c20596e485bc70dfeeeb2b66d
2+
refs/heads/master: 0d94fdaeb8b16b0f34c4bc03e7f95a18ffffba75
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/jemalloc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 2dba541881fb8e35246d653bbe2e7c7088777a4a
1+
Subproject commit b001609960ca33047e5cbc5a231c1e24b6041d4b

trunk/src/librustc/back/link.rs

Lines changed: 2 additions & 2 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

@@ -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/debuginfo.rs

Lines changed: 76 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -456,60 +456,17 @@ impl TypeMap {
456456
let return_type_id = self.get_unique_type_id_as_string(return_type_id);
457457
unique_type_id.push_str(return_type_id.as_slice());
458458
},
459-
ty::ty_closure(box ty::ClosureTy { fn_style,
460-
onceness,
461-
store,
462-
ref bounds,
463-
ref sig,
464-
abi: _ }) => {
465-
if fn_style == ast::UnsafeFn {
466-
unique_type_id.push_str("unsafe ");
467-
}
468-
469-
if onceness == ast::Once {
470-
unique_type_id.push_str("once ");
471-
}
472-
473-
match store {
474-
ty::UniqTraitStore => unique_type_id.push_str("~|"),
475-
ty::RegionTraitStore(_, ast::MutMutable) => {
476-
unique_type_id.push_str("&mut|")
477-
}
478-
ty::RegionTraitStore(_, ast::MutImmutable) => {
479-
unique_type_id.push_str("&|")
480-
}
481-
};
482-
483-
for &parameter_type in sig.inputs.iter() {
484-
let parameter_type_id =
485-
self.get_unique_type_id_of_type(cx, parameter_type);
486-
let parameter_type_id =
487-
self.get_unique_type_id_as_string(parameter_type_id);
488-
unique_type_id.push_str(parameter_type_id.as_slice());
489-
unique_type_id.push_char(',');
490-
}
491-
492-
if sig.variadic {
493-
unique_type_id.push_str("...");
494-
}
495-
496-
unique_type_id.push_str("|->");
497-
498-
let return_type_id = self.get_unique_type_id_of_type(cx, sig.output);
499-
let return_type_id = self.get_unique_type_id_as_string(return_type_id);
500-
unique_type_id.push_str(return_type_id.as_slice());
501-
502-
unique_type_id.push_char(':');
503-
504-
for bound in bounds.builtin_bounds.iter() {
505-
match bound {
506-
ty::BoundSend => unique_type_id.push_str("Send"),
507-
ty::BoundSized => unique_type_id.push_str("Sized"),
508-
ty::BoundCopy => unique_type_id.push_str("Copy"),
509-
ty::BoundSync => unique_type_id.push_str("Sync"),
510-
};
511-
unique_type_id.push_char('+');
512-
}
459+
ty::ty_closure(box ref closure_ty) => {
460+
self.get_unique_type_id_of_closure_type(cx,
461+
closure_ty.clone(),
462+
&mut unique_type_id);
463+
},
464+
ty::ty_unboxed_closure(ref def_id, _) => {
465+
let closure_ty = cx.tcx().unboxed_closures.borrow()
466+
.find(def_id).unwrap().closure_type.clone();
467+
self.get_unique_type_id_of_closure_type(cx,
468+
closure_ty,
469+
&mut unique_type_id);
513470
},
514471
_ => {
515472
cx.sess().bug(format!("get_unique_type_id_of_type() - unexpected type: {}, {:?}",
@@ -581,6 +538,66 @@ impl TypeMap {
581538
}
582539
}
583540

541+
fn get_unique_type_id_of_closure_type(&mut self,
542+
cx: &CrateContext,
543+
closure_ty: ty::ClosureTy,
544+
unique_type_id: &mut String) {
545+
let ty::ClosureTy { fn_style,
546+
onceness,
547+
store,
548+
ref bounds,
549+
ref sig,
550+
abi: _ } = closure_ty;
551+
if fn_style == ast::UnsafeFn {
552+
unique_type_id.push_str("unsafe ");
553+
}
554+
555+
if onceness == ast::Once {
556+
unique_type_id.push_str("once ");
557+
}
558+
559+
match store {
560+
ty::UniqTraitStore => unique_type_id.push_str("~|"),
561+
ty::RegionTraitStore(_, ast::MutMutable) => {
562+
unique_type_id.push_str("&mut|")
563+
}
564+
ty::RegionTraitStore(_, ast::MutImmutable) => {
565+
unique_type_id.push_str("&|")
566+
}
567+
};
568+
569+
for &parameter_type in sig.inputs.iter() {
570+
let parameter_type_id =
571+
self.get_unique_type_id_of_type(cx, parameter_type);
572+
let parameter_type_id =
573+
self.get_unique_type_id_as_string(parameter_type_id);
574+
unique_type_id.push_str(parameter_type_id.as_slice());
575+
unique_type_id.push_char(',');
576+
}
577+
578+
if sig.variadic {
579+
unique_type_id.push_str("...");
580+
}
581+
582+
unique_type_id.push_str("|->");
583+
584+
let return_type_id = self.get_unique_type_id_of_type(cx, sig.output);
585+
let return_type_id = self.get_unique_type_id_as_string(return_type_id);
586+
unique_type_id.push_str(return_type_id.as_slice());
587+
588+
unique_type_id.push_char(':');
589+
590+
for bound in bounds.builtin_bounds.iter() {
591+
match bound {
592+
ty::BoundSend => unique_type_id.push_str("Send"),
593+
ty::BoundSized => unique_type_id.push_str("Sized"),
594+
ty::BoundCopy => unique_type_id.push_str("Copy"),
595+
ty::BoundSync => unique_type_id.push_str("Sync"),
596+
};
597+
unique_type_id.push_char('+');
598+
}
599+
}
600+
584601
// Get the UniqueTypeId for an enum variant. Enum variants are not really
585602
// types of their own, so they need special handling. We still need a
586603
// UniqueTypeId for them, since to debuginfo they *are* real types.
@@ -2903,6 +2920,11 @@ fn type_metadata(cx: &CrateContext,
29032920
ty::ty_closure(ref closurety) => {
29042921
subroutine_type_metadata(cx, unique_type_id, &closurety.sig, usage_site_span)
29052922
}
2923+
ty::ty_unboxed_closure(ref def_id, _) => {
2924+
let sig = cx.tcx().unboxed_closures.borrow()
2925+
.find(def_id).unwrap().closure_type.sig.clone();
2926+
subroutine_type_metadata(cx, unique_type_id, &sig, usage_site_span)
2927+
}
29062928
ty::ty_struct(def_id, ref substs) => {
29072929
prepare_struct_metadata(cx,
29082930
t,

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
}

0 commit comments

Comments
 (0)