Skip to content

Commit de10a82

Browse files
committed
---
yaml --- r: 161702 b: refs/heads/master c: 2018510 h: refs/heads/master v: v3
1 parent 830f3ec commit de10a82

Some content is hidden

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

45 files changed

+1377
-914
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: 21ba1d5e58144c83093a8cbb467a6c9cb12fc4a1
2+
refs/heads/master: 2018510dd9578b9c3ca25d574130056f9c36aaf9
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cafe2966770ff377aad6dd9fd808e68055587c58
55
refs/heads/try: 0f0d21c1eb5c7be04d323e0b06faf252ad790af6

trunk/src/liblibc/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ pub use funcs::bsd43::{shutdown};
192192
#[cfg(unix)] pub use types::os::arch::posix01::{stat, utimbuf};
193193
#[cfg(unix)] pub use types::os::common::bsd44::{ifaddrs};
194194
#[cfg(unix)] pub use funcs::posix88::unistd::{sysconf, setgid, setsid, setuid, pread, pwrite};
195-
#[cfg(unix)] pub use funcs::posix88::unistd::{getgid, getuid};
195+
#[cfg(unix)] pub use funcs::posix88::unistd::{getgid, getuid, getsid};
196196
#[cfg(unix)] pub use funcs::posix88::unistd::{_PC_NAME_MAX, utime, nanosleep, pathconf, link};
197197
#[cfg(unix)] pub use funcs::posix88::unistd::{chown};
198198
#[cfg(unix)] pub use funcs::posix88::mman::{mmap, munmap, mprotect};
@@ -4402,6 +4402,7 @@ pub mod funcs {
44024402
pub fn getpid() -> pid_t;
44034403
pub fn getppid() -> pid_t;
44044404
pub fn getuid() -> uid_t;
4405+
pub fn getsid(pid: pid_t) -> pid_t;
44054406
pub fn isatty(fd: c_int) -> c_int;
44064407
pub fn link(src: *const c_char, dst: *const c_char) -> c_int;
44074408
pub fn lseek(fd: c_int, offset: off_t, whence: c_int)

trunk/src/librustc/lint/builtin.rs

Lines changed: 153 additions & 86 deletions
Large diffs are not rendered by default.

trunk/src/librustc/metadata/decoder.rs

Lines changed: 44 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -514,27 +514,41 @@ fn each_child_of_item_or_crate(intr: Rc<IdentInterner>,
514514
let inherent_impl_def_id = item_def_id(inherent_impl_def_id_doc,
515515
cdata);
516516
let items = reader::get_doc(rbml::Doc::new(cdata.data()), tag_items);
517-
if let Some(inherent_impl_doc) = maybe_find_item(inherent_impl_def_id.node, items) {
518-
let _ = reader::tagged_docs(inherent_impl_doc,
519-
tag_item_impl_item,
520-
|impl_item_def_id_doc| {
521-
let impl_item_def_id = item_def_id(impl_item_def_id_doc,
522-
cdata);
523-
if let Some(impl_method_doc) = maybe_find_item(impl_item_def_id.node, items) {
524-
if let StaticMethod = item_family(impl_method_doc) {
525-
// Hand off the static method to the callback.
526-
let static_method_name = item_name(&*intr, impl_method_doc);
527-
let static_method_def_like = item_to_def_like(impl_method_doc,
528-
impl_item_def_id,
529-
cdata.cnum);
530-
callback(static_method_def_like,
531-
static_method_name,
532-
item_visibility(impl_method_doc));
517+
match maybe_find_item(inherent_impl_def_id.node, items) {
518+
None => {}
519+
Some(inherent_impl_doc) => {
520+
let _ = reader::tagged_docs(inherent_impl_doc,
521+
tag_item_impl_item,
522+
|impl_item_def_id_doc| {
523+
let impl_item_def_id = item_def_id(impl_item_def_id_doc,
524+
cdata);
525+
match maybe_find_item(impl_item_def_id.node, items) {
526+
None => {}
527+
Some(impl_method_doc) => {
528+
match item_family(impl_method_doc) {
529+
StaticMethod => {
530+
// Hand off the static method
531+
// to the callback.
532+
let static_method_name =
533+
item_name(&*intr, impl_method_doc);
534+
let static_method_def_like =
535+
item_to_def_like(impl_method_doc,
536+
impl_item_def_id,
537+
cdata.cnum);
538+
callback(static_method_def_like,
539+
static_method_name,
540+
item_visibility(impl_method_doc));
541+
}
542+
_ => {}
543+
}
544+
}
533545
}
534-
}
535-
true
536-
});
546+
547+
true
548+
});
549+
}
537550
}
551+
538552
true
539553
});
540554

@@ -564,14 +578,17 @@ fn each_child_of_item_or_crate(intr: Rc<IdentInterner>,
564578
let other_crates_items = reader::get_doc(rbml::Doc::new(crate_data.data()), tag_items);
565579

566580
// Get the item.
567-
if let Some(child_item_doc) = maybe_find_item(child_def_id.node, other_crates_items) {
568-
// Hand off the item to the callback.
569-
let def_like = item_to_def_like(child_item_doc,
570-
child_def_id,
571-
child_def_id.krate);
572-
// These items have a public visibility because they're part of
573-
// a public re-export.
574-
callback(def_like, token::intern(name), ast::Public);
581+
match maybe_find_item(child_def_id.node, other_crates_items) {
582+
None => {}
583+
Some(child_item_doc) => {
584+
// Hand off the item to the callback.
585+
let def_like = item_to_def_like(child_item_doc,
586+
child_def_id,
587+
child_def_id.krate);
588+
// These items have a public visibility because they're part of
589+
// a public re-export.
590+
callback(def_like, token::intern(name), ast::Public);
591+
}
575592
}
576593

577594
true

trunk/src/librustc/metadata/encoder.rs

Lines changed: 86 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -433,13 +433,17 @@ fn encode_reexported_static_trait_methods(ecx: &EncodeContext,
433433
match ecx.tcx.trait_items_cache.borrow().get(&exp.def_id) {
434434
Some(trait_items) => {
435435
for trait_item in trait_items.iter() {
436-
if let ty::MethodTraitItem(ref m) = *trait_item {
437-
encode_reexported_static_method(rbml_w,
438-
exp,
439-
m.def_id,
440-
m.name);
436+
match *trait_item {
437+
ty::MethodTraitItem(ref m) => {
438+
encode_reexported_static_method(rbml_w,
439+
exp,
440+
m.def_id,
441+
m.name);
442+
}
443+
_ => {}
441444
}
442445
}
446+
443447
true
444448
}
445449
None => { false }
@@ -450,42 +454,46 @@ fn encode_reexported_static_methods(ecx: &EncodeContext,
450454
rbml_w: &mut Encoder,
451455
mod_path: PathElems,
452456
exp: &middle::resolve::Export2) {
453-
if let Some(ast_map::NodeItem(item)) = ecx.tcx.map.find(exp.def_id.node) {
454-
let original_name = token::get_ident(item.ident);
455-
456-
let path_differs = ecx.tcx.map.with_path(exp.def_id.node, |path| {
457-
let (mut a, mut b) = (path, mod_path.clone());
458-
loop {
459-
match (a.next(), b.next()) {
460-
(None, None) => return true,
461-
(None, _) | (_, None) => return false,
462-
(Some(x), Some(y)) => if x != y { return false },
457+
match ecx.tcx.map.find(exp.def_id.node) {
458+
Some(ast_map::NodeItem(item)) => {
459+
let original_name = token::get_ident(item.ident);
460+
461+
let path_differs = ecx.tcx.map.with_path(exp.def_id.node, |path| {
462+
let (mut a, mut b) = (path, mod_path.clone());
463+
loop {
464+
match (a.next(), b.next()) {
465+
(None, None) => return true,
466+
(None, _) | (_, None) => return false,
467+
(Some(x), Some(y)) => if x != y { return false },
468+
}
463469
}
464-
}
465-
});
470+
});
466471

467-
//
468-
// We don't need to reexport static methods on items
469-
// declared in the same module as our `pub use ...` since
470-
// that's done when we encode the item itself.
471-
//
472-
// The only exception is when the reexport *changes* the
473-
// name e.g. `pub use Foo = self::Bar` -- we have
474-
// encoded metadata for static methods relative to Bar,
475-
// but not yet for Foo.
476-
//
477-
if path_differs || original_name.get() != exp.name.as_slice() {
478-
if !encode_reexported_static_base_methods(ecx, rbml_w, exp) {
479-
if encode_reexported_static_trait_methods(ecx, rbml_w, exp) {
480-
debug!("(encode reexported static methods) {} [trait]",
481-
original_name);
472+
//
473+
// We don't need to reexport static methods on items
474+
// declared in the same module as our `pub use ...` since
475+
// that's done when we encode the item itself.
476+
//
477+
// The only exception is when the reexport *changes* the
478+
// name e.g. `pub use Foo = self::Bar` -- we have
479+
// encoded metadata for static methods relative to Bar,
480+
// but not yet for Foo.
481+
//
482+
if path_differs || original_name.get() != exp.name.as_slice() {
483+
if !encode_reexported_static_base_methods(ecx, rbml_w, exp) {
484+
if encode_reexported_static_trait_methods(ecx, rbml_w, exp) {
485+
debug!("(encode reexported static methods) {} \
486+
[trait]",
487+
original_name);
488+
}
489+
}
490+
else {
491+
debug!("(encode reexported static methods) {} [base]",
492+
original_name);
482493
}
483-
}
484-
else {
485-
debug!("(encode reexported static methods) {} [base]",
486-
original_name);
487494
}
488495
}
496+
_ => {}
489497
}
490498
}
491499

@@ -573,15 +581,19 @@ fn encode_info_for_mod(ecx: &EncodeContext,
573581
true
574582
});
575583

576-
if let ast::ItemImpl(..) = item.node {
577-
let (ident, did) = (item.ident, item.id);
578-
debug!("(encoding info for module) ... encoding impl {} ({}/{})",
579-
token::get_ident(ident),
580-
did, ecx.tcx.map.node_to_string(did));
584+
match item.node {
585+
ast::ItemImpl(..) => {
586+
let (ident, did) = (item.ident, item.id);
587+
debug!("(encoding info for module) ... encoding impl {} \
588+
({}/{})",
589+
token::get_ident(ident),
590+
did, ecx.tcx.map.node_to_string(did));
581591

582-
rbml_w.start_tag(tag_mod_impl);
583-
rbml_w.wr_str(def_to_string(local_def(did)).as_slice());
584-
rbml_w.end_tag();
592+
rbml_w.start_tag(tag_mod_impl);
593+
rbml_w.wr_str(def_to_string(local_def(did)).as_slice());
594+
rbml_w.end_tag();
595+
}
596+
_ => {}
585597
}
586598
}
587599

@@ -911,9 +923,12 @@ fn encode_method_argument_names(rbml_w: &mut Encoder,
911923
rbml_w.start_tag(tag_method_argument_names);
912924
for arg in decl.inputs.iter() {
913925
rbml_w.start_tag(tag_method_argument_name);
914-
if let ast::PatIdent(_, ref path1, _) = arg.pat.node {
915-
let name = token::get_ident(path1.node);
916-
rbml_w.writer.write(name.get().as_bytes());
926+
match arg.pat.node {
927+
ast::PatIdent(_, ref path1, _) => {
928+
let name = token::get_ident(path1.node);
929+
rbml_w.writer.write(name.get().as_bytes());
930+
}
931+
_ => {}
917932
}
918933
rbml_w.end_tag();
919934
}
@@ -1839,19 +1854,22 @@ struct ImplVisitor<'a, 'b:'a, 'c:'a, 'tcx:'b> {
18391854

18401855
impl<'a, 'b, 'c, 'tcx, 'v> Visitor<'v> for ImplVisitor<'a, 'b, 'c, 'tcx> {
18411856
fn visit_item(&mut self, item: &ast::Item) {
1842-
if let ast::ItemImpl(_, Some(ref trait_ref), _, _) = item.node {
1843-
let def_map = &self.ecx.tcx.def_map;
1844-
let trait_def = def_map.borrow()[trait_ref.ref_id].clone();
1845-
let def_id = trait_def.def_id();
1846-
1847-
// Load eagerly if this is an implementation of the Drop trait
1848-
// or if the trait is not defined in this crate.
1849-
if Some(def_id) == self.ecx.tcx.lang_items.drop_trait() ||
1850-
def_id.krate != ast::LOCAL_CRATE {
1851-
self.rbml_w.start_tag(tag_impls_impl);
1852-
encode_def_id(self.rbml_w, local_def(item.id));
1853-
self.rbml_w.end_tag();
1857+
match item.node {
1858+
ast::ItemImpl(_, Some(ref trait_ref), _, _) => {
1859+
let def_map = &self.ecx.tcx.def_map;
1860+
let trait_def = def_map.borrow()[trait_ref.ref_id].clone();
1861+
let def_id = trait_def.def_id();
1862+
1863+
// Load eagerly if this is an implementation of the Drop trait
1864+
// or if the trait is not defined in this crate.
1865+
if Some(def_id) == self.ecx.tcx.lang_items.drop_trait() ||
1866+
def_id.krate != ast::LOCAL_CRATE {
1867+
self.rbml_w.start_tag(tag_impls_impl);
1868+
encode_def_id(self.rbml_w, local_def(item.id));
1869+
self.rbml_w.end_tag();
1870+
}
18541871
}
1872+
_ => {}
18551873
}
18561874
visit::walk_item(self, item);
18571875
}
@@ -1913,12 +1931,17 @@ fn encode_reachable_extern_fns(ecx: &EncodeContext, rbml_w: &mut Encoder) {
19131931
rbml_w.start_tag(tag_reachable_extern_fns);
19141932

19151933
for id in ecx.reachable.iter() {
1916-
if let Some(ast_map::NodeItem(i)) = ecx.tcx.map.find(*id) {
1917-
if let ast::ItemFn(_, _, abi, ref generics, _) = i.node {
1918-
if abi != abi::Rust && !generics.is_type_parameterized() {
1919-
rbml_w.wr_tagged_u32(tag_reachable_extern_fn_id, *id);
1934+
match ecx.tcx.map.find(*id) {
1935+
Some(ast_map::NodeItem(i)) => {
1936+
match i.node {
1937+
ast::ItemFn(_, _, abi, ref generics, _)
1938+
if abi != abi::Rust && !generics.is_type_parameterized() => {
1939+
rbml_w.wr_tagged_u32(tag_reachable_extern_fn_id, *id);
1940+
}
1941+
_ => {}
19201942
}
19211943
}
1944+
_ => {}
19221945
}
19231946
}
19241947

trunk/src/librustc/middle/borrowck/check_loans.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -892,9 +892,14 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
892892
let guarantor = cmt.guarantor();
893893
debug!("check_for_aliasable_mutable_writes(cmt={}, guarantor={})",
894894
cmt.repr(this.tcx()), guarantor.repr(this.tcx()));
895-
if let mc::cat_deref(ref b, _, mc::BorrowedPtr(ty::MutBorrow, _)) = guarantor.cat {
896-
// Statically prohibit writes to `&mut` when aliasable
897-
check_for_aliasability_violation(this, span, b.clone());
895+
match guarantor.cat {
896+
mc::cat_deref(ref b, _, mc::BorrowedPtr(ty::MutBorrow, _)) => {
897+
// Statically prohibit writes to `&mut` when aliasable
898+
899+
check_for_aliasability_violation(this, span, b.clone());
900+
}
901+
902+
_ => {}
898903
}
899904

900905
return true; // no errors reported
@@ -957,3 +962,4 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
957962
self.bccx.loan_path_to_string(loan_path)).as_slice());
958963
}
959964
}
965+

trunk/src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,12 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> {
9797
cmt.repr(self.tcx()),
9898
mode);
9999

100-
if let mc::cat_downcast(..) = cmt.cat {
101-
gather_moves::gather_match_variant(
102-
self.bccx, &self.move_data, &self.move_error_collector,
103-
matched_pat, cmt, mode);
100+
match cmt.cat {
101+
mc::cat_downcast(..) =>
102+
gather_moves::gather_match_variant(
103+
self.bccx, &self.move_data, &self.move_error_collector,
104+
matched_pat, cmt, mode),
105+
_ => {}
104106
}
105107
}
106108

@@ -487,14 +489,17 @@ struct StaticInitializerCtxt<'a, 'tcx: 'a> {
487489

488490
impl<'a, 'tcx, 'v> Visitor<'v> for StaticInitializerCtxt<'a, 'tcx> {
489491
fn visit_expr(&mut self, ex: &Expr) {
490-
if let ast::ExprAddrOf(mutbl, ref base) = ex.node {
491-
let base_cmt = self.bccx.cat_expr(&**base);
492-
let borrow_kind = ty::BorrowKind::from_mutbl(mutbl);
493-
// Check that we don't allow borrows of unsafe static items.
494-
if check_aliasability(self.bccx, ex.span, euv::AddrOf,
495-
base_cmt, borrow_kind).is_err() {
496-
return; // reported an error, no sense in reporting more.
492+
match ex.node {
493+
ast::ExprAddrOf(mutbl, ref base) => {
494+
let base_cmt = self.bccx.cat_expr(&**base);
495+
let borrow_kind = ty::BorrowKind::from_mutbl(mutbl);
496+
// Check that we don't allow borrows of unsafe static items.
497+
if check_aliasability(self.bccx, ex.span, euv::AddrOf,
498+
base_cmt, borrow_kind).is_err() {
499+
return; // reported an error, no sense in reporting more.
500+
}
497501
}
502+
_ => {}
498503
}
499504

500505
visit::walk_expr(self, ex);

0 commit comments

Comments
 (0)