Skip to content

Commit e28ef22

Browse files
committed
Auto merge of #49875 - kennytm:rollup, r=kennytm
Rollup of 14 pull requests Successful merges: - #49525 (Use sort_by_cached_key where appropriate) - #49575 (Stabilize `Option::filter`.) - #49614 (in which the non-shorthand patterns lint keeps its own counsel in macros) - #49665 (Small nits to make couple of tests pass on mips targets.) - #49781 (add regression test for #16223 (NLL): use of collaterally moved value) - #49795 (Properly look for uninhabitedness of variants in niche-filling check) - #49809 (Stop emitting color codes on TERM=dumb) - #49856 (Do not uppercase-lint #[no_mangle] statics) - #49863 (fixed typo) - #49857 (Fix "fp" target feature for AArch64) - #49849 (Add --enable-debug flag to musl CI build script) - #49734 (proc_macro: Generalize `FromIterator` impl) - #49730 (Fix ICE with impl Trait) - #48270 (Replace `structurally_resolved_type` in casts check.) Failed merges:
2 parents ad610be + 9f6e5ae commit e28ef22

File tree

43 files changed

+243
-64
lines changed

Some content is hidden

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

43 files changed

+243
-64
lines changed

src/bootstrap/compile.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,9 @@ pub fn stream_cargo(
11671167
cargo.arg("--message-format").arg("json")
11681168
.stdout(Stdio::piped());
11691169

1170-
if stderr_isatty() && build.ci_env == CiEnv::None {
1170+
if stderr_isatty() && build.ci_env == CiEnv::None &&
1171+
// if the terminal is reported as dumb, then we don't want to enable color for rustc
1172+
env::var_os("TERM").map(|t| t != *"dumb").unwrap_or(true) {
11711173
// since we pass message-format=json to cargo, we need to tell the rustc
11721174
// wrapper to give us colored output if necessary. This is because we
11731175
// only want Cargo's JSON output, not rustcs.

src/ci/docker/scripts/musl.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if [ ! -d $MUSL ]; then
4040
fi
4141

4242
cd $MUSL
43-
./configure --disable-shared --prefix=/musl-$TAG $@
43+
./configure --enable-optimize --enable-debug --disable-shared --prefix=/musl-$TAG $@
4444
if [ "$TAG" = "i586" -o "$TAG" = "i686" ]; then
4545
hide_output make -j$(nproc) AR=ar RANLIB=ranlib
4646
else

src/liballoc/slice.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,7 @@ impl<T> [T] {
14001400
let sz_usize = mem::size_of::<(K, usize)>();
14011401

14021402
let len = self.len();
1403+
if len < 2 { return }
14031404
if sz_u8 < sz_u16 && len <= ( u8::MAX as usize) { return sort_by_key!( u8, self, f) }
14041405
if sz_u16 < sz_u32 && len <= (u16::MAX as usize) { return sort_by_key!(u16, self, f) }
14051406
if sz_u32 < sz_usize && len <= (u32::MAX as usize) { return sort_by_key!(u32, self, f) }

src/libcore/option.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,8 +628,6 @@ impl<T> Option<T> {
628628
/// # Examples
629629
///
630630
/// ```rust
631-
/// #![feature(option_filter)]
632-
///
633631
/// fn is_even(n: &i32) -> bool {
634632
/// n % 2 == 0
635633
/// }
@@ -639,7 +637,7 @@ impl<T> Option<T> {
639637
/// assert_eq!(Some(4).filter(is_even), Some(4));
640638
/// ```
641639
#[inline]
642-
#[unstable(feature = "option_filter", issue = "45860")]
640+
#[stable(feature = "option_filter", since = "1.27.0")]
643641
pub fn filter<P: FnOnce(&T) -> bool>(self, predicate: P) -> Self {
644642
if let Some(x) = self {
645643
if predicate(&x) {

src/libproc_macro/lib.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,16 @@ impl From<TokenTree> for TokenStream {
140140
#[unstable(feature = "proc_macro", issue = "38356")]
141141
impl iter::FromIterator<TokenTree> for TokenStream {
142142
fn from_iter<I: IntoIterator<Item = TokenTree>>(trees: I) -> Self {
143+
trees.into_iter().map(TokenStream::from).collect()
144+
}
145+
}
146+
147+
#[unstable(feature = "proc_macro", issue = "38356")]
148+
impl iter::FromIterator<TokenStream> for TokenStream {
149+
fn from_iter<I: IntoIterator<Item = TokenStream>>(streams: I) -> Self {
143150
let mut builder = tokenstream::TokenStreamBuilder::new();
144-
for tree in trees {
145-
builder.push(tree.to_internal());
151+
for stream in streams {
152+
builder.push(stream.0);
146153
}
147154
TokenStream(builder.build())
148155
}

src/librustc/infer/anon_types/mod.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,10 +533,14 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ReverseMapper<'cx, 'gcx, 'tcx>
533533
match r {
534534
// ignore bound regions that appear in the type (e.g., this
535535
// would ignore `'r` in a type like `for<'r> fn(&'r u32)`.
536-
ty::ReLateBound(..) => return r,
536+
ty::ReLateBound(..) |
537537

538538
// ignore `'static`, as that can appear anywhere
539-
ty::ReStatic => return r,
539+
ty::ReStatic |
540+
541+
// ignore `ReScope`, as that can appear anywhere
542+
// See `src/test/run-pass/issue-49556.rs` for example.
543+
ty::ReScope(..) => return r,
540544

541545
_ => { }
542546
}

src/librustc/infer/error_reporting/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
181181
self.msg_span_from_early_bound_and_free_regions(region)
182182
},
183183
ty::ReStatic => ("the static lifetime".to_owned(), None),
184-
_ => bug!(),
184+
_ => bug!("{:?}", region),
185185
}
186186
}
187187

src/librustc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
#![feature(refcell_replace_swap)]
6161
#![feature(rustc_diagnostic_macros)]
6262
#![feature(slice_patterns)]
63+
#![feature(slice_sort_by_cached_key)]
6364
#![feature(specialization)]
6465
#![feature(unboxed_closures)]
6566
#![feature(trace_macros)]

src/librustc/middle/cstore.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ pub fn used_crates(tcx: TyCtxt, prefer: LinkagePreference)
401401
.collect::<Vec<_>>();
402402
let mut ordering = tcx.postorder_cnums(LOCAL_CRATE);
403403
Lrc::make_mut(&mut ordering).reverse();
404-
libs.sort_by_key(|&(a, _)| {
404+
libs.sort_by_cached_key(|&(a, _)| {
405405
ordering.iter().position(|x| *x == a)
406406
});
407407
libs

src/librustc/ty/cast.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use syntax::ast;
2020
pub enum IntTy {
2121
U(ast::UintTy),
2222
I,
23-
Ivar,
2423
CEnum,
2524
Bool,
2625
Char
@@ -64,7 +63,7 @@ impl<'tcx> CastTy<'tcx> {
6463
ty::TyBool => Some(CastTy::Int(IntTy::Bool)),
6564
ty::TyChar => Some(CastTy::Int(IntTy::Char)),
6665
ty::TyInt(_) => Some(CastTy::Int(IntTy::I)),
67-
ty::TyInfer(ty::InferTy::IntVar(_)) => Some(CastTy::Int(IntTy::Ivar)),
66+
ty::TyInfer(ty::InferTy::IntVar(_)) => Some(CastTy::Int(IntTy::I)),
6867
ty::TyInfer(ty::InferTy::FloatVar(_)) => Some(CastTy::Float),
6968
ty::TyUint(u) => Some(CastTy::Int(IntTy::U(u))),
7069
ty::TyFloat(_) => Some(CastTy::Float),

0 commit comments

Comments
 (0)