Skip to content

UI tests: add missing diagnostic kinds where possible #139555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion tests/rustdoc-ui/invalid-syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand Down
74 changes: 37 additions & 37 deletions tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,63 +5,63 @@ 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;
}

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`
}
2 changes: 1 addition & 1 deletion tests/rustdoc-ui/issues/ice-typeof-102986.rs
Original file line number Diff line number Diff line change
@@ -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
}
10 changes: 5 additions & 5 deletions tests/ui-fulldeps/hash-stable-is-unstable.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
10 changes: 5 additions & 5 deletions tests/ui-fulldeps/try-from-u32/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
6 changes: 3 additions & 3 deletions tests/ui/abi/simd-abi-checks-avx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!()
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/abi/simd-abi-checks-empty-list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion tests/ui/abi/simd-abi-checks-sse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions tests/ui/abi/vectorcall-abi-checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion tests/ui/anon-params/anon-params-denied-2018.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/argument-suggestions/issue-100478.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is nice

p1, //p2,
p3, p4, p5, p6, p7, p8,
);
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/argument-suggestions/issue-101097.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
2 changes: 1 addition & 1 deletion tests/ui/array-slice-vec/array_const_index-0.rs
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/array-slice-vec/array_const_index-1.rs
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/asm/issue-85247.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ use minicore::*;
fn main() {
unsafe {
asm!("", out("r9") _);
//[rwpi]~^ cannot use register `r9`
//[rwpi]~^ ERROR cannot use register `r9`
}
}
2 changes: 1 addition & 1 deletion tests/ui/asm/issue-99071.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
4 changes: 2 additions & 2 deletions tests/ui/asm/type-check-4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ 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.

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);
}
}
6 changes: 3 additions & 3 deletions tests/ui/asm/x86_64/issue-82869.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/associated-consts/defaults-cyclic-fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`
{
}

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/associated-types/hr-associated-type-bound-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
{
Expand Down
10 changes: 5 additions & 5 deletions tests/ui/associated-types/hr-associated-type-bound-param-2.rs
Original file line number Diff line number Diff line change
@@ -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
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/associated-types/hr-associated-type-projection-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`
}
2 changes: 1 addition & 1 deletion tests/ui/associated-types/issue-85103-layout-debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Loading
Loading