From bf3ff77ec8c2049c3523842e341036a2c4c2281d Mon Sep 17 00:00:00 2001 From: rphmeier Date: Tue, 16 Feb 2016 20:31:52 -0500 Subject: [PATCH 1/9] Fix #31706 --- src/librustc_privacy/lib.rs | 2 +- src/test/compile-fail/privacy5.rs | 36 +++++++++++++++---------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 85c2fe0c0a5..865ecd79e27 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -710,7 +710,7 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> { NamedField(name) => format!("field `{}` of {} is private", name, struct_desc), UnnamedField(idx) => format!("field #{} of {} is private", - idx + 1, struct_desc), + idx, struct_desc), }; span_err!(self.tcx.sess, span, E0451, "{}", &msg[..]); diff --git a/src/test/compile-fail/privacy5.rs b/src/test/compile-fail/privacy5.rs index 83e13ff52f6..588c9be3065 100644 --- a/src/test/compile-fail/privacy5.rs +++ b/src/test/compile-fail/privacy5.rs @@ -63,25 +63,25 @@ fn this_crate() { let c = a::C(2, 3); //~ ERROR: cannot invoke tuple struct constructor let d = a::D(4); - let a::A(()) = a; //~ ERROR: field #1 of struct `a::A` is private + let a::A(()) = a; //~ ERROR: field #0 of struct `a::A` is private let a::A(_) = a; - match a { a::A(()) => {} } //~ ERROR: field #1 of struct `a::A` is private + match a { a::A(()) => {} } //~ ERROR: field #0 of struct `a::A` is private match a { a::A(_) => {} } let a::B(_) = b; - let a::B(_b) = b; //~ ERROR: field #1 of struct `a::B` is private + let a::B(_b) = b; //~ ERROR: field #0 of struct `a::B` is private match b { a::B(_) => {} } - match b { a::B(_b) => {} } //~ ERROR: field #1 of struct `a::B` is private - match b { a::B(1) => {} a::B(_) => {} } //~ ERROR: field #1 of struct `a::B` is private + match b { a::B(_b) => {} } //~ ERROR: field #0 of struct `a::B` is private + match b { a::B(1) => {} a::B(_) => {} } //~ ERROR: field #0 of struct `a::B` is private let a::C(_, _) = c; let a::C(_a, _) = c; - let a::C(_, _b) = c; //~ ERROR: field #2 of struct `a::C` is private - let a::C(_a, _b) = c; //~ ERROR: field #2 of struct `a::C` is private + let a::C(_, _b) = c; //~ ERROR: field #1 of struct `a::C` is private + let a::C(_a, _b) = c; //~ ERROR: field #1 of struct `a::C` is private match c { a::C(_, _) => {} } match c { a::C(_a, _) => {} } - match c { a::C(_, _b) => {} } //~ ERROR: field #2 of struct `a::C` is private - match c { a::C(_a, _b) => {} } //~ ERROR: field #2 of struct `a::C` is private + match c { a::C(_, _b) => {} } //~ ERROR: field #1 of struct `a::C` is private + match c { a::C(_a, _b) => {} } //~ ERROR: field #1 of struct `a::C` is private let a::D(_) = d; let a::D(_d) = d; @@ -101,30 +101,30 @@ fn xcrate() { let c = other::C(2, 3); //~ ERROR: cannot invoke tuple struct constructor let d = other::D(4); - let other::A(()) = a; //~ ERROR: field #1 of struct `other::A` is private + let other::A(()) = a; //~ ERROR: field #0 of struct `other::A` is private let other::A(_) = a; match a { other::A(()) => {} } - //~^ ERROR: field #1 of struct `other::A` is private + //~^ ERROR: field #0 of struct `other::A` is private match a { other::A(_) => {} } let other::B(_) = b; - let other::B(_b) = b; //~ ERROR: field #1 of struct `other::B` is private + let other::B(_b) = b; //~ ERROR: field #0 of struct `other::B` is private match b { other::B(_) => {} } match b { other::B(_b) => {} } - //~^ ERROR: field #1 of struct `other::B` is private + //~^ ERROR: field #0 of struct `other::B` is private match b { other::B(1) => {} other::B(_) => {} } - //~^ ERROR: field #1 of struct `other::B` is private + //~^ ERROR: field #0 of struct `other::B` is private let other::C(_, _) = c; let other::C(_a, _) = c; - let other::C(_, _b) = c; //~ ERROR: field #2 of struct `other::C` is private - let other::C(_a, _b) = c; //~ ERROR: field #2 of struct `other::C` is private + let other::C(_, _b) = c; //~ ERROR: field #1 of struct `other::C` is private + let other::C(_a, _b) = c; //~ ERROR: field #1 of struct `other::C` is private match c { other::C(_, _) => {} } match c { other::C(_a, _) => {} } match c { other::C(_, _b) => {} } - //~^ ERROR: field #2 of struct `other::C` is private + //~^ ERROR: field #1 of struct `other::C` is private match c { other::C(_a, _b) => {} } - //~^ ERROR: field #2 of struct `other::C` is private + //~^ ERROR: field #1 of struct `other::C` is private let other::D(_) = d; let other::D(_d) = d; From 94499e3385fd42b2dbc75614e867183dd63c529a Mon Sep 17 00:00:00 2001 From: rphmeier Date: Tue, 16 Feb 2016 21:31:50 -0500 Subject: [PATCH 2/9] Fix sentence in E0451 diagnostic. --- src/librustc_privacy/diagnostics.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc_privacy/diagnostics.rs b/src/librustc_privacy/diagnostics.rs index d124ead5091..673960338ea 100644 --- a/src/librustc_privacy/diagnostics.rs +++ b/src/librustc_privacy/diagnostics.rs @@ -205,8 +205,8 @@ let f = Bar::Foo{ a: 0, b: 0 }; // error: field `b` of struct `Bar::Foo` // is private ``` -To fix this error, please ensure that all the fields of the struct, or -implement a function for easy instantiation. Examples: +To fix this error, please ensure that all the fields of the struct are public, +or implement a function for easy instantiation. Examples: ``` mod Bar { From aeda8445a7295b7ca9e836db8c0328829cd6ee21 Mon Sep 17 00:00:00 2001 From: Dave Huseby Date: Wed, 17 Feb 2016 21:40:33 +0000 Subject: [PATCH 3/9] fixes a small netbsd compile error --- src/libstd/os/netbsd/raw.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libstd/os/netbsd/raw.rs b/src/libstd/os/netbsd/raw.rs index 7eb3f6d47d1..bc30c1a7f48 100644 --- a/src/libstd/os/netbsd/raw.rs +++ b/src/libstd/os/netbsd/raw.rs @@ -46,9 +46,9 @@ pub struct stat { #[stable(feature = "raw_ext", since = "1.1.0")] pub st_nlink: u32, #[stable(feature = "raw_ext", since = "1.1.0")] - pub st_uid: u32, + pub st_uid: uid_t, #[stable(feature = "raw_ext", since = "1.1.0")] - pub st_gid: u32, + pub st_gid: gid_t, #[stable(feature = "raw_ext", since = "1.1.0")] pub st_rdev: u64, #[stable(feature = "raw_ext", since = "1.1.0")] From ed015456a114ae907a36af80c06f81ea93182a24 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 17 Feb 2016 16:24:00 -0800 Subject: [PATCH 4/9] std: Prefix jemalloc symbols on iOS Similar to OSX, these symbols are prefixed by default. --- src/liballoc_jemalloc/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/liballoc_jemalloc/lib.rs b/src/liballoc_jemalloc/lib.rs index bda001eb4f4..c96d303e6bb 100644 --- a/src/liballoc_jemalloc/lib.rs +++ b/src/liballoc_jemalloc/lib.rs @@ -45,19 +45,19 @@ extern {} // explicitly request it), and on Android we explicitly request it as // unprefixing cause segfaults (mismatches in allocators). extern { - #[cfg_attr(any(target_os = "macos", target_os = "android"), + #[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios"), link_name = "je_mallocx")] fn mallocx(size: size_t, flags: c_int) -> *mut c_void; - #[cfg_attr(any(target_os = "macos", target_os = "android"), + #[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios"), link_name = "je_rallocx")] fn rallocx(ptr: *mut c_void, size: size_t, flags: c_int) -> *mut c_void; - #[cfg_attr(any(target_os = "macos", target_os = "android"), + #[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios"), link_name = "je_xallocx")] fn xallocx(ptr: *mut c_void, size: size_t, extra: size_t, flags: c_int) -> size_t; - #[cfg_attr(any(target_os = "macos", target_os = "android"), + #[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios"), link_name = "je_sdallocx")] fn sdallocx(ptr: *mut c_void, size: size_t, flags: c_int); - #[cfg_attr(any(target_os = "macos", target_os = "android"), + #[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios"), link_name = "je_nallocx")] fn nallocx(size: size_t, flags: c_int) -> size_t; } From 761e26be680e4ef308a0609a5bcf12e2dabde623 Mon Sep 17 00:00:00 2001 From: ggomez Date: Thu, 18 Feb 2016 11:38:59 +0100 Subject: [PATCH 5/9] Add another email address corresponding to Guillaume Gomez account --- .mailmap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index 317a92b8f43..e0759cb8563 100644 --- a/.mailmap +++ b/.mailmap @@ -82,7 +82,7 @@ Gareth Daniel Smith Gareth Smith Graham Fawcett Graham Fawcett Graydon Hoare Graydon Hoare -Guillaume Gomez +Guillaume Gomez Guillaume Gomez Heather Heather Herman J. Radtke III Herman J. Radtke III From ba97cd9ad4d67c3375c6b703b0ff453b71a4d857 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Thu, 18 Feb 2016 22:46:03 +0200 Subject: [PATCH 6/9] doc: remove a word that makes the sentence hard to read --- src/libstd/env.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/env.rs b/src/libstd/env.rs index fa48efb2788..559caad2d1f 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -603,7 +603,7 @@ impl ExactSizeIterator for ArgsOs { /// Constants associated with the current target #[stable(feature = "env", since = "1.0.0")] pub mod consts { - /// A string describing the architecture of the CPU that this is currently + /// A string describing the architecture of the CPU that is currently /// in use. /// /// Some possible values: From 2cf226bd7efbf91f80503093709eb22b882eb1fd Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Thu, 18 Feb 2016 22:59:03 +0200 Subject: [PATCH 7/9] doc: reduce overlong sentence --- src/libstd/env.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/env.rs b/src/libstd/env.rs index fa48efb2788..04c15ae320c 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -528,7 +528,7 @@ pub struct ArgsOs { inner: os_imp::Args } /// via the command line). /// /// The first element is traditionally the path to the executable, but it can be -/// set to arbitrary text, and it may not even exist, so this property should +/// set to arbitrary text, and may not even exist. This means this property should /// not be relied upon for security purposes. /// /// # Panics From 31c78cfe914e1e0987a8378c9e0a8a009cdeed05 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Thu, 18 Feb 2016 23:13:22 +0200 Subject: [PATCH 8/9] doc: make the sentence more simple --- src/libstd/env.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/env.rs b/src/libstd/env.rs index fa48efb2788..981a766dac2 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -534,7 +534,7 @@ pub struct ArgsOs { inner: os_imp::Args } /// # Panics /// /// The returned iterator will panic during iteration if any argument to the -/// process is not valid unicode. If this is not desired it is recommended to +/// process is not valid unicode. If this is not desired, /// use the `args_os` function instead. /// /// # Examples From 27f8c53344a0f5c2d9607380b64b94d515ed19ce Mon Sep 17 00:00:00 2001 From: nxnfufunezn Date: Fri, 19 Feb 2016 22:27:50 +0530 Subject: [PATCH 9/9] Fix error[E0518] not displayed for #[inline] on structs inside fns --- src/librustc/front/check_attr.rs | 1 + src/test/compile-fail/issue-31769.rs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 src/test/compile-fail/issue-31769.rs diff --git a/src/librustc/front/check_attr.rs b/src/librustc/front/check_attr.rs index cfd9d5bdaa7..085acc198d1 100644 --- a/src/librustc/front/check_attr.rs +++ b/src/librustc/front/check_attr.rs @@ -101,6 +101,7 @@ impl<'a, 'v> Visitor<'v> for CheckAttrVisitor<'a> { for attr in &item.attrs { self.check_attribute(attr, target); } + visit::walk_item(self, item); } } diff --git a/src/test/compile-fail/issue-31769.rs b/src/test/compile-fail/issue-31769.rs new file mode 100644 index 00000000000..4b5df7ea53c --- /dev/null +++ b/src/test/compile-fail/issue-31769.rs @@ -0,0 +1,14 @@ +// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + #[inline] struct Foo; //~ ERROR attribute should be applied to function + #[repr(C)] fn foo() {} //~ ERROR attribute should be applied to struct or enum +}