mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Auto merge of #39787 - frewsxcv:rollup, r=frewsxcv
Rollup of 5 pull requests - Successful merges: #39716, #39758, #39759, #39774, #39784 - Failed merges:
This commit is contained in:
commit
0af0b580c2
1
configure
vendored
1
configure
vendored
@ -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 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 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 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 codegen-tests 1 "run the src/test/codegen tests"
|
||||||
opt option-checking 1 "complain about unrecognized options in this configure script"
|
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)"
|
opt ninja 0 "build LLVM using the Ninja generator (for MSVC, requires building in the correct environment)"
|
||||||
|
@ -315,7 +315,7 @@ class RustBuild(object):
|
|||||||
try:
|
try:
|
||||||
ostype = subprocess.check_output(['uname', '-s']).strip().decode(default_encoding)
|
ostype = subprocess.check_output(['uname', '-s']).strip().decode(default_encoding)
|
||||||
cputype = subprocess.check_output(['uname', '-m']).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':
|
if sys.platform == 'win32':
|
||||||
return 'x86_64-pc-windows-msvc'
|
return 'x86_64-pc-windows-msvc'
|
||||||
err = "uname not found"
|
err = "uname not found"
|
||||||
@ -345,6 +345,21 @@ class RustBuild(object):
|
|||||||
ostype = 'unknown-openbsd'
|
ostype = 'unknown-openbsd'
|
||||||
elif ostype == 'NetBSD':
|
elif ostype == 'NetBSD':
|
||||||
ostype = 'unknown-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':
|
elif ostype == 'Darwin':
|
||||||
ostype = 'apple-darwin'
|
ostype = 'apple-darwin'
|
||||||
elif ostype.startswith('MINGW'):
|
elif ostype.startswith('MINGW'):
|
||||||
|
@ -1213,7 +1213,7 @@ impl<T: Clone> Vec<T> {
|
|||||||
unsafe {
|
unsafe {
|
||||||
let mut ptr = self.as_mut_ptr().offset(self.len() as isize);
|
let mut ptr = self.as_mut_ptr().offset(self.len() as isize);
|
||||||
// Use SetLenOnDrop to work around bug where compiler
|
// 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.
|
// don't alias.
|
||||||
let mut local_len = SetLenOnDrop::new(&mut self.len);
|
let mut local_len = SetLenOnDrop::new(&mut self.len);
|
||||||
|
|
||||||
|
@ -186,6 +186,7 @@ use fmt::{self, Debug, Display};
|
|||||||
use marker::Unsize;
|
use marker::Unsize;
|
||||||
use mem;
|
use mem;
|
||||||
use ops::{Deref, DerefMut, CoerceUnsized};
|
use ops::{Deref, DerefMut, CoerceUnsized};
|
||||||
|
use ptr;
|
||||||
|
|
||||||
/// A mutable memory location.
|
/// A mutable memory location.
|
||||||
///
|
///
|
||||||
@ -387,6 +388,32 @@ impl<T> Cell<T> {
|
|||||||
drop(old);
|
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.
|
/// Replaces the contained value.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
|
@ -4510,28 +4510,32 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let count = |n| {
|
let count_lifetime_params = |n| {
|
||||||
format!("{} parameter{}", n, if n == 1 { "" } else { "s" })
|
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.
|
// Check provided lifetime parameters.
|
||||||
let lifetime_defs = segment.map_or(&[][..], |(_, generics)| &generics.regions);
|
let lifetime_defs = segment.map_or(&[][..], |(_, generics)| &generics.regions);
|
||||||
if lifetimes.len() > lifetime_defs.len() {
|
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,
|
struct_span_err!(self.tcx.sess, span, E0088,
|
||||||
"too many lifetime parameters provided: \
|
"too many lifetime parameters provided: \
|
||||||
expected {}, found {}",
|
expected at most {}, found {}",
|
||||||
count(lifetime_defs.len()),
|
expected_text, actual_text)
|
||||||
count(lifetimes.len()))
|
.span_label(span, &format!("expected {}", expected_text))
|
||||||
.span_label(span, &format!("unexpected lifetime parameter{}",
|
|
||||||
match lifetimes.len() { 1 => "", _ => "s" }))
|
|
||||||
.emit();
|
.emit();
|
||||||
} else if lifetimes.len() > 0 && lifetimes.len() < lifetime_defs.len() {
|
} 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,
|
struct_span_err!(self.tcx.sess, span, E0090,
|
||||||
"too few lifetime parameters provided: \
|
"too few lifetime parameters provided: \
|
||||||
expected {}, found {}",
|
expected {}, found {}",
|
||||||
count(lifetime_defs.len()),
|
expected_text, actual_text)
|
||||||
count(lifetimes.len()))
|
.span_label(span, &format!("expected {}", expected_text))
|
||||||
.span_label(span, &format!("too few lifetime parameters"))
|
|
||||||
.emit();
|
.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4552,29 +4556,27 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||||||
.count();
|
.count();
|
||||||
if types.len() > type_defs.len() {
|
if types.len() > type_defs.len() {
|
||||||
let span = types[type_defs.len()].span;
|
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,
|
struct_span_err!(self.tcx.sess, span, E0087,
|
||||||
"too many type parameters provided: \
|
"too many type parameters provided: \
|
||||||
expected at most {}, found {}",
|
expected at most {}, found {}",
|
||||||
count(type_defs.len()),
|
expected_text, actual_text)
|
||||||
count(types.len()))
|
.span_label(span, &format!("expected {}", expected_text))
|
||||||
.span_label(span, &format!("too many type parameters")).emit();
|
.emit();
|
||||||
|
|
||||||
// To prevent derived errors to accumulate due to extra
|
// To prevent derived errors to accumulate due to extra
|
||||||
// type parameters, we force instantiate_value_path to
|
// type parameters, we force instantiate_value_path to
|
||||||
// use inference variables instead of the provided types.
|
// use inference variables instead of the provided types.
|
||||||
*segment = None;
|
*segment = None;
|
||||||
} else if !infer_types && types.len() < required_len {
|
} else if !infer_types && types.len() < required_len {
|
||||||
let adjust = |len| if len > 1 { "parameters" } else { "parameter" };
|
let expected_text = count_type_params(required_len);
|
||||||
let required_param_str = adjust(required_len);
|
let actual_text = count_type_params(types.len());
|
||||||
let actual_param_str = adjust(types.len());
|
|
||||||
struct_span_err!(self.tcx.sess, span, E0089,
|
struct_span_err!(self.tcx.sess, span, E0089,
|
||||||
"too few type parameters provided: \
|
"too few type parameters provided: \
|
||||||
expected {} {}, found {} {}",
|
expected {}, found {}",
|
||||||
count(required_len),
|
expected_text, actual_text)
|
||||||
required_param_str,
|
.span_label(span, &format!("expected {}", expected_text))
|
||||||
count(types.len()),
|
|
||||||
actual_param_str)
|
|
||||||
.span_label(span, &format!("expected {} type {}", required_len, required_param_str))
|
|
||||||
.emit();
|
.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,8 @@ fn main() {
|
|||||||
println!("cargo:rustc-link-lib=gcc_s");
|
println!("cargo:rustc-link-lib=gcc_s");
|
||||||
} else if target.contains("openbsd") {
|
} else if target.contains("openbsd") {
|
||||||
println!("cargo:rustc-link-lib=gcc");
|
println!("cargo:rustc-link-lib=gcc");
|
||||||
|
} else if target.contains("solaris") {
|
||||||
|
println!("cargo:rustc-link-lib=gcc_s");
|
||||||
} else if target.contains("bitrig") {
|
} else if target.contains("bitrig") {
|
||||||
println!("cargo:rustc-link-lib=c++abi");
|
println!("cargo:rustc-link-lib=c++abi");
|
||||||
} else if target.contains("dragonfly") {
|
} else if target.contains("dragonfly") {
|
||||||
|
@ -8,9 +8,13 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn foo<T>() {}
|
fn foo() {}
|
||||||
|
fn bar<T>() {}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
foo::<f64, bool>(); //~ ERROR E0087
|
foo::<f64>(); //~ ERROR expected at most 0 type parameters, found 1 type parameter [E0087]
|
||||||
//~^ NOTE too many type parameters
|
//~^ NOTE expected 0 type parameters
|
||||||
|
|
||||||
|
bar::<f64, u64>(); //~ ERROR expected at most 1 type parameter, found 2 type parameters [E0087]
|
||||||
|
//~^ NOTE expected 1 type parameter
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,11 @@ fn f() {}
|
|||||||
fn g<'a>() {}
|
fn g<'a>() {}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
f::<'static>(); //~ ERROR E0088
|
f::<'static>();
|
||||||
//~^ unexpected lifetime parameter
|
//~^ ERROR expected at most 0 lifetime parameters, found 1 lifetime parameter [E0088]
|
||||||
|
//~| NOTE expected 0 lifetime parameters
|
||||||
|
|
||||||
g::<'static, 'static>(); //~ ERROR E0088
|
g::<'static, 'static>();
|
||||||
//~^ unexpected lifetime parameters
|
//~^ ERROR expected at most 0 lifetime parameters, found 2 lifetime parameters [E0088]
|
||||||
|
//~| NOTE expected 0 lifetime parameters
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
fn foo<T, U>() {}
|
fn foo<T, U>() {}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
foo::<f64>();
|
foo::<f64>(); //~ ERROR expected 2 type parameters, found 1 type parameter [E0089]
|
||||||
//~^ ERROR E0089
|
//~| NOTE expected 2 type parameters
|
||||||
//~| NOTE expected 2 type parameters
|
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn foo<'a: 'b, 'b: 'a>() {}
|
fn foo<'a: 'b, 'b: 'a>() {}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
foo::<'static>();//~ ERROR E0090
|
foo::<'static>(); //~ ERROR expected 2 lifetime parameters, found 1 lifetime parameter [E0090]
|
||||||
//~^ too few lifetime parameters
|
//~^ NOTE expected 2 lifetime parameters
|
||||||
}
|
}
|
||||||
|
@ -22,5 +22,5 @@ impl<'a> IntoCow<'a, str> for String {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
<String as IntoCow>::into_cow("foo".to_string());
|
<String as IntoCow>::into_cow("foo".to_string());
|
||||||
//~^ ERROR too few type parameters provided: expected 1 parameter
|
//~^ ERROR too few type parameters provided: expected 1 type parameter
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user