diff --git a/configure b/configure index c751ad9731a7db9ff5690d67105e017260a882ce..d529375277bd9ef682515bd03a0249a715a2d934 100755 --- a/configure +++ b/configure @@ -644,7 +644,6 @@ opt stage0-landing-pads 1 "enable landing pads during bootstrap with stage0" opt dist-host-only 0 "only install bins for the host architecture" opt inject-std-version 1 "inject the current compiler version of libstd into programs" opt llvm-version-check 1 "check if the LLVM version is supported, build anyway" -opt rustbuild 1 "use the rust and cargo based build system" opt codegen-tests 1 "run the src/test/codegen tests" opt option-checking 1 "complain about unrecognized options in this configure script" opt ninja 0 "build LLVM using the Ninja generator (for MSVC, requires building in the correct environment)" diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 27255b691009395eea81d67a3b9b217abea7b20f..caf2402f40c4baed766601db6158fee60bc98b33 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -315,7 +315,7 @@ class RustBuild(object): try: ostype = subprocess.check_output(['uname', '-s']).strip().decode(default_encoding) cputype = subprocess.check_output(['uname', '-m']).strip().decode(default_encoding) - except (subprocess.CalledProcessError, WindowsError): + except (subprocess.CalledProcessError, OSError): if sys.platform == 'win32': return 'x86_64-pc-windows-msvc' err = "uname not found" @@ -345,6 +345,21 @@ class RustBuild(object): ostype = 'unknown-openbsd' elif ostype == 'NetBSD': ostype = 'unknown-netbsd' + elif ostype == 'SunOS': + ostype = 'sun-solaris' + # On Solaris, uname -m will return a machine classification instead + # of a cpu type, so uname -p is recommended instead. However, the + # output from that option is too generic for our purposes (it will + # always emit 'i386' on x86/amd64 systems). As such, isainfo -k + # must be used instead. + try: + cputype = subprocess.check_output(['isainfo', + '-k']).strip().decode(default_encoding) + except (subprocess.CalledProcessError, OSError): + err = "isainfo not found" + if self.verbose: + raise Exception(err) + sys.exit(err) elif ostype == 'Darwin': ostype = 'apple-darwin' elif ostype.startswith('MINGW'): diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 3873b3535a07b5bacc8d61e3091ea2faf5ff4bef..9e3f117f9b20e15e2b0dc85f7137bed975b4dd18 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1213,7 +1213,7 @@ fn extend_with_element(&mut self, n: usize, value: T) { unsafe { let mut ptr = self.as_mut_ptr().offset(self.len() as isize); // Use SetLenOnDrop to work around bug where compiler - // may not realize the store through `ptr` trough self.set_len() + // may not realize the store through `ptr` through self.set_len() // don't alias. let mut local_len = SetLenOnDrop::new(&mut self.len); diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index ab44342ebf02fda0daf228f3f1abc524c9106c54..d130b0279a20d103756584fb7a35b2eb656c05e3 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -186,6 +186,7 @@ use marker::Unsize; use mem; use ops::{Deref, DerefMut, CoerceUnsized}; +use ptr; /// A mutable memory location. /// @@ -387,6 +388,32 @@ pub fn set(&self, val: T) { drop(old); } + /// Swaps the values of two Cells. + /// Difference with `std::mem::swap` is that this function doesn't require `&mut` reference. + /// + /// # Examples + /// + /// ``` + /// #![feature(move_cell)] + /// use std::cell::Cell; + /// + /// let c1 = Cell::new(5i32); + /// let c2 = Cell::new(10i32); + /// c1.swap(&c2); + /// assert_eq!(10, c1.get()); + /// assert_eq!(5, c2.get()); + /// ``` + #[inline] + #[unstable(feature = "move_cell", issue = "39264")] + pub fn swap(&self, other: &Self) { + if ptr::eq(self, other) { + return; + } + unsafe { + ptr::swap(self.value.get(), other.value.get()); + } + } + /// Replaces the contained value. /// /// # Examples diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 8329d3eeed9e54c628164ee1ff99fa22c0944eab..4b36e682f1e82e446428cde49efcda9a061450ab 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -4510,28 +4510,32 @@ fn check_path_parameter_count(&self, } }; - let count = |n| { - format!("{} parameter{}", n, if n == 1 { "" } else { "s" }) + let count_lifetime_params = |n| { + format!("{} lifetime parameter{}", n, if n == 1 { "" } else { "s" }) + }; + let count_type_params = |n| { + format!("{} type parameter{}", n, if n == 1 { "" } else { "s" }) }; // Check provided lifetime parameters. let lifetime_defs = segment.map_or(&[][..], |(_, generics)| &generics.regions); if lifetimes.len() > lifetime_defs.len() { + let expected_text = count_lifetime_params(lifetime_defs.len()); + let actual_text = count_lifetime_params(lifetimes.len()); struct_span_err!(self.tcx.sess, span, E0088, "too many lifetime parameters provided: \ - expected {}, found {}", - count(lifetime_defs.len()), - count(lifetimes.len())) - .span_label(span, &format!("unexpected lifetime parameter{}", - match lifetimes.len() { 1 => "", _ => "s" })) + expected at most {}, found {}", + expected_text, actual_text) + .span_label(span, &format!("expected {}", expected_text)) .emit(); } else if lifetimes.len() > 0 && lifetimes.len() < lifetime_defs.len() { + let expected_text = count_lifetime_params(lifetime_defs.len()); + let actual_text = count_lifetime_params(lifetimes.len()); struct_span_err!(self.tcx.sess, span, E0090, "too few lifetime parameters provided: \ - expected {}, found {}", - count(lifetime_defs.len()), - count(lifetimes.len())) - .span_label(span, &format!("too few lifetime parameters")) + expected {}, found {}", + expected_text, actual_text) + .span_label(span, &format!("expected {}", expected_text)) .emit(); } @@ -4552,29 +4556,27 @@ fn check_path_parameter_count(&self, .count(); if types.len() > type_defs.len() { let span = types[type_defs.len()].span; + let expected_text = count_type_params(type_defs.len()); + let actual_text = count_type_params(types.len()); struct_span_err!(self.tcx.sess, span, E0087, "too many type parameters provided: \ expected at most {}, found {}", - count(type_defs.len()), - count(types.len())) - .span_label(span, &format!("too many type parameters")).emit(); + expected_text, actual_text) + .span_label(span, &format!("expected {}", expected_text)) + .emit(); // To prevent derived errors to accumulate due to extra // type parameters, we force instantiate_value_path to // use inference variables instead of the provided types. *segment = None; } else if !infer_types && types.len() < required_len { - let adjust = |len| if len > 1 { "parameters" } else { "parameter" }; - let required_param_str = adjust(required_len); - let actual_param_str = adjust(types.len()); + let expected_text = count_type_params(required_len); + let actual_text = count_type_params(types.len()); struct_span_err!(self.tcx.sess, span, E0089, "too few type parameters provided: \ - expected {} {}, found {} {}", - count(required_len), - required_param_str, - count(types.len()), - actual_param_str) - .span_label(span, &format!("expected {} type {}", required_len, required_param_str)) + expected {}, found {}", + expected_text, actual_text) + .span_label(span, &format!("expected {}", expected_text)) .emit(); } diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs index f18b694d3d0c70e5feb861718c31b1cee5f161ba..ea0d76978339df730973b7ca36387c5ab54ade96 100644 --- a/src/libunwind/build.rs +++ b/src/libunwind/build.rs @@ -27,6 +27,8 @@ fn main() { println!("cargo:rustc-link-lib=gcc_s"); } else if target.contains("openbsd") { println!("cargo:rustc-link-lib=gcc"); + } else if target.contains("solaris") { + println!("cargo:rustc-link-lib=gcc_s"); } else if target.contains("bitrig") { println!("cargo:rustc-link-lib=c++abi"); } else if target.contains("dragonfly") { diff --git a/src/test/compile-fail/E0087.rs b/src/test/compile-fail/E0087.rs index 7c98de59e27972f71860b5de9d63ac4ea346dcce..0b8150affc0c022fc5f27b1c2ac242b29695bc63 100644 --- a/src/test/compile-fail/E0087.rs +++ b/src/test/compile-fail/E0087.rs @@ -8,9 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn foo() {} +fn foo() {} +fn bar() {} fn main() { - foo::(); //~ ERROR E0087 - //~^ NOTE too many type parameters + foo::(); //~ ERROR expected at most 0 type parameters, found 1 type parameter [E0087] + //~^ NOTE expected 0 type parameters + + bar::(); //~ ERROR expected at most 1 type parameter, found 2 type parameters [E0087] + //~^ NOTE expected 1 type parameter } diff --git a/src/test/compile-fail/E0088.rs b/src/test/compile-fail/E0088.rs index 9ec09603224107bf298f2e2e282c852cfff6f5d7..de188677a1121ba4513916fa06d8313b6dd92902 100644 --- a/src/test/compile-fail/E0088.rs +++ b/src/test/compile-fail/E0088.rs @@ -12,9 +12,11 @@ fn f() {} fn g<'a>() {} fn main() { - f::<'static>(); //~ ERROR E0088 - //~^ unexpected lifetime parameter + f::<'static>(); + //~^ ERROR expected at most 0 lifetime parameters, found 1 lifetime parameter [E0088] + //~| NOTE expected 0 lifetime parameters - g::<'static, 'static>(); //~ ERROR E0088 - //~^ unexpected lifetime parameters + g::<'static, 'static>(); + //~^ ERROR expected at most 0 lifetime parameters, found 2 lifetime parameters [E0088] + //~| NOTE expected 0 lifetime parameters } diff --git a/src/test/compile-fail/E0089.rs b/src/test/compile-fail/E0089.rs index 9ce36523709e504f5581576be17c2f74cdc6f3df..986630d818fff94fe03b30e77ae2600e8e521dea 100644 --- a/src/test/compile-fail/E0089.rs +++ b/src/test/compile-fail/E0089.rs @@ -11,7 +11,6 @@ fn foo() {} fn main() { - foo::(); -//~^ ERROR E0089 -//~| NOTE expected 2 type parameters + foo::(); //~ ERROR expected 2 type parameters, found 1 type parameter [E0089] + //~| NOTE expected 2 type parameters } diff --git a/src/test/compile-fail/E0090.rs b/src/test/compile-fail/E0090.rs index 4600d2d63856a19ab81d5240941beba6052c3ce1..c37f37031add6827bbb03ed41a15103ee9de15e8 100644 --- a/src/test/compile-fail/E0090.rs +++ b/src/test/compile-fail/E0090.rs @@ -9,7 +9,8 @@ // except according to those terms. fn foo<'a: 'b, 'b: 'a>() {} + fn main() { - foo::<'static>();//~ ERROR E0090 - //~^ too few lifetime parameters + foo::<'static>(); //~ ERROR expected 2 lifetime parameters, found 1 lifetime parameter [E0090] + //~^ NOTE expected 2 lifetime parameters } diff --git a/src/test/compile-fail/ufcs-qpath-missing-params.rs b/src/test/compile-fail/ufcs-qpath-missing-params.rs index a24515c5160987dcbc16e5cebc698e09326404b4..5c108e052160cf50f724f4549fbf8e6c885eb0f4 100644 --- a/src/test/compile-fail/ufcs-qpath-missing-params.rs +++ b/src/test/compile-fail/ufcs-qpath-missing-params.rs @@ -22,5 +22,5 @@ fn into_cow(self) -> Cow<'a, str> { fn main() { ::into_cow("foo".to_string()); - //~^ ERROR too few type parameters provided: expected 1 parameter + //~^ ERROR too few type parameters provided: expected 1 type parameter }