Skip to content

Commit 0af0b58

Browse files
committed
Auto merge of #39787 - frewsxcv:rollup, r=frewsxcv
Rollup of 5 pull requests - Successful merges: #39716, #39758, #39759, #39774, #39784 - Failed merges:
2 parents 717ac96 + 2a030bf commit 0af0b58

File tree

11 files changed

+90
-39
lines changed

11 files changed

+90
-39
lines changed

configure

-1
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,6 @@ opt stage0-landing-pads 1 "enable landing pads during bootstrap with stage0"
644644
opt dist-host-only 0 "only install bins for the host architecture"
645645
opt inject-std-version 1 "inject the current compiler version of libstd into programs"
646646
opt llvm-version-check 1 "check if the LLVM version is supported, build anyway"
647-
opt rustbuild 1 "use the rust and cargo based build system"
648647
opt codegen-tests 1 "run the src/test/codegen tests"
649648
opt option-checking 1 "complain about unrecognized options in this configure script"
650649
opt ninja 0 "build LLVM using the Ninja generator (for MSVC, requires building in the correct environment)"

src/bootstrap/bootstrap.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def build_triple(self):
315315
try:
316316
ostype = subprocess.check_output(['uname', '-s']).strip().decode(default_encoding)
317317
cputype = subprocess.check_output(['uname', '-m']).strip().decode(default_encoding)
318-
except (subprocess.CalledProcessError, WindowsError):
318+
except (subprocess.CalledProcessError, OSError):
319319
if sys.platform == 'win32':
320320
return 'x86_64-pc-windows-msvc'
321321
err = "uname not found"
@@ -345,6 +345,21 @@ def build_triple(self):
345345
ostype = 'unknown-openbsd'
346346
elif ostype == 'NetBSD':
347347
ostype = 'unknown-netbsd'
348+
elif ostype == 'SunOS':
349+
ostype = 'sun-solaris'
350+
# On Solaris, uname -m will return a machine classification instead
351+
# of a cpu type, so uname -p is recommended instead. However, the
352+
# output from that option is too generic for our purposes (it will
353+
# always emit 'i386' on x86/amd64 systems). As such, isainfo -k
354+
# must be used instead.
355+
try:
356+
cputype = subprocess.check_output(['isainfo',
357+
'-k']).strip().decode(default_encoding)
358+
except (subprocess.CalledProcessError, OSError):
359+
err = "isainfo not found"
360+
if self.verbose:
361+
raise Exception(err)
362+
sys.exit(err)
348363
elif ostype == 'Darwin':
349364
ostype = 'apple-darwin'
350365
elif ostype.startswith('MINGW'):

src/libcollections/vec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,7 @@ impl<T: Clone> Vec<T> {
12131213
unsafe {
12141214
let mut ptr = self.as_mut_ptr().offset(self.len() as isize);
12151215
// Use SetLenOnDrop to work around bug where compiler
1216-
// may not realize the store through `ptr` trough self.set_len()
1216+
// may not realize the store through `ptr` through self.set_len()
12171217
// don't alias.
12181218
let mut local_len = SetLenOnDrop::new(&mut self.len);
12191219

src/libcore/cell.rs

+27
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ use fmt::{self, Debug, Display};
186186
use marker::Unsize;
187187
use mem;
188188
use ops::{Deref, DerefMut, CoerceUnsized};
189+
use ptr;
189190

190191
/// A mutable memory location.
191192
///
@@ -387,6 +388,32 @@ impl<T> Cell<T> {
387388
drop(old);
388389
}
389390

391+
/// Swaps the values of two Cells.
392+
/// Difference with `std::mem::swap` is that this function doesn't require `&mut` reference.
393+
///
394+
/// # Examples
395+
///
396+
/// ```
397+
/// #![feature(move_cell)]
398+
/// use std::cell::Cell;
399+
///
400+
/// let c1 = Cell::new(5i32);
401+
/// let c2 = Cell::new(10i32);
402+
/// c1.swap(&c2);
403+
/// assert_eq!(10, c1.get());
404+
/// assert_eq!(5, c2.get());
405+
/// ```
406+
#[inline]
407+
#[unstable(feature = "move_cell", issue = "39264")]
408+
pub fn swap(&self, other: &Self) {
409+
if ptr::eq(self, other) {
410+
return;
411+
}
412+
unsafe {
413+
ptr::swap(self.value.get(), other.value.get());
414+
}
415+
}
416+
390417
/// Replaces the contained value.
391418
///
392419
/// # Examples

src/librustc_typeck/check/mod.rs

+25-23
Original file line numberDiff line numberDiff line change
@@ -4510,28 +4510,32 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
45104510
}
45114511
};
45124512

4513-
let count = |n| {
4514-
format!("{} parameter{}", n, if n == 1 { "" } else { "s" })
4513+
let count_lifetime_params = |n| {
4514+
format!("{} lifetime parameter{}", n, if n == 1 { "" } else { "s" })
4515+
};
4516+
let count_type_params = |n| {
4517+
format!("{} type parameter{}", n, if n == 1 { "" } else { "s" })
45154518
};
45164519

45174520
// Check provided lifetime parameters.
45184521
let lifetime_defs = segment.map_or(&[][..], |(_, generics)| &generics.regions);
45194522
if lifetimes.len() > lifetime_defs.len() {
4523+
let expected_text = count_lifetime_params(lifetime_defs.len());
4524+
let actual_text = count_lifetime_params(lifetimes.len());
45204525
struct_span_err!(self.tcx.sess, span, E0088,
45214526
"too many lifetime parameters provided: \
4522-
expected {}, found {}",
4523-
count(lifetime_defs.len()),
4524-
count(lifetimes.len()))
4525-
.span_label(span, &format!("unexpected lifetime parameter{}",
4526-
match lifetimes.len() { 1 => "", _ => "s" }))
4527+
expected at most {}, found {}",
4528+
expected_text, actual_text)
4529+
.span_label(span, &format!("expected {}", expected_text))
45274530
.emit();
45284531
} else if lifetimes.len() > 0 && lifetimes.len() < lifetime_defs.len() {
4532+
let expected_text = count_lifetime_params(lifetime_defs.len());
4533+
let actual_text = count_lifetime_params(lifetimes.len());
45294534
struct_span_err!(self.tcx.sess, span, E0090,
45304535
"too few lifetime parameters provided: \
4531-
expected {}, found {}",
4532-
count(lifetime_defs.len()),
4533-
count(lifetimes.len()))
4534-
.span_label(span, &format!("too few lifetime parameters"))
4536+
expected {}, found {}",
4537+
expected_text, actual_text)
4538+
.span_label(span, &format!("expected {}", expected_text))
45354539
.emit();
45364540
}
45374541

@@ -4552,29 +4556,27 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
45524556
.count();
45534557
if types.len() > type_defs.len() {
45544558
let span = types[type_defs.len()].span;
4559+
let expected_text = count_type_params(type_defs.len());
4560+
let actual_text = count_type_params(types.len());
45554561
struct_span_err!(self.tcx.sess, span, E0087,
45564562
"too many type parameters provided: \
45574563
expected at most {}, found {}",
4558-
count(type_defs.len()),
4559-
count(types.len()))
4560-
.span_label(span, &format!("too many type parameters")).emit();
4564+
expected_text, actual_text)
4565+
.span_label(span, &format!("expected {}", expected_text))
4566+
.emit();
45614567

45624568
// To prevent derived errors to accumulate due to extra
45634569
// type parameters, we force instantiate_value_path to
45644570
// use inference variables instead of the provided types.
45654571
*segment = None;
45664572
} else if !infer_types && types.len() < required_len {
4567-
let adjust = |len| if len > 1 { "parameters" } else { "parameter" };
4568-
let required_param_str = adjust(required_len);
4569-
let actual_param_str = adjust(types.len());
4573+
let expected_text = count_type_params(required_len);
4574+
let actual_text = count_type_params(types.len());
45704575
struct_span_err!(self.tcx.sess, span, E0089,
45714576
"too few type parameters provided: \
4572-
expected {} {}, found {} {}",
4573-
count(required_len),
4574-
required_param_str,
4575-
count(types.len()),
4576-
actual_param_str)
4577-
.span_label(span, &format!("expected {} type {}", required_len, required_param_str))
4577+
expected {}, found {}",
4578+
expected_text, actual_text)
4579+
.span_label(span, &format!("expected {}", expected_text))
45784580
.emit();
45794581
}
45804582

src/libunwind/build.rs

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ fn main() {
2727
println!("cargo:rustc-link-lib=gcc_s");
2828
} else if target.contains("openbsd") {
2929
println!("cargo:rustc-link-lib=gcc");
30+
} else if target.contains("solaris") {
31+
println!("cargo:rustc-link-lib=gcc_s");
3032
} else if target.contains("bitrig") {
3133
println!("cargo:rustc-link-lib=c++abi");
3234
} else if target.contains("dragonfly") {

src/test/compile-fail/E0087.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
fn foo<T>() {}
11+
fn foo() {}
12+
fn bar<T>() {}
1213

1314
fn main() {
14-
foo::<f64, bool>(); //~ ERROR E0087
15-
//~^ NOTE too many type parameters
15+
foo::<f64>(); //~ ERROR expected at most 0 type parameters, found 1 type parameter [E0087]
16+
//~^ NOTE expected 0 type parameters
17+
18+
bar::<f64, u64>(); //~ ERROR expected at most 1 type parameter, found 2 type parameters [E0087]
19+
//~^ NOTE expected 1 type parameter
1620
}

src/test/compile-fail/E0088.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ fn f() {}
1212
fn g<'a>() {}
1313

1414
fn main() {
15-
f::<'static>(); //~ ERROR E0088
16-
//~^ unexpected lifetime parameter
15+
f::<'static>();
16+
//~^ ERROR expected at most 0 lifetime parameters, found 1 lifetime parameter [E0088]
17+
//~| NOTE expected 0 lifetime parameters
1718

18-
g::<'static, 'static>(); //~ ERROR E0088
19-
//~^ unexpected lifetime parameters
19+
g::<'static, 'static>();
20+
//~^ ERROR expected at most 0 lifetime parameters, found 2 lifetime parameters [E0088]
21+
//~| NOTE expected 0 lifetime parameters
2022
}

src/test/compile-fail/E0089.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
fn foo<T, U>() {}
1212

1313
fn main() {
14-
foo::<f64>();
15-
//~^ ERROR E0089
16-
//~| NOTE expected 2 type parameters
14+
foo::<f64>(); //~ ERROR expected 2 type parameters, found 1 type parameter [E0089]
15+
//~| NOTE expected 2 type parameters
1716
}

src/test/compile-fail/E0090.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
// except according to those terms.
1010

1111
fn foo<'a: 'b, 'b: 'a>() {}
12+
1213
fn main() {
13-
foo::<'static>();//~ ERROR E0090
14-
//~^ too few lifetime parameters
14+
foo::<'static>(); //~ ERROR expected 2 lifetime parameters, found 1 lifetime parameter [E0090]
15+
//~^ NOTE expected 2 lifetime parameters
1516
}

src/test/compile-fail/ufcs-qpath-missing-params.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ impl<'a> IntoCow<'a, str> for String {
2222

2323
fn main() {
2424
<String as IntoCow>::into_cow("foo".to_string());
25-
//~^ ERROR too few type parameters provided: expected 1 parameter
25+
//~^ ERROR too few type parameters provided: expected 1 type parameter
2626
}

0 commit comments

Comments
 (0)