Auto merge of #58578 - kennytm:rollup, r=kennytm

Rollup of 24 pull requests

Successful merges:

 - #56470 (Modify doctest's auto-`fn main()` to allow `Result`s)
 - #58044 (Make overflowing and wrapping negation const)
 - #58303 (Improve stability tags display)
 - #58336 (Fix search results interactions)
 - #58384 (Fix tables display)
 - #58392 (Use less explicit shifting in std::net::ip)
 - #58409 (rustdoc: respect alternate flag when formatting impl trait)
 - #58456 (Remove no longer accurate diagnostic code about NLL)
 - #58528 (Don't use an allocation for ItemId in StmtKind)
 - #58530 (Monomorphize less code in fs::{read|write})
 - #58534 (Mention capping forbid lints)
 - #58536 (Remove UB in pointer tests)
 - #58538 (Add missing fmt structs examples)
 - #58539 (Add alias methods to PathBuf for underlying OsString (#58234))
 - #58544 (Fix doc for rustc "-g" flag)
 - #58545 (Add regression test for a specialization-related ICE (#39448))
 - #58546 (librustc_codegen_llvm => 2018)
 - #58551 (Explain a panic in test case net::tcp::tests::double_bind)
 - #58553 (Use more impl header lifetime elision)
 - #58562 (Fix style nits)
 - #58565 (Fix typo in std::future::Future docs)
 - #58568 (Fix a transposition in driver.rs.)
 - #58569 (Reduce Some Code Repetitions like `(n << amt) >> amt`)
 - #58576 (Stabilize iter::successors and iter::from_fn)
This commit is contained in:
bors 2019-02-20 10:14:28 +00:00
commit f66e4697ae
114 changed files with 1177 additions and 633 deletions

View file

@ -13,6 +13,9 @@ const SHL_B: (u32, bool) = 0x1u32.overflowing_shl(132);
const SHR_A: (u32, bool) = 0x10u32.overflowing_shr(4);
const SHR_B: (u32, bool) = 0x10u32.overflowing_shr(132);
const NEG_A: (u32, bool) = 0u32.overflowing_neg();
const NEG_B: (u32, bool) = core::u32::MAX.overflowing_neg();
fn ident<T>(ident: T) -> T {
ident
}
@ -32,4 +35,7 @@ fn main() {
assert_eq!(SHR_A, ident((0x1, false)));
assert_eq!(SHR_B, ident((0x1, true)));
assert_eq!(NEG_A, ident((0, false)));
assert_eq!(NEG_B, ident((1, true)));
}

View file

@ -13,6 +13,9 @@ const SHL_B: u32 = 1u32.wrapping_shl(128);
const SHR_A: u32 = 128u32.wrapping_shr(7);
const SHR_B: u32 = 128u32.wrapping_shr(128);
const NEG_A: u32 = 5u32.wrapping_neg();
const NEG_B: u32 = 1234567890u32.wrapping_neg();
fn ident<T>(ident: T) -> T {
ident
}
@ -32,4 +35,7 @@ fn main() {
assert_eq!(SHR_A, ident(1));
assert_eq!(SHR_B, ident(128));
assert_eq!(NEG_A, ident(4294967291));
assert_eq!(NEG_B, ident(3060399406));
}

View file

@ -0,0 +1,24 @@
// compile-flags:--test
/// A check of using various process termination strategies
///
/// # Examples
///
/// ```rust
/// assert!(true); // this returns `()`, all is well
/// ```
///
/// You can also simply return `Ok(())`, but you'll need to disambiguate the
/// type using turbofish, because we cannot infer the type:
///
/// ```rust
/// Ok::<(), &'static str>(())
/// ```
///
/// You can err with anything that implements `Debug`:
///
/// ```rust,should_panic
/// Err("This is returned from `main`, leading to panic")?;
/// Ok::<(), &'static str>(())
/// ```
pub fn check_process_termination() {}

View file

@ -0,0 +1,5 @@
use std::fmt::Debug;
// @has 'wrapping/fn.foo.html' '//pre[@class="rust fn"]' 'pub fn foo() -> impl Debug'
// @count - '//pre[@class="rust fn"]/br' 0
pub fn foo() -> impl Debug {}

View file

@ -0,0 +1,50 @@
#![feature(specialization)]
// Regression test for a specialization-related ICE (#39448).
trait A: Sized {
fn foo(self, _: Self) -> Self {
self
}
}
impl A for u8 {}
impl A for u16 {}
impl FromA<u8> for u16 {
fn from(x: u8) -> u16 {
x as u16
}
}
trait FromA<T> {
fn from(T) -> Self;
}
impl<T: A, U: A + FromA<T>> FromA<T> for U {
default fn from(x: T) -> Self {
ToA::to(x)
}
}
trait ToA<T> {
fn to(self) -> T;
}
impl<T, U> ToA<U> for T
where
U: FromA<T>,
{
fn to(self) -> U {
U::from(self)
}
}
#[allow(dead_code)]
fn foo<T: A, U: A>(x: T, y: U) -> U {
x.foo(y.to()).to() //~ ERROR overflow evaluating the requirement
}
fn main() {
let z = foo(8u8, 1u16);
}

View file

@ -0,0 +1,12 @@
error[E0275]: overflow evaluating the requirement `T: FromA<U>`
--> $DIR/issue-39448.rs:45:13
|
LL | x.foo(y.to()).to() //~ ERROR overflow evaluating the requirement
| ^^
|
= note: required because of the requirements on the impl of `FromA<U>` for `T`
= note: required because of the requirements on the impl of `ToA<T>` for `U`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0275`.