Auto merge of #69986 - JohnTitor:rollup-h0809mf, r=JohnTitor

Rollup of 12 pull requests

Successful merges:

 - #69403 (Implement `Copy` for `IoSlice`)
 - #69460 (Move some `build-pass` tests to `check-pass`)
 - #69723 (Added doc on keyword Pub.)
 - #69802 (fix more clippy findings)
 - #69809 (remove lifetimes that can be elided (clippy::needless_lifetimes))
 - #69947 (Clean up E0423 explanation)
 - #69949 (triagebot.toml: add ping aliases)
 - #69954 (rename panic_if_ intrinsics to assert_)
 - #69960 (miri engine: fix treatment of abort intrinsic)
 - #69966 (Add more regression tests)
 - #69973 (Update stable-since version for const_int_conversion)
 - #69974 (Clean up E0434 explanation)

Failed merges:

r? @ghost
This commit is contained in:
bors 2020-03-13 19:16:03 +00:00
commit 1572c433ee
106 changed files with 358 additions and 237 deletions

View file

@ -0,0 +1,10 @@
// build-fail
// ignore-emscripten no asm! support
// Regression test for #69092
#![feature(asm)]
fn main() {
unsafe { asm!(".ascii \"Xen\0\""); }
//~^ ERROR: <inline asm>:1:9: error: expected string in '.ascii' directive
}

View file

@ -0,0 +1,11 @@
error: <inline asm>:1:9: error: expected string in '.ascii' directive
.ascii "Xen
^
--> $DIR/issue-69092.rs:8:14
|
LL | unsafe { asm!(".ascii \"Xen\0\""); }
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -0,0 +1,25 @@
// Regression test for #62504
#![feature(const_generics)]
#![allow(incomplete_features)]
trait HasSize {
const SIZE: usize;
}
impl<const X: usize> HasSize for ArrayHolder<{ X }> {
const SIZE: usize = X;
}
struct ArrayHolder<const X: usize>([u32; X]);
impl<const X: usize> ArrayHolder<{ X }> {
pub const fn new() -> Self {
ArrayHolder([0; Self::SIZE])
//~^ ERROR: array lengths can't depend on generic parameters
}
}
fn main() {
let mut array = ArrayHolder::new();
}

View file

@ -0,0 +1,8 @@
error: array lengths can't depend on generic parameters
--> $DIR/issue-62504.rs:18:25
|
LL | ArrayHolder([0; Self::SIZE])
| ^^^^^^^^^^
error: aborting due to previous error

View file

@ -0,0 +1,18 @@
// Regression test for #67739
#![allow(incomplete_features)]
#![feature(const_generics)]
use std::mem;
pub trait Trait {
type Associated: Sized;
fn associated_size(&self) -> usize {
[0u8; mem::size_of::<Self::Associated>()];
//~^ ERROR: array lengths can't depend on generic parameters
0
}
}
fn main() {}

View file

@ -0,0 +1,8 @@
error: array lengths can't depend on generic parameters
--> $DIR/issue-67739.rs:12:15
|
LL | [0u8; mem::size_of::<Self::Associated>()];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
pub trait Foo {
fn foo(self) -> u32;

View file

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
fn main() {
const MIN: i8 = -5;

View file

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
enum Foo {
A = 5,

View file

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
#![feature(const_fn, rustc_attrs)]

View file

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
use std::time::Duration;

View file

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
#![feature(extern_types)]

View file

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
pub trait Nullable {
const NULL: Self;

View file

@ -1,4 +1,7 @@
// build-pass (FIXME(62277): could be check-pass?)
// Regression test for #50356: Compiler panic when using repr(packed)
// associated constant in a match arm
// check-pass
#[derive(Copy, Clone, PartialEq, Eq)]
#[repr(packed)]
pub struct Num(u64);

View file

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
struct S(pub &'static u32, pub u32);

View file

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
pub struct Stats;

View file

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
// https://github.com/rust-lang/rust/issues/51300
#[derive(PartialEq, Eq, Clone, Copy)]

View file

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
macro_rules! m {
() => {{

View file

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
pub const STATIC_TRAIT: &dyn Test = &();

View file

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
// Test that we can handle newtypes wrapping extern types

View file

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
// if `X` were used instead of `x`, `X - 10` would result in a lint.
// This file should never produce a lint, no matter how the const

View file

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
pub fn main() {
let y: &'static mut [u8; 0] = &mut [];

View file

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
#![warn(const_err)]
#![crate_type = "lib"]

View file

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
#![warn(const_err)]
pub const Z: u32 = 0 - 1;

View file

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
const PARSE_BOOL: Option<&'static str> = None;
static FOO: (Option<&str>, u32) = (PARSE_BOOL, 42);

View file

@ -4,7 +4,7 @@ warning: any use of this value will cause an error
LL | unsafe { std::mem::transmute(()) }
| ^^^^^^^^^^^^^^^^^^^^^^^
| |
| entering unreachable code
| transmuting to uninhabited type
| inside call to `foo` at $DIR/validate_uninhabited_zsts.rs:14:26
...
LL | const FOO: [Empty; 3] = [foo(); 3];

View file

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
static ASSERT: () = [()][!(std::mem::size_of::<u32>() == 4) as usize];

View file

@ -0,0 +1,26 @@
// Regression test for #58490
macro_rules! a {
( @1 $i:item ) => {
a! { @2 $i }
};
( @2 $i:item ) => {
$i
};
}
mod b {
a! {
@1
#[macro_export]
macro_rules! b { () => () }
}
#[macro_export]
macro_rules! b { () => () }
//~^ ERROR: the name `b` is defined multiple times
}
mod c {
#[allow(unused_imports)]
use crate::b;
}
fn main() {}

View file

@ -0,0 +1,14 @@
error[E0428]: the name `b` is defined multiple times
--> $DIR/issue-58490.rs:18:5
|
LL | macro_rules! b { () => () }
| -------------- previous definition of the macro `b` here
...
LL | macro_rules! b { () => () }
| ^^^^^^^^^^^^^^ `b` redefined here
|
= note: `b` must be defined only once in the macro namespace of this module
error: aborting due to previous error
For more information about this error, try `rustc --explain E0428`.

View file

@ -0,0 +1,8 @@
// check-pass
// compile-flags: --emit=mir,link
// Regression test for #60390, this ICE requires `--emit=mir` flag.
fn main() {
enum Inner { Member(u32) };
Inner::Member(0);
}