UI tests: add missing diagnostic kinds where possible

This commit is contained in:
Vadim Petrochenkov 2025-04-05 19:19:56 +03:00
parent d4f880f8ce
commit b3f75353a2
370 changed files with 930 additions and 928 deletions

View file

@ -47,7 +47,7 @@ pub fn baz() {}
///
/// Indented block end
pub fn quux() {}
//~^^^^^ could not parse code block as Rust code
//~^^^^^ WARN could not parse code block as Rust code
/// Unclosed fence
///

View file

@ -5,10 +5,10 @@ use std::ops::Index;
pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) {
//~^ expected 1 lifetime argument
//~| expected 1 generic argument
//~| the trait `SVec` is not dyn compatible
//~| ERROR the trait `SVec` is not dyn compatible
//~| `SVec` is not dyn compatible
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
let _ = s;
}
@ -16,52 +16,52 @@ pub trait SVec: Index<
<Self as SVec>::Item,
//~^ expected 1 lifetime argument
//~| expected 1 generic argument
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
Output = <Index<<Self as SVec>::Item,
//~^ expected 1 lifetime argument
//~| expected 1 generic argument
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
Output = <Self as SVec>::Item> as SVec>::Item,
//~^ expected 1 lifetime argument
//~| expected 1 generic argument
//~| expected 1 lifetime argument
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| expected 1 generic argument
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
> {
type Item<'a, T>;
fn len(&self) -> <Self as SVec>::Item;
//~^ expected 1 lifetime argument
//~| missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
//~| expected 1 generic argument
//~| missing generics for associated type `SVec::Item`
//~| ERROR missing generics for associated type `SVec::Item`
}

View file

@ -1,5 +1,5 @@
// https://github.com/rust-lang/rust/issues/102986
struct Struct {
y: (typeof("hey"),),
//~^ `typeof` is a reserved keyword but unimplemented
//~^ ERROR `typeof` is a reserved keyword but unimplemented
}

View file

@ -1,24 +1,24 @@
//@ compile-flags: -Zdeduplicate-diagnostics=yes
extern crate rustc_data_structures;
//~^ use of unstable library feature `rustc_private`
//~^ ERROR use of unstable library feature `rustc_private`
//~| NOTE: issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
extern crate rustc_macros;
//~^ use of unstable library feature `rustc_private`
//~^ ERROR use of unstable library feature `rustc_private`
//~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
extern crate rustc_query_system;
//~^ use of unstable library feature `rustc_private`
//~^ ERROR use of unstable library feature `rustc_private`
//~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
use rustc_macros::HashStable;
//~^ use of unstable library feature `rustc_private`
//~^ ERROR use of unstable library feature `rustc_private`
//~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
#[derive(HashStable)]
//~^ use of unstable library feature `rustc_private`
//~^ ERROR use of unstable library feature `rustc_private`
//~| NOTE: in this expansion of #[derive(HashStable)]
//~| NOTE: in this expansion of #[derive(HashStable)]
//~| NOTE: in this expansion of #[derive(HashStable)]

View file

@ -8,17 +8,17 @@ extern crate rustc_macros;
use rustc_macros::TryFromU32;
#[derive(TryFromU32)]
struct MyStruct {} //~ type is not an enum
struct MyStruct {} //~ ERROR type is not an enum
#[derive(TryFromU32)]
enum NonTrivial {
A,
B(),
C {},
D(bool), //~ enum variant cannot have fields
E(bool, bool), //~ enum variant cannot have fields
F { x: bool }, //~ enum variant cannot have fields
G { x: bool, y: bool }, //~ enum variant cannot have fields
D(bool), //~ ERROR enum variant cannot have fields
E(bool, bool), //~ ERROR enum variant cannot have fields
F { x: bool }, //~ ERROR enum variant cannot have fields
G { x: bool, y: bool }, //~ ERROR enum variant cannot have fields
}
fn main() {}

View file

@ -14,19 +14,19 @@ use std::arch::x86_64::*;
struct Wrapper(__m256);
unsafe extern "C" fn w(_: Wrapper) {
//~^ requires the `avx` target feature, which is not enabled
//~^ WARN requires the `avx` target feature, which is not enabled
//~| WARNING this was previously accepted by the compiler
todo!()
}
unsafe extern "C" fn f(_: __m256) {
//~^ requires the `avx` target feature, which is not enabled
//~^ WARN requires the `avx` target feature, which is not enabled
//~| WARNING this was previously accepted by the compiler
todo!()
}
unsafe extern "C" fn g() -> __m256 {
//~^ requires the `avx` target feature, which is not enabled
//~^ WARN requires the `avx` target feature, which is not enabled
//~| WARNING this was previously accepted by the compiler
todo!()
}

View file

@ -14,5 +14,5 @@ use minicore::*;
pub struct SimdVec([i32; 4]);
pub extern "C" fn pass_by_vec(_: SimdVec) {}
//~^ this function definition uses SIMD vector type `SimdVec` which is not currently supported with the chosen ABI
//~^ WARN this function definition uses SIMD vector type `SimdVec` which is not currently supported with the chosen ABI
//~| WARNING this was previously accepted by the compiler

View file

@ -18,6 +18,6 @@ pub struct SseVector([i64; 2]);
#[no_mangle]
pub unsafe extern "C" fn f(_: SseVector) {
//~^ this function definition uses SIMD vector type `SseVector` which (with the chosen ABI) requires the `sse` target feature, which is not enabled
//~^ WARN this function definition uses SIMD vector type `SseVector` which (with the chosen ABI) requires the `sse` target feature, which is not enabled
//~| WARNING this was previously accepted by the compiler
}

View file

@ -11,11 +11,11 @@ use minicore::*;
#[no_mangle]
pub extern "vectorcall" fn f() {
//~^ ABI "vectorcall" which requires the `sse2` target feature
//~^ ERROR ABI "vectorcall" which requires the `sse2` target feature
}
#[no_mangle]
pub fn call_site() {
f();
//~^ ABI "vectorcall" which requires the `sse2` target feature
//~^ ERROR ABI "vectorcall" which requires the `sse2` target feature
}

View file

@ -3,7 +3,7 @@
//@ edition:2018
trait T {
fn foo(i32); //~ expected one of `:`, `@`, or `|`, found `)`
fn foo(i32); //~ ERROR expected one of `:`, `@`, or `|`, found `)`
// Also checks with `&`
fn foo_with_ref(&mut i32);

View file

@ -45,7 +45,7 @@ fn main() {
let p8 = Arc::default();
foo(
//~^ 47:5: 47:8: this function takes 8 arguments but 7 arguments were supplied [E0061]
//~^ ERROR this function takes 8 arguments but 7 arguments were supplied [E0061]
p1, //p2,
p3, p4, p5, p6, p7, p8,
);

View file

@ -15,7 +15,7 @@ fn f(
fn main() {
f(C, A, A, A, B, B, C); //~ ERROR function takes 6 arguments but 7 arguments were supplied [E0061]
f(C, C, A, A, B, B); //~ ERROR arguments to this function are incorrect [E0308]
f(A, A, D, D, B, B); //~ arguments to this function are incorrect [E0308]
f(C, C, B, B, A, A); //~ arguments to this function are incorrect [E0308]
f(C, C, A, B, A, A); //~ arguments to this function are incorrect [E0308]
f(A, A, D, D, B, B); //~ ERROR arguments to this function are incorrect [E0308]
f(C, C, B, B, A, A); //~ ERROR arguments to this function are incorrect [E0308]
f(C, C, A, B, A, A); //~ ERROR arguments to this function are incorrect [E0308]
}

View file

@ -1,6 +1,6 @@
const A: &'static [i32] = &[];
const B: i32 = (&A)[1];
//~^ index out of bounds: the length is 0 but the index is 1
//~^ NOTE index out of bounds: the length is 0 but the index is 1
//~| ERROR evaluation of constant value failed
fn main() {

View file

@ -1,6 +1,6 @@
const A: [i32; 0] = [];
const B: i32 = A[1];
//~^ index out of bounds: the length is 0 but the index is 1
//~^ NOTE index out of bounds: the length is 0 but the index is 1
//~| ERROR evaluation of constant value failed
fn main() {

View file

@ -18,6 +18,6 @@ use minicore::*;
fn main() {
unsafe {
asm!("", out("r9") _);
//[rwpi]~^ cannot use register `r9`
//[rwpi]~^ ERROR cannot use register `r9`
}
}

View file

@ -13,6 +13,6 @@ use minicore::*;
pub fn foo() {
unsafe {
asm!("", in("r8") 0);
//~^ cannot use register `r8`: high registers (r8+) can only be used as clobbers in Thumb-1 code
//~^ ERROR cannot use register `r8`: high registers (r8+) can only be used as clobbers in Thumb-1 code
}
}

View file

@ -11,7 +11,7 @@ fn main() {
let mut a = 0isize;
let p = &a;
asm!("{}", out(reg) a);
//~^ cannot assign to `a` because it is borrowed
//~^ ERROR cannot assign to `a` because it is borrowed
println!("{}", p);
// Can't read from mutable borrowed values.
@ -19,7 +19,7 @@ fn main() {
let mut a = 0isize;
let p = &mut a;
asm!("{}", in(reg) a);
//~^ cannot use `a` because it was mutably borrowed
//~^ ERROR cannot use `a` because it was mutably borrowed
println!("{}", p);
}
}

View file

@ -12,9 +12,9 @@ pub unsafe fn aarch64(a: f64, b: f64) -> f64 {
|| {};
b
});
//~^^^^ invalid register class
//~^^^^^ invalid register class
//~^^^^^^ invalid register
//~^^^^ ERROR invalid register class
//~^^^^^ ERROR invalid register class
//~^^^^^^ ERROR invalid register
c
}

View file

@ -3,7 +3,7 @@
// Cyclic assoc. const defaults don't error unless *used*
trait Tr {
const A: u8 = Self::B;
//~^ cycle detected
//~^ ERROR cycle detected
const B: u8 = Self::A;
}

View file

@ -13,8 +13,8 @@ impl Ty {
}
#[cfg(item)]
const _: Ty::Pr<String> = String::new(); //[item]~ the trait bound `String: Copy` is not satisfied
//[item]~^ the trait bound `String: Copy` is not satisfied
const _: Ty::Pr<String> = String::new(); //[item]~ ERROR the trait bound `String: Copy` is not satisfied
//[item]~^ ERROR the trait bound `String: Copy` is not satisfied
fn main() {
#[cfg(local)]

View file

@ -17,7 +17,7 @@ where
fn type_dependent<T: A>()
where
T::method(..): Send,
//~^ associated function `method` not found for `T`
//~^ ERROR associated function `method` not found for `T`
{
}

View file

@ -8,7 +8,7 @@ where
}
}
impl X<'_> for u32 //~ overflow evaluating the requirement `for<'b> u32: X<'b>`
impl X<'_> for u32 //~ ERROR overflow evaluating the requirement `for<'b> u32: X<'b>`
where
for<'b> <Self as X<'b>>::U: Clone,
{

View file

@ -1,16 +1,16 @@
trait Z<'a, T: ?Sized>
where
T: Z<'a, u16>,
//~^ the trait bound `str: Clone` is not satisfied
//~| the trait bound `str: Clone` is not satisfied
//~^ ERROR the trait bound `str: Clone` is not satisfied
//~| ERROR the trait bound `str: Clone` is not satisfied
for<'b> <T as Z<'b, u16>>::W: Clone,
{
type W: ?Sized;
fn h(&self, x: &T::W) {
<T::W>::clone(x);
//~^ the trait bound `str: Clone` is not satisfied
//~| the trait bound `str: Clone` is not satisfied
//~| the trait bound `str: Clone` is not satisfied
//~^ ERROR the trait bound `str: Clone` is not satisfied
//~| ERROR the trait bound `str: Clone` is not satisfied
//~| ERROR the trait bound `str: Clone` is not satisfied
}
}

View file

@ -12,10 +12,10 @@ where
impl<T: Copy + std::ops::Deref> UnsafeCopy<'_, T> for T {
type Item = T;
//~^ type mismatch resolving `<T as Deref>::Target == T`
//~^ ERROR type mismatch resolving `<T as Deref>::Target == T`
}
pub fn main() {
<&'static str>::bug(&"");
//~^ type mismatch resolving `<&str as Deref>::Target == &str`
//~^ ERROR type mismatch resolving `<&str as Deref>::Target == &str`
}

View file

@ -4,6 +4,6 @@ use std::borrow::Cow;
#[rustc_layout(debug)]
type Edges<'a, E> = Cow<'a, [E]>;
//~^ the trait bound `[E]: ToOwned` is not satisfied
//~^ ERROR the trait bound `[E]: ToOwned` is not satisfied
fn main() {}

View file

@ -13,7 +13,7 @@ impl Foo for Baz {
async fn bar<F>(&mut self, _func: F) -> ()
where
F: FnMut() + Send,
//~^ impl has stricter requirements than trait
//~^ ERROR impl has stricter requirements than trait
{
()
}

View file

@ -40,5 +40,5 @@ fn main() {
let agent = Agent { info_result: InfoResult { node: None } };
// FIXME: It would be nice for this to work. See #94067.
assert_send(agent.handle());
//~^ cannot be sent between threads safely
//~^ ERROR cannot be sent between threads safely
}

View file

@ -40,5 +40,5 @@ fn main() {
let agent = Agent { info_result: InfoResult { node: None } };
// FIXME: It would be nice for this to work. See #94067.
assert_send(agent.handle());
//~^ cannot be sent between threads safely
//~^ ERROR cannot be sent between threads safely
}

View file

@ -43,7 +43,7 @@ async fn suggest_await_on_previous_match_arms() {
0 => dummy(), //~ HELP consider `await`ing on the `Future`
1 => dummy(),
2 => dummy().await,
//~^ `match` arms have incompatible types [E0308]
//~^ ERROR `match` arms have incompatible types [E0308]
};
}

View file

@ -1,7 +1,7 @@
#![u=||{static d=||1;}]
//~^ attribute value must be a literal
//~| cannot find attribute `u` in this scope
//~| missing type for `static` item
//~^ ERROR attribute value must be a literal
//~| ERROR cannot find attribute `u` in this scope
//~| ERROR missing type for `static` item
#![a={impl std::ops::Neg for i8 {}}]
//~^ ERROR attribute value must be a literal

View file

@ -1,6 +1,6 @@
#![feature(used_with_arg)]
#[used(compiler, linker)] //~ expected `used`, `used(compiler)` or `used(linker)`
#[used(compiler, linker)] //~ ERROR expected `used`, `used(compiler)` or `used(linker)`
static mut USED_COMPILER_LINKER: [usize; 1] = [0];
fn main() {}

View file

@ -16,13 +16,13 @@ fn main() {
+=
x;
//~^ ERROR cannot move out of `x` because it is borrowed
//~| move out of `x` occurs here
//~| NOTE move out of `x` occurs here
let y = Int(2);
//~^ HELP consider changing this to be mutable
//~| SUGGESTION mut
y //~ ERROR cannot borrow `y` as mutable, as it is not declared as mutable
//~| cannot borrow as mutable
//~| NOTE cannot borrow as mutable
+=
Int(1);
}

View file

@ -4,11 +4,11 @@
//@ run-rustfix
auto trait Generic {}
//~^ auto traits cannot have generic parameters [E0567]
//~^ ERROR auto traits cannot have generic parameters [E0567]
auto trait Bound {}
//~^ auto traits cannot have super traits or lifetime bounds [E0568]
//~^ ERROR auto traits cannot have super traits or lifetime bounds [E0568]
auto trait LifetimeBound {}
//~^ auto traits cannot have super traits or lifetime bounds [E0568]
//~^ ERROR auto traits cannot have super traits or lifetime bounds [E0568]
auto trait MyTrait { }
//~^ auto traits cannot have associated items [E0380]
//~^ ERROR auto traits cannot have associated items [E0380]
fn main() {}

View file

@ -4,11 +4,11 @@
//@ run-rustfix
auto trait Generic<T> {}
//~^ auto traits cannot have generic parameters [E0567]
//~^ ERROR auto traits cannot have generic parameters [E0567]
auto trait Bound : Copy {}
//~^ auto traits cannot have super traits or lifetime bounds [E0568]
//~^ ERROR auto traits cannot have super traits or lifetime bounds [E0568]
auto trait LifetimeBound : 'static {}
//~^ auto traits cannot have super traits or lifetime bounds [E0568]
//~^ ERROR auto traits cannot have super traits or lifetime bounds [E0568]
auto trait MyTrait { fn foo() {} }
//~^ auto traits cannot have associated items [E0380]
//~^ ERROR auto traits cannot have associated items [E0380]
fn main() {}

View file

@ -14,7 +14,7 @@ impl Drop for DropString {
const LOCAL_REF: fn() -> &'static str = {
fn broken() -> &'static str {
let local = DropString { inner: format!("Some local string") };
return &local.inner; //~ borrow may still be in use when destructor runs
return &local.inner; //~ ERROR borrow may still be in use when destructor runs
}
broken
};

View file

@ -19,7 +19,7 @@ fn b() {
let vec: &mut [Box<isize>] = &mut vec;
match vec {
&mut [ref _b @ ..] => {
//~^ `vec[_]` is borrowed here
//~^ NOTE `vec[_]` is borrowed here
vec[0] = Box::new(4); //~ ERROR cannot assign
//~^ NOTE `vec[_]` is assigned to here
_b.use_ref();

View file

@ -13,5 +13,5 @@ fn main() {
//~| NOTE creates a temporary value which is freed while still in use
//~| HELP consider using a `let` binding to create a longer lived value
println!("{}", val);
//~^ borrow later used here
//~^ NOTE borrow later used here
}

View file

@ -12,5 +12,5 @@ fn main() {
//~| NOTE creates a temporary value which is freed while still in use
//~| HELP consider using a `let` binding to create a longer lived value
println!("{}", val);
//~^ borrow later used here
//~^ NOTE borrow later used here
}

View file

@ -9,6 +9,6 @@ impl Foo {
fn main() {
let mut foo = Foo { };
foo.method(&mut foo);
//~^ cannot borrow `foo` as mutable more than once at a time
//~^^ cannot borrow `foo` as mutable more than once at a time
//~^ ERROR cannot borrow `foo` as mutable more than once at a time
//~^^ ERROR cannot borrow `foo` as mutable more than once at a time
}

View file

@ -20,8 +20,8 @@ fn big_box() {
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:
//~^ ERROR First Pass analysis includes:
//~| ERROR Min Capture analysis includes:
let p = t.0.0;
//~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> ByValue
//~| NOTE: Min Capture t[(0, 0)] -> ByValue

View file

@ -17,8 +17,8 @@ fn main() {
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:
//~^ ERROR First Pass analysis includes:
//~| ERROR Min Capture analysis includes:
println!("{:?}", p);
//~^ NOTE: Capturing p[] -> Immutable
//~| NOTE: Min Capture p[] -> Immutable

View file

@ -16,8 +16,8 @@ fn main() {
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:
//~^ ERROR First Pass analysis includes:
//~| ERROR Min Capture analysis includes:
let _x = p.x;
//~^ NOTE: Capturing p[(0, 0)] -> ByValue
//~| NOTE: p[] captured as ByValue here

View file

@ -21,8 +21,8 @@ fn main() {
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:
//~^ ERROR First Pass analysis includes:
//~| ERROR Min Capture analysis includes:
let _x = a.b.c;
//~^ NOTE: Capturing a[(0, 0),(0, 0)] -> ByValue
//~| NOTE: a[(0, 0)] captured as ByValue here

View file

@ -21,8 +21,8 @@ fn main() {
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:
//~^ ERROR First Pass analysis includes:
//~| ERROR Min Capture analysis includes:
let _x = a.b;
//~^ NOTE: Capturing a[(0, 0)] -> ByValue
//~| NOTE: Min Capture a[(0, 0)] -> ByValue

View file

@ -15,8 +15,8 @@ fn main() {
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:
//~^ ERROR First Pass analysis includes:
//~| ERROR Min Capture analysis includes:
println!("{}", p.x);
//~^ NOTE: Capturing p[(0, 0)] -> Immutable
//~| NOTE: Min Capture p[(0, 0)] -> Immutable

View file

@ -10,8 +10,8 @@ fn main() {
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:
//~^ ERROR First Pass analysis includes:
//~| ERROR Min Capture analysis includes:
println!("{}", t.0);
//~^ NOTE: Capturing t[(0, 0)] -> Immutable
//~| NOTE: Min Capture t[(0, 0)] -> Immutable

View file

@ -18,8 +18,8 @@ fn multi_variant_enum() {
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:
//~^ ERROR First Pass analysis includes:
//~| ERROR Min Capture analysis includes:
if let Info::Point(_, _, str) = point {
//~^ NOTE: Capturing point[] -> Immutable
//~| NOTE: Capturing point[(2, 0)] -> ByValue
@ -50,8 +50,8 @@ fn single_variant_enum() {
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:
//~^ ERROR First Pass analysis includes:
//~| ERROR Min Capture analysis includes:
let SingleVariant::Point(_, _, str) = point;
//~^ NOTE: Capturing point[(2, 0)] -> ByValue
//~| NOTE: Min Capture point[(2, 0)] -> ByValue

View file

@ -11,15 +11,15 @@ union A {
fn main() {
let mut a = A { y: 1 };
let mut c = || {
//~^ `a.y` is borrowed here
//~^ NOTE `a.y` is borrowed here
let _ = unsafe { &a.y };
let _ = &mut a;
//~^ borrow occurs due to use in closure
//~^ NOTE borrow occurs due to use in closure
let _ = unsafe { &mut a.y };
};
a.y = 1;
//~^ cannot assign to `a.y` because it is borrowed [E0506]
//~| `a.y` is assigned to here
//~^ ERROR cannot assign to `a.y` because it is borrowed [E0506]
//~| NOTE `a.y` is assigned to here
c();
//~^ borrow later used here
//~^ NOTE borrow later used here
}

View file

@ -10,8 +10,8 @@ fn test_1_should_capture() {
let variant = Some(2229);
let c = #[rustc_capture_analysis]
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:
//~^ ERROR First Pass analysis includes:
//~| ERROR Min Capture analysis includes:
match variant {
//~^ NOTE: Capturing variant[] -> Immutable
//~| NOTE: Min Capture variant[] -> Immutable
@ -28,7 +28,7 @@ fn test_2_should_not_capture() {
let variant = Some(2229);
let c = #[rustc_capture_analysis]
|| {
//~^ First Pass analysis includes:
//~^ ERROR First Pass analysis includes:
match variant {
_ => {}
}
@ -47,7 +47,7 @@ fn test_3_should_not_capture_single_variant() {
let variant = SingleVariant::Points(1);
let c = #[rustc_capture_analysis]
|| {
//~^ First Pass analysis includes:
//~^ ERROR First Pass analysis includes:
match variant {
SingleVariant::Points(_) => {}
}
@ -61,8 +61,8 @@ fn test_6_should_capture_single_variant() {
let variant = SingleVariant::Points(1);
let c = #[rustc_capture_analysis]
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:
//~^ ERROR First Pass analysis includes:
//~| ERROR Min Capture analysis includes:
match variant {
//~^ NOTE: Capturing variant[] -> Immutable
//~| NOTE: Capturing variant[(0, 0)] -> Immutable
@ -81,7 +81,7 @@ fn test_4_should_not_capture_array() {
let array: [i32; 3] = [0; 3];
let c = #[rustc_capture_analysis]
|| {
//~^ First Pass analysis includes:
//~^ ERROR First Pass analysis includes:
match array {
[_,_,_] => {}
}
@ -93,7 +93,7 @@ fn test_4_should_not_capture_array() {
let array: &[i32; 3] = &[0; 3];
let c = #[rustc_capture_analysis]
|| {
//~^ First Pass analysis includes:
//~^ ERROR First Pass analysis includes:
match array {
[_, _, _] => {}
}
@ -106,7 +106,7 @@ fn test_4_should_not_capture_array() {
let f = &Foo(&[10; 3]);
let c = #[rustc_capture_analysis]
|| {
//~^ First Pass analysis includes:
//~^ ERROR First Pass analysis includes:
match f {
Foo([_, _, _]) => ()
}
@ -128,8 +128,8 @@ fn test_5_should_capture_multi_variant() {
let variant = MVariant::A;
let c = #[rustc_capture_analysis]
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:
//~^ ERROR First Pass analysis includes:
//~| ERROR Min Capture analysis includes:
match variant {
//~^ NOTE: Capturing variant[] -> Immutable
//~| NOTE: Min Capture variant[] -> Immutable
@ -146,8 +146,8 @@ fn test_7_should_capture_slice_len() {
let slice: &[i32] = &[1, 2, 3];
let c = #[rustc_capture_analysis]
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:
//~^ ERROR First Pass analysis includes:
//~| ERROR Min Capture analysis includes:
match slice {
//~^ NOTE: Capturing slice[] -> Immutable
//~| NOTE: Min Capture slice[] -> Immutable
@ -158,8 +158,8 @@ fn test_7_should_capture_slice_len() {
c();
let c = #[rustc_capture_analysis]
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:
//~^ ERROR First Pass analysis includes:
//~| ERROR Min Capture analysis includes:
match slice {
//~^ NOTE: Capturing slice[] -> Immutable
//~| NOTE: Min Capture slice[] -> Immutable
@ -170,8 +170,8 @@ fn test_7_should_capture_slice_len() {
c();
let c = #[rustc_capture_analysis]
|| {
//~^ First Pass analysis includes:
//~| Min Capture analysis includes:
//~^ ERROR First Pass analysis includes:
//~| ERROR Min Capture analysis includes:
match slice {
//~^ NOTE: Capturing slice[] -> Immutable
//~| NOTE: Min Capture slice[] -> Immutable
@ -187,7 +187,7 @@ fn test_8_capture_slice_wild() {
let slice: &[i32] = &[1, 2, 3];
let c = #[rustc_capture_analysis]
|| {
//~^ First Pass analysis includes:
//~^ ERROR First Pass analysis includes:
match slice {
[..] => {},
_ => {}

View file

@ -181,9 +181,9 @@ fn box_mut_1() {
//~^ ERROR: attributes on expressions are experimental
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
//~| First Pass analysis includes:
//~| ERROR First Pass analysis includes:
//~| NOTE: Capturing box_p_foo[Deref,Deref,(0, 0)] -> Mutable
//~| Min Capture analysis includes:
//~| ERROR Min Capture analysis includes:
//~| NOTE: Min Capture box_p_foo[] -> ByValue
}
@ -199,9 +199,9 @@ fn box_mut_2() {
//~^ ERROR: attributes on expressions are experimental
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
//~| First Pass analysis includes:
//~| ERROR First Pass analysis includes:
//~| NOTE: Capturing p_foo[Deref,Deref,(0, 0)] -> Mutable
//~| Min Capture analysis includes:
//~| ERROR Min Capture analysis includes:
//~| NOTE: Min Capture p_foo[] -> ByValue
}
@ -213,9 +213,9 @@ fn returned_closure_owns_copy_type_data() -> impl Fn() -> i32 {
//~^ ERROR: attributes on expressions are experimental
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
//~| First Pass analysis includes:
//~| ERROR First Pass analysis includes:
//~| NOTE: Capturing x[] -> Immutable
//~| Min Capture analysis includes:
//~| ERROR Min Capture analysis includes:
//~| NOTE: Min Capture x[] -> ByValue
c

View file

@ -2,5 +2,5 @@
fn main() {
let _f = for<'a> |_: &'a ()| {};
//~^ implicit types in closure signatures are forbidden when `for<...>` is present
//~^ ERROR implicit types in closure signatures are forbidden when `for<...>` is present
}

View file

@ -16,7 +16,7 @@ impl<'a, T> Foo<'a> for Wrap<T> where T: Fn(&'a i32) {}
fn main() {
needs_foo(|x| {
//[current]~^ implementation of `Foo` is not general enough
//[current]~^ ERROR implementation of `Foo` is not general enough
//[next]~^^ ERROR type annotations needed
x.to_string();
});

View file

@ -21,9 +21,9 @@ fn func(_f: impl Fn()) -> usize {
fn test_func(s: &S) -> usize {
let mut x = ();
s.assoc_func(|| x = ());
//~^ cannot assign to `x`, as it is a captured variable in a `Fn` closure
//~^ ERROR cannot assign to `x`, as it is a captured variable in a `Fn` closure
func(|| x = ())
//~^ cannot assign to `x`, as it is a captured variable in a `Fn` closure
//~^ ERROR cannot assign to `x`, as it is a captured variable in a `Fn` closure
}
fn main() {}

View file

@ -2,5 +2,5 @@ fn test<T>(_a: T, _b: T) {}
fn main() {
test(&mut 7, &7);
//~^ mismatched types
//~^ ERROR mismatched types
}

View file

@ -33,7 +33,7 @@ fn make_foo(_: *mut *mut Foo) {
fn main() {
let mut result: SmartPtr<Foo> = SmartPtr(std::ptr::null_mut());
make_foo(&mut &mut *result); //~ mismatched types
make_foo(&mut &mut *result); //~ ERROR mismatched types
//~^ expected `*mut *mut Foo`, found `&mut &mut Foo`
make_foo(out(&mut result)); // works, but makes one wonder why above coercion cannot happen
}

View file

@ -4,18 +4,18 @@
use std::marker::ConstParamTy;
#[derive(ConstParamTy)]
//~^ the trait `ConstParamTy_` cannot be implemented for this ty
//~| the trait `ConstParamTy_` cannot be implemented for this ty
//~^ ERROR the trait `ConstParamTy_` cannot be implemented for this ty
//~| ERROR the trait `ConstParamTy_` cannot be implemented for this ty
struct Foo([*const u8; 1]);
#[derive(ConstParamTy)]
//~^ the trait `ConstParamTy_` cannot be implemented for this ty
//~| the trait `ConstParamTy_` cannot be implemented for this ty
//~^ ERROR the trait `ConstParamTy_` cannot be implemented for this ty
//~| ERROR the trait `ConstParamTy_` cannot be implemented for this ty
struct Foo2([*mut u8; 1]);
#[derive(ConstParamTy)]
//~^ the trait `ConstParamTy_` cannot be implemented for this ty
//~| the trait `ConstParamTy_` cannot be implemented for this ty
//~^ ERROR the trait `ConstParamTy_` cannot be implemented for this ty
//~| ERROR the trait `ConstParamTy_` cannot be implemented for this ty
struct Foo3([fn(); 1]);
fn main() {}

View file

@ -4,7 +4,7 @@ struct A<const N: u8>;
trait Foo {}
impl Foo for A<N> {}
//~^ ERROR cannot find type
//~| unresolved item provided when a constant
//~| ERROR unresolved item provided when a constant
struct B<const N: u8>;
impl<N> Foo for B<N> {}
@ -13,4 +13,4 @@ impl<N> Foo for B<N> {}
struct C<const C: u8, const N: u8>;
impl<const N: u8> Foo for C<N, T> {}
//~^ ERROR cannot find type
//~| unresolved item provided when a constant
//~| ERROR unresolved item provided when a constant

View file

@ -11,7 +11,7 @@ struct Collatz<const N: Option<usize>>;
impl <const N: usize> Collatz<{Some(N)}> {}
//~^ ERROR the const parameter
//[min]~^^ generic parameters may not be used in const operations
//[min]~^^ ERROR generic parameters may not be used in const operations
//[full]~^^^ ERROR overly complex
struct Foo;

View file

@ -17,9 +17,9 @@ struct Inner;
// - impl StructuralPartialEq
#[derive(PartialEq, Eq)]
struct Outer<const I: Inner>;
//[min]~^ `Inner` is forbidden
//[min]~| `Inner` is forbidden
//[min]~| `Inner` is forbidden
//[min]~| `Inner` is forbidden
//[min]~^ ERROR `Inner` is forbidden
//[min]~| ERROR `Inner` is forbidden
//[min]~| ERROR `Inner` is forbidden
//[min]~| ERROR `Inner` is forbidden
fn main() {}

View file

@ -12,7 +12,7 @@ impl True for If<true> {}
fn consume<T: 'static>(_val: T)
where
If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True,
//~^ overly complex generic constant
//~^ ERROR overly complex generic constant
//~| ERROR: cannot call
{
}
@ -20,7 +20,7 @@ where
fn test<T: 'static>()
where
If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True,
//~^ overly complex generic constant
//~^ ERROR overly complex generic constant
//~| ERROR: cannot call
{
}

View file

@ -10,9 +10,9 @@ use std::future::Future;
// From <https://github.com/rust-lang/rust/issues/77361>
const _: i32 = { core::mem::ManuallyDrop::new(async { 0 }); 4 };
//[without_feature]~^ `async` block
//[without_feature]~^ ERROR `async` block
static _FUT: &(dyn Future<Output = ()> + Sync) = &async {};
//[without_feature]~^ `async` block
//[without_feature]~^ ERROR `async` block
fn main() {}

View file

@ -4,10 +4,10 @@ const VAL: i32 = ARR[IDX];
const BONG: [i32; (ARR[0] - 41) as usize] = [5];
const BLUB: [i32; (ARR[0] - 40) as usize] = [5];
//~^ ERROR: mismatched types
//~| expected an array
//~| NOTE expected an array
const BOO: [i32; (ARR[0] - 41) as usize] = [5, 99];
//~^ ERROR: mismatched types
//~| expected an array
//~| NOTE expected an array
fn main() {
let _ = VAL;

View file

@ -3,6 +3,6 @@
fn main() {
static C: u64 = unsafe {*(0xdeadbeef as *const u64)};
//~^ ERROR could not evaluate static initializer
//~| dangling pointer
//~| NOTE dangling pointer
println!("{}", C);
}

View file

@ -7,7 +7,7 @@ union Foo {
enum Bar {
Boo = [unsafe { Foo { b: () }.a }; 4][3],
//~^ ERROR evaluation of constant value failed
//~| uninitialized
//~| NOTE uninitialized
}
fn main() {

View file

@ -6,7 +6,7 @@ use std::cell::UnsafeCell;
static mut FOO: u32 = 42;
static BOO: () = unsafe {
FOO = 5;
//~^ could not evaluate static initializer [E0080]
//~^ ERROR could not evaluate static initializer [E0080]
};
fn main() {}

View file

@ -8,7 +8,7 @@ const CONSTANT: S = S(0);
enum E {
V = CONSTANT,
//~^ ERROR mismatched types
//~| expected `isize`, found `S`
//~| NOTE expected `isize`, found `S`
}
fn main() {}

View file

@ -5,6 +5,6 @@ const Z: i32 = unsafe { *(&1 as *const i32) };
// bad, will thus error in miri
const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR evaluation of constant value failed
//~| is a dangling pointer
//~| NOTE is a dangling pointer
const Z3: i32 = unsafe { *(44 as *const i32) }; //~ ERROR evaluation of constant value failed
//~| is a dangling pointer
//~| NOTE is a dangling pointer

View file

@ -37,7 +37,7 @@ const OFFSET: () = unsafe {
// fails.
let field = &x.a;
//~^ ERROR: evaluation of constant value failed
//~| does not have a known offset
//~| NOTE does not have a known offset
};
fn main() {}

View file

@ -5,7 +5,7 @@ const PARTIAL_OVERWRITE: () = {
unsafe {
let ptr: *mut _ = &mut p;
*(ptr as *mut u8) = 123; //~ ERROR constant
//~| unable to overwrite parts of a pointer
//~| NOTE unable to overwrite parts of a pointer
}
let x = *p;
};

View file

@ -10,7 +10,7 @@ const _: u8 = {
e = E::B;
unsafe { *p }
//~^ ERROR evaluation of constant value failed
//~| uninitialized
//~| NOTE uninitialized
};
fn main() {}

View file

@ -8,14 +8,14 @@ const WRITE_AFTER_CAST: () = unsafe {
let mut x = 0;
let ptr = &x as *const i32 as *mut i32;
*ptr = 0; //~ERROR: evaluation of constant value failed
//~| immutable
//~| NOTE immutable
};
const WRITE_AFTER_TRANSMUTE: () = unsafe {
let mut x = 0;
let ptr: *mut i32 = mem::transmute(&x);
*ptr = 0; //~ERROR: evaluation of constant value failed
//~| immutable
//~| NOTE immutable
};
// it's okay when there is interior mutability;

View file

@ -13,13 +13,13 @@ const UNION: DummyUnion = DummyUnion { field1: 1065353216 };
const FIELD3: Field3 = unsafe { UNION.field3 };
//~^ ERROR evaluation of constant value failed
//~| uninitialized
//~| NOTE uninitialized
const FIELD_PATH: Struct = Struct {
a: 42,
b: unsafe { UNION.field3 },
//~^ ERROR evaluation of constant value failed
//~| uninitialized
//~| NOTE uninitialized
};
struct Struct {
@ -32,7 +32,7 @@ const FIELD_PATH2: Struct2 = Struct2 {
21,
unsafe { UNION.field3 },
//~^ ERROR evaluation of constant value failed
//~| uninitialized
//~| NOTE uninitialized
23,
24,
],

View file

@ -5,7 +5,7 @@ union Foo {
}
fn main() {
let x: &'static bool = &unsafe { //~ temporary value dropped while borrowed
let x: &'static bool = &unsafe { //~ ERROR temporary value dropped while borrowed
Foo { a: &1 }.b == Foo { a: &2 }.b
};
}

View file

@ -8,11 +8,11 @@ const unsafe extern "C-unwind" fn bar() -> usize {
fn main() {
let a: [u8; foo()];
//~^ call to unsafe function `foo` is unsafe and requires unsafe function or block
//~^ ERROR call to unsafe function `foo` is unsafe and requires unsafe function or block
foo();
//~^ ERROR call to unsafe function `foo` is unsafe and requires unsafe function or block
let b: [u8; bar()];
//~^ call to unsafe function `bar` is unsafe and requires unsafe function or block
//~^ ERROR call to unsafe function `bar` is unsafe and requires unsafe function or block
bar();
//~^ ERROR call to unsafe function `bar` is unsafe and requires unsafe function or block
}

View file

@ -1,67 +1,67 @@
const X: usize = 42 && 39;
//~^ ERROR mismatched types
//~| expected `bool`, found integer
//~| NOTE expected `bool`, found integer
//~| ERROR mismatched types
//~| expected `bool`, found integer
//~| NOTE expected `bool`, found integer
//~| ERROR mismatched types
//~| expected `usize`, found `bool`
//~| NOTE expected `usize`, found `bool`
const ARR: [i32; X] = [99; 34];
const X1: usize = 42 || 39;
//~^ ERROR mismatched types
//~| expected `bool`, found integer
//~| NOTE expected `bool`, found integer
//~| ERROR mismatched types
//~| expected `bool`, found integer
//~| NOTE expected `bool`, found integer
//~| ERROR mismatched types
//~| expected `usize`, found `bool`
//~| NOTE expected `usize`, found `bool`
const ARR1: [i32; X1] = [99; 47];
const X2: usize = -42 || -39;
//~^ ERROR mismatched types
//~| expected `bool`, found integer
//~| NOTE expected `bool`, found integer
//~| ERROR mismatched types
//~| expected `bool`, found integer
//~| NOTE expected `bool`, found integer
//~| ERROR mismatched types
//~| expected `usize`, found `bool`
//~| NOTE expected `usize`, found `bool`
const ARR2: [i32; X2] = [99; 18446744073709551607];
const X3: usize = -42 && -39;
//~^ ERROR mismatched types
//~| expected `bool`, found integer
//~| NOTE expected `bool`, found integer
//~| ERROR mismatched types
//~| expected `bool`, found integer
//~| NOTE expected `bool`, found integer
//~| ERROR mismatched types
//~| expected `usize`, found `bool`
//~| NOTE expected `usize`, found `bool`
const ARR3: [i32; X3] = [99; 6];
const Y: usize = 42.0 == 42.0;
//~^ ERROR mismatched types
//~| expected `usize`, found `bool`
//~| NOTE expected `usize`, found `bool`
const ARRR: [i32; Y] = [99; 1];
const Y1: usize = 42.0 >= 42.0;
//~^ ERROR mismatched types
//~| expected `usize`, found `bool`
//~| NOTE expected `usize`, found `bool`
const ARRR1: [i32; Y1] = [99; 1];
const Y2: usize = 42.0 <= 42.0;
//~^ ERROR mismatched types
//~| expected `usize`, found `bool`
//~| NOTE expected `usize`, found `bool`
const ARRR2: [i32; Y2] = [99; 1];
const Y3: usize = 42.0 > 42.0;
//~^ ERROR mismatched types
//~| expected `usize`, found `bool`
//~| NOTE expected `usize`, found `bool`
const ARRR3: [i32; Y3] = [99; 0];
const Y4: usize = 42.0 < 42.0;
//~^ ERROR mismatched types
//~| expected `usize`, found `bool`
//~| NOTE expected `usize`, found `bool`
const ARRR4: [i32; Y4] = [99; 0];
const Y5: usize = 42.0 != 42.0;
//~^ ERROR mismatched types
//~| expected `usize`, found `bool`
//~| NOTE expected `usize`, found `bool`
const ARRR5: [i32; Y5] = [99; 0];
fn main() {

View file

@ -7,5 +7,5 @@ const TWO: usize = 2;
fn main() {
let a: [i8; ONE - TWO] = unimplemented!();
//~^ ERROR evaluation of constant value failed
//~| attempt to compute `1_usize - 2_usize`, which would overflow
//~| NOTE attempt to compute `1_usize - 2_usize`, which would overflow
}

View file

@ -1,6 +1,6 @@
const FOO: &'static[u32] = &[1, 2, 3];
const BAR: u32 = FOO[5];
//~^ index out of bounds: the length is 3 but the index is 5
//~^ NOTE index out of bounds: the length is 3 but the index is 5
//~| ERROR evaluation of constant value failed
fn main() {

View file

@ -32,7 +32,7 @@ const COPY_OOB_1: () = unsafe {
copy_nonoverlapping(0x100 as *const i32, dangle, 0);
// Non-zero-sized copy is not.
copy_nonoverlapping(0x100 as *const i32, dangle, 1); //~ ERROR evaluation of constant value failed [E0080]
//~| got 0x100[noalloc] which is a dangling pointer
//~| NOTE got 0x100[noalloc] which is a dangling pointer
};
const COPY_OOB_2: () = unsafe {
let x = 0i32;
@ -41,20 +41,20 @@ const COPY_OOB_2: () = unsafe {
copy_nonoverlapping(dangle, 0x100 as *mut i32, 0);
// Non-zero-sized copy is not.
copy_nonoverlapping(dangle, 0x100 as *mut i32, 1); //~ ERROR evaluation of constant value failed [E0080]
//~| +0x28 which is at or beyond the end of the allocation
//~| NOTE +0x28 which is at or beyond the end of the allocation
};
const COPY_SIZE_OVERFLOW: () = unsafe {
let x = 0;
let mut y = 0;
copy(&x, &mut y, 1usize << (mem::size_of::<usize>() * 8 - 1)); //~ ERROR evaluation of constant value failed [E0080]
//~| overflow computing total size of `copy`
//~| NOTE overflow computing total size of `copy`
};
const COPY_NONOVERLAPPING_SIZE_OVERFLOW: () = unsafe {
let x = 0;
let mut y = 0;
copy_nonoverlapping(&x, &mut y, 1usize << (mem::size_of::<usize>() * 8 - 1)); //~ evaluation of constant value failed [E0080]
//~| overflow computing total size of `copy_nonoverlapping`
copy_nonoverlapping(&x, &mut y, 1usize << (mem::size_of::<usize>() * 8 - 1)); //~ ERROR evaluation of constant value failed [E0080]
//~| NOTE overflow computing total size of `copy_nonoverlapping`
};
fn main() {

View file

@ -11,7 +11,7 @@ impl Drop for S {
}
const fn foo() {
let s = S; //~ destructor
let s = S; //~ ERROR destructor
}
fn main() {}

View file

@ -1,9 +1,9 @@
enum Test {
DivZero = 1/0,
//~^ attempt to divide `1_isize` by zero
//~^ NOTE attempt to divide `1_isize` by zero
//~| ERROR evaluation of constant value failed
RemZero = 1%0,
//~^ attempt to calculate the remainder of `1_isize` with a divisor of zero
//~^ NOTE attempt to calculate the remainder of `1_isize` with a divisor of zero
//~| ERROR evaluation of constant value failed
}

View file

@ -28,32 +28,32 @@ enum UninhDiscriminant {
const INVALID_BOOL: () = unsafe {
let _x: bool = transmute(3u8);
//[with_flag]~^ ERROR: evaluation of constant value failed
//[with_flag]~| invalid value
//[with_flag]~| NOTE invalid value
};
const INVALID_PTR_IN_INT: () = unsafe {
let _x: usize = transmute(&3u8);
//[with_flag]~^ ERROR: evaluation of constant value failed
//[with_flag]~| invalid value
//[with_flag]~| NOTE invalid value
};
const INVALID_PTR_IN_ENUM: () = unsafe {
let _x: PtrSizedEnum = transmute(&3u8);
//[with_flag]~^ ERROR: evaluation of constant value failed
//[with_flag]~| invalid value
//[with_flag]~| NOTE invalid value
};
const INVALID_SLICE_TO_USIZE_TRANSMUTE: () = unsafe {
let x: &[u8] = &[0; 32];
let _x: (usize, usize) = transmute(x);
//[with_flag]~^ ERROR: evaluation of constant value failed
//[with_flag]~| invalid value
//[with_flag]~| NOTE invalid value
};
const UNALIGNED_PTR: () = unsafe {
let _x: &u32 = transmute(&[0u8; 4]);
//[with_flag]~^ ERROR: evaluation of constant value failed
//[with_flag]~| invalid value
//[with_flag]~| NOTE invalid value
};
const UNINHABITED_VARIANT: () = unsafe {
@ -61,7 +61,7 @@ const UNINHABITED_VARIANT: () = unsafe {
// Not using transmute, we want to hit the ImmTy code path.
let v = *addr_of!(data).cast::<UninhDiscriminant>();
//[with_flag]~^ ERROR: evaluation of constant value failed
//[with_flag]~| invalid value
//[with_flag]~| NOTE invalid value
};
const PARTIAL_POINTER: () = unsafe {
@ -81,7 +81,7 @@ const PARTIAL_POINTER: () = unsafe {
let mem = Align { p: mem, align: 0 };
let _val = *(&mem as *const Align as *const [*const u8; 2]);
//[with_flag]~^ ERROR: evaluation of constant value failed
//[with_flag]~| invalid value
//[with_flag]~| NOTE invalid value
};
// Regression tests for an ICE (related to <https://github.com/rust-lang/rust/issues/113988>).
@ -96,7 +96,7 @@ const OVERSIZED_REF: () = { unsafe {
let slice: *const [u8] = transmute((1usize, usize::MAX));
let _val = &*slice;
//[with_flag]~^ ERROR: evaluation of constant value failed
//[with_flag]~| slice is bigger than largest supported object
//[with_flag]~| NOTE slice is bigger than largest supported object
} };
fn main() {}

View file

@ -3,5 +3,5 @@ const STRUCT: MyStruct = MyStruct { field: 42 };
fn main() {
let a: [isize; STRUCT.nonexistent_field];
//~^ no field `nonexistent_field` on type `MyStruct`
//~^ ERROR no field `nonexistent_field` on type `MyStruct`
}

View file

@ -34,13 +34,13 @@ const fn foo35(a: bool, b: bool) -> bool { a ^ b }
struct Foo<T: ?Sized>(T);
impl<T> Foo<T> {
const fn new(t: T) -> Self { Foo(t) }
const fn into_inner(self) -> T { self.0 } //~ destructor of
const fn into_inner(self) -> T { self.0 } //~ ERROR destructor of
const fn get(&self) -> &T { &self.0 }
const fn get_mut(&mut self) -> &mut T { &mut self.0 }
}
impl<'a, T> Foo<T> {
const fn new_lt(t: T) -> Self { Foo(t) }
const fn into_inner_lt(self) -> T { self.0 } //~ destructor of
const fn into_inner_lt(self) -> T { self.0 } //~ ERROR destructor of
const fn get_lt(&self) -> &T { &self.0 }
const fn get_mut_lt(&mut self) -> &mut T { &mut self.0 }
}

View file

@ -6,7 +6,7 @@
static PTR_INT_CAST: () = {
let x = &0 as *const _ as usize;
//~^ ERROR could not evaluate static initializer
//~| exposing pointers
//~| NOTE exposing pointers
let _v = x == x;
};
@ -14,7 +14,7 @@ static PTR_INT_TRANSMUTE: () = unsafe {
let x: usize = std::mem::transmute(&0);
let _v = x + 0;
//~^ ERROR could not evaluate static initializer
//~| unable to turn pointer into integer
//~| NOTE unable to turn pointer into integer
};
// I'd love to test pointer comparison, but that is not possible since

View file

@ -4,6 +4,6 @@
static mut A: &'static [u32] = &[1];
static B: [u32; 1] = [0; unsafe { A.len() }];
//~^ ERROR: evaluation of constant value failed
//~| mutable global memory
//~| NOTE mutable global memory
fn main() {}

View file

@ -12,6 +12,6 @@
pub struct Data([u8; (1 << 47) - 1]);
const _: &'static Data = &Data([0; (1 << 47) - 1]);
//~^ERROR: evaluation of constant value failed
//~| tried to allocate more memory than available to compiler
//~| NOTE tried to allocate more memory than available to compiler
fn main() {}

View file

@ -2,6 +2,6 @@
pub struct Data([u8; usize::MAX >> 2]);
const _: &'static [Data] = &[];
//~^ERROR: evaluation of constant value failed
//~| too big for the target architecture
//~| NOTE too big for the target architecture
fn main() {}

View file

@ -10,7 +10,7 @@
static FOO: () = FOO;
//~^ ERROR could not evaluate static initializer
static A: () = B; //~ cycle detected when evaluating initializer of static `A`
static A: () = B; //~ ERROR cycle detected when evaluating initializer of static `A`
static B: () = A;
fn main() {

View file

@ -6,7 +6,7 @@ const C: () = {
// This used to ICE, but it should just report UB.
let _ice = (*fat)[usize::MAX - 1];
//~^ERROR: constant value failed
//~| overflow
//~| NOTE overflow
}
};

View file

@ -43,8 +43,8 @@ fn main() {
// Disallow impls which relates lifetimes in the coroutine interior
let gen = #[coroutine] move || {
let a = A(&mut true, &mut true, No);
//~^ temporary value dropped while borrowed
//~| temporary value dropped while borrowed
//~^ ERROR temporary value dropped while borrowed
//~| ERROR temporary value dropped while borrowed
yield;
assert_foo(a);
};

View file

@ -6,7 +6,7 @@ fn main() {
// The reference in `_a` is a Legal with NLL since it ends before the yield
let _a = &mut true;
let b = &mut true;
//~^ borrow may still be in use when coroutine yields
//~^ ERROR borrow may still be in use when coroutine yields
yield ();
println!("{}", b);
};

View file

@ -22,5 +22,5 @@ fn main() {
let mut gen = Pin::new(&mut gen);
gen.as_mut().resume(&mut thing);
gen.as_mut().resume(&mut thing);
//~^ cannot borrow `thing` as mutable more than once at a time
//~^ ERROR cannot borrow `thing` as mutable more than once at a time
}

View file

@ -2,6 +2,6 @@
fn main() {
match String::new() {
"" | _ => {}
//~^ mismatched types
//~^ ERROR mismatched types
}
}

View file

@ -55,6 +55,6 @@ impl<T> Foo for T where T: Expression {}
fn main() {
SelectInt.check("bar");
//[current]~^ ERROR the trait bound `&str: AsExpression<Integer>` is not satisfied
//[next]~^^ the trait bound `&str: AsExpression<<SelectInt as Expression>::SqlType>` is not satisfied
//[next]~| type mismatch
//[next]~^^ ERROR the trait bound `&str: AsExpression<<SelectInt as Expression>::SqlType>` is not satisfied
//[next]~| ERROR type mismatch
}

View file

@ -15,7 +15,7 @@ struct B;
fn main() {
B.request();
//~^ my message [E0599]
//~^ ERROR my message [E0599]
//~| my label
//~| my note
}

View file

@ -8,8 +8,8 @@
note = "custom note"
)]
#[diagnostic::on_unimplemented(message = "fallback!!")]
//~^ `message` is ignored due to previous definition of `message`
//~| `message` is ignored due to previous definition of `message`
//~^ WARN `message` is ignored due to previous definition of `message`
//~| WARN `message` is ignored due to previous definition of `message`
#[diagnostic::on_unimplemented(label = "fallback label")]
#[diagnostic::on_unimplemented(note = "fallback note")]
trait Foo {}

View file

@ -14,7 +14,7 @@ struct Foo<'a> {
impl<'a> Foo<'a> {
fn f(&self) {
self.s.push('x'); //~ cannot borrow `*self.s` as mutable, as it is behind a `&` reference
self.s.push('x'); //~ ERROR cannot borrow `*self.s` as mutable, as it is behind a `&` reference
}
}

View file

@ -35,5 +35,5 @@ impl S {
}
fn main() {
S.hello_method(); //~ no method named `hello_method` found
S.hello_method(); //~ ERROR no method named `hello_method` found
}

View file

@ -26,5 +26,5 @@ struct Context { wrapper: Wrapper }
fn overton() {
let _c = Context { wrapper: Payload{} };
//~^ ERROR mismatched types
//~| try wrapping the expression in `Wrapper`
//~| HELP try wrapping the expression in `Wrapper`
}

View file

@ -10,7 +10,7 @@ fn should_lint_with_potential_borrowck_err() {
//~^ ERROR: relative drop order changing
//~| WARN: this changes meaning in Rust 2024
//~| NOTE: this temporary value will be dropped at the end of the block
//~| borrow later used by call
//~| NOTE: borrow later used by call
//~| NOTE: for more information, see
}
@ -20,7 +20,7 @@ fn should_lint_with_unsafe_block() {
//~^ ERROR: relative drop order changing
//~| WARN: this changes meaning in Rust 2024
//~| NOTE: this temporary value will be dropped at the end of the block
//~| borrow later used by call
//~| NOTE: borrow later used by call
//~| NOTE: for more information, see
}
@ -32,7 +32,7 @@ fn should_lint_with_big_block() {
//~^ ERROR: relative drop order changing
//~| WARN: this changes meaning in Rust 2024
//~| NOTE: this temporary value will be dropped at the end of the block
//~| borrow later used here
//~| NOTE: borrow later used here
//~| NOTE: for more information, see
})
}
@ -44,7 +44,7 @@ fn another_temp_that_is_copy_in_arg() {
//~^ ERROR: relative drop order changing
//~| WARN: this changes meaning in Rust 2024
//~| NOTE: this temporary value will be dropped at the end of the block
//~| borrow later used by call
//~| NOTE: borrow later used by call
//~| NOTE: for more information, see
}

Some files were not shown because too many files have changed in this diff Show more