Remove attribute #[rustc_error]

This commit is contained in:
Vadim Petrochenkov 2025-03-30 00:39:55 +03:00
parent d4812c8638
commit 2dfd2a2a24
47 changed files with 72 additions and 236 deletions

View file

@ -1,8 +0,0 @@
error: fatal error triggered by #[rustc_error]
--> $DIR/bound-lifetime-constrained.rs:48:1
|
LL | fn main() { }
| ^^^^^^^^^
error: aborting due to 1 previous error

View file

@ -1,7 +1,7 @@
//@ revisions: func object clause ok
//@[ok] check-pass
#![allow(dead_code)]
#![feature(rustc_attrs)]
trait Foo<'a> {
type Item;
@ -44,5 +44,4 @@ fn clause2<T>() where T: for<'a> Fn() -> <() as Foo<'a>>::Item {
//[clause]~^ ERROR `Output` references lifetime `'a`
}
#[rustc_error]
fn main() { } //[ok]~ ERROR fatal error triggered by #[rustc_error]
fn main() { }

View file

@ -1,8 +0,0 @@
error: fatal error triggered by #[rustc_error]
--> $DIR/bound-lifetime-in-binding-only.rs:71:1
|
LL | fn main() { }
| ^^^^^^^^^
error: aborting due to 1 previous error

View file

@ -1,7 +1,7 @@
//@ revisions: angle paren ok elision
//@[ok] check-pass
#![allow(dead_code)]
#![feature(rustc_attrs)]
#![feature(unboxed_closures)]
trait Foo {
@ -67,5 +67,4 @@ fn ok2<T: for<'a,'b> Fn<(&'b Parameterized<'a>,), Output=&'a i32>>() {
fn ok3<T>() where for<'a> Parameterized<'a>: Foo<Item=&'a i32> {
}
#[rustc_error]
fn main() { } //[ok]~ ERROR fatal error triggered by #[rustc_error]
fn main() { }

View file

@ -1,8 +0,0 @@
error: fatal error triggered by #[rustc_error]
--> $DIR/bound-lifetime-in-return-only.rs:49:1
|
LL | fn main() { }
| ^^^^^^^^^
error: aborting due to 1 previous error

View file

@ -1,7 +1,7 @@
//@ revisions: sig local structure ok elision
//@[ok] check-pass
#![allow(dead_code)]
#![feature(rustc_attrs)]
#![feature(unboxed_closures)]
trait Foo {
@ -45,5 +45,4 @@ fn ok1(_: &dyn for<'a> Fn(&Parameterized<'a>) -> &'a i32) {
fn ok2(_: &dyn for<'a,'b> Fn<(&'b Parameterized<'a>,), Output=&'a i32>) {
}
#[rustc_error]
fn main() { } //[ok]~ ERROR fatal error triggered by #[rustc_error]
fn main() { }

View file

@ -1,6 +1,5 @@
#![feature(rustc_attrs)]
#![allow(dead_code)]
fn main() { #![rustc_error] // rust-lang/rust#49855
fn main() {
// Original borrow ends at end of function
let mut x = 1;
let y = &mut x;

View file

@ -1,5 +1,5 @@
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-report-with-custom-diagnostic.rs:8:13
--> $DIR/borrowck-report-with-custom-diagnostic.rs:7:13
|
LL | let y = &mut x;
| ------ mutable borrow occurs here
@ -11,7 +11,7 @@ LL | y.use_mut();
| - mutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-report-with-custom-diagnostic.rs:21:21
--> $DIR/borrowck-report-with-custom-diagnostic.rs:20:21
|
LL | let y = &x;
| -- immutable borrow occurs here
@ -23,7 +23,7 @@ LL | y.use_ref();
| - immutable borrow later used here
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-report-with-custom-diagnostic.rs:36:17
--> $DIR/borrowck-report-with-custom-diagnostic.rs:35:17
|
LL | let y = &mut x;
| ------ first mutable borrow occurs here

View file

@ -1,6 +1,6 @@
// ensure borrowck messages are correct outside special case
#![feature(rustc_attrs)]
fn main() { #![rustc_error] // rust-lang/rust#49855
fn main() {
let mut void = ();
let first = &mut void;

View file

@ -1,5 +1,4 @@
#![feature(rustc_attrs)]
fn main() { #![rustc_error] // rust-lang/rust#49855
fn main() {
let mut x = "foo";
let y = &mut x;
let z = &mut x; //~ ERROR cannot borrow

View file

@ -1,5 +1,5 @@
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/issue-11715.rs:5:13
--> $DIR/issue-11715.rs:4:13
|
LL | let y = &mut x;
| ------ first mutable borrow occurs here

View file

@ -2,8 +2,8 @@
//@ edition:2018
//@ revisions: with_feature without_feature
//@[with_feature] check-pass
#![feature(rustc_attrs)]
#![cfg_attr(with_feature, feature(const_async_blocks))]
use std::future::Future;
@ -15,5 +15,4 @@ const _: i32 = { core::mem::ManuallyDrop::new(async { 0 }); 4 };
static _FUT: &(dyn Future<Output = ()> + Sync) = &async {};
//[without_feature]~^ `async` block
#[rustc_error]
fn main() {} //[with_feature]~ fatal error triggered by #[rustc_error]
fn main() {}

View file

@ -1,8 +0,0 @@
error: fatal error triggered by #[rustc_error]
--> $DIR/async-block.rs:19:1
|
LL | fn main() {}
| ^^^^^^^^^
error: aborting due to 1 previous error

View file

@ -13,14 +13,16 @@
//! - Original impl PR: <https://github.com/rust-lang/rust/pull/21248>.
//! - RFC 507 "Release channels":
//! <https://github.com/rust-lang/rfcs/blob/c017755b9bfa0421570d92ba38082302e0f3ad4f/text/0507-release-channels.md>.
#![feature(rustc_attrs)]
//@ revisions: without_flag with_flag
//@ check-pass
//@ compile-flags: -Zunleash-the-miri-inside-of-you
//@[with_flag] compile-flags: -Awarnings
//@ check-pass
fn non_constant() {}
const fn constant() { non_constant() }
#[rustc_error(warn)]
fn main() {}
//[without_flag]~^ WARN unexpected annotation used with `#[rustc_error(...)]`!
//[without_flag]~? WARN skipping const checks

View file

@ -1,8 +1,10 @@
warning: unexpected annotation used with `#[rustc_error(...)]`!
--> $DIR/allow-non-lint-warnings.rs:25:1
warning: skipping const checks
|
LL | fn main() {}
| ^^^^^^^^^
help: skipping check that does not even have a feature gate
--> $DIR/allow-non-lint-warnings.rs:24:23
|
LL | const fn constant() { non_constant() }
| ^^^^^^^^^^^^^^
warning: 1 warning emitted

View file

@ -1,7 +1,6 @@
// Test that `#[rustc_*]` attributes are gated by `rustc_attrs` feature gate.
#[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable
#[rustc_error] //~ ERROR the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable
#[rustc_nonnull_optimization_guaranteed] //~ ERROR the `#[rustc_nonnull_optimization_guaranteed]` attribute is just used to document guaranteed niche optimizations in libcore and libstd and will never be stable
fn main() {}

View file

@ -7,18 +7,9 @@ LL | #[rustc_variance]
= help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable
--> $DIR/feature-gate-rustc-attrs-1.rs:4:1
|
LL | #[rustc_error]
| ^^^^^^^^^^^^^^
|
= help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the `#[rustc_nonnull_optimization_guaranteed]` attribute is just used to document guaranteed niche optimizations in libcore and libstd and will never be stable
(note that the compiler does not even check whether the type indeed is being non-null-optimized; it is your responsibility to ensure that the attribute is only used on types that are optimized)
--> $DIR/feature-gate-rustc-attrs-1.rs:5:1
--> $DIR/feature-gate-rustc-attrs-1.rs:4:1
|
LL | #[rustc_nonnull_optimization_guaranteed]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -26,6 +17,6 @@ LL | #[rustc_nonnull_optimization_guaranteed]
= help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 3 previous errors
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.

View file

@ -1,6 +1,7 @@
//@ check-pass
//@ compile-flags: -Z mir-opt-level=3
#![feature(type_alias_impl_trait, rustc_attrs)]
#![feature(type_alias_impl_trait)]
use std::marker::PhantomData;
@ -43,8 +44,6 @@ impl<T: MyFrom<Phantom2<DummyT<U>>>, U> MyIndex<Phantom1<T>> for Scope<U> {
}
}
#[rustc_error]
fn main() {
//~^ ERROR
let _pos: Phantom1<DummyT<()>> = Scope::new().my_index();
}

View file

@ -1,8 +0,0 @@
error: fatal error triggered by #[rustc_error]
--> $DIR/issue-75053.rs:47:1
|
LL | fn main() {
| ^^^^^^^^^
error: aborting due to 1 previous error

View file

@ -1,10 +1,9 @@
//@ check-pass
//@ proc-macro: test-macros.rs
#![feature(rustc_attrs)]
#![warn(unused_extern_crates)]
extern crate test_macros;
//~^ WARN unused extern crate
#[rustc_error]
fn main() {} //~ ERROR fatal error triggered by #[rustc_error]
fn main() {}

View file

@ -10,11 +10,5 @@ note: the lint level is defined here
LL | #![warn(unused_extern_crates)]
| ^^^^^^^^^^^^^^^^^^^^
error: fatal error triggered by #[rustc_error]
--> $DIR/no-macro-use-attr.rs:10:1
|
LL | fn main() {}
| ^^^^^^^^^
error: aborting due to 1 previous error; 1 warning emitted
warning: 1 warning emitted

View file

@ -1,5 +1,5 @@
error[E0658]: use of unstable library feature `structural_match`
--> $DIR/feature-gate.rs:29:6
--> $DIR/feature-gate.rs:27:6
|
LL | impl std::marker::StructuralPartialEq for Foo { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -3,11 +3,10 @@
// used in a match.
//@ revisions: with_gate no_gate
//@[with_gate] check-pass
// gate-test-structural_match
#![allow(unused)]
#![feature(rustc_attrs)]
#![cfg_attr(with_gate, feature(structural_match))]
@ -17,8 +16,7 @@ struct Foo {
const FOO: Foo = Foo { x: 0 };
#[rustc_error]
fn main() { //[with_gate]~ ERROR fatal error triggered by #[rustc_error]
fn main() {
let y = Foo { x: 1 };
match y {
FOO => { }

View file

@ -1,8 +0,0 @@
error: fatal error triggered by #[rustc_error]
--> $DIR/feature-gate.rs:21:1
|
LL | fn main() {
| ^^^^^^^^^
error: aborting due to 1 previous error

View file

@ -1,6 +0,0 @@
#![feature(rustc_attrs)]
#[rustc_error]
fn main() {
//~^ ERROR fatal error triggered by #[rustc_error]
}

View file

@ -1,8 +0,0 @@
error: fatal error triggered by #[rustc_error]
--> $DIR/rustc-error.rs:4:1
|
LL | fn main() {
| ^^^^^^^^^
error: aborting due to 1 previous error

View file

@ -1,6 +1,6 @@
// Test range syntax - borrow errors.
#![feature(rustc_attrs)]
pub fn main() { #![rustc_error] // rust-lang/rust#49855
pub fn main() {
let r = {
let a = 42;
let b = 42;

View file

@ -1,7 +1,6 @@
#![feature(rustc_attrs)]
use std::ops::FnMut;
fn main() { #![rustc_error] // rust-lang/rust#49855
fn main() {
let mut f;
{
let c = 1;

View file

@ -1,5 +1,5 @@
error[E0597]: `c` does not live long enough
--> $DIR/regionck-unboxed-closure-lifetimes.rs:8:21
--> $DIR/regionck-unboxed-closure-lifetimes.rs:7:21
|
LL | let c = 1;
| - binding `c` declared here

View file

@ -4,8 +4,8 @@ fn foo() {}
#[tests] //~ ERROR cannot find attribute `tests` in this scope
fn bar() {}
#[rustc_err]
//~^ ERROR cannot find attribute `rustc_err` in this scope
#[rustc_dumm]
//~^ ERROR cannot find attribute `rustc_dumm` in this scope
//~| ERROR attributes starting with `rustc` are reserved for use by the `rustc` compiler
fn main() {}

View file

@ -1,14 +1,14 @@
error: attributes starting with `rustc` are reserved for use by the `rustc` compiler
--> $DIR/attribute-typos.rs:7:3
|
LL | #[rustc_err]
| ^^^^^^^^^
LL | #[rustc_dumm]
| ^^^^^^^^^^
error: cannot find attribute `rustc_err` in this scope
error: cannot find attribute `rustc_dumm` in this scope
--> $DIR/attribute-typos.rs:7:3
|
LL | #[rustc_err]
| ^^^^^^^^^ help: a built-in attribute with a similar name exists: `rustc_error`
LL | #[rustc_dumm]
| ^^^^^^^^^^ help: a built-in attribute with a similar name exists: `rustc_dummy`
error: cannot find attribute `tests` in this scope
--> $DIR/attribute-typos.rs:4:3

View file

@ -1,8 +0,0 @@
error: fatal error triggered by #[rustc_error]
--> $DIR/feature-gate.rs:22:1
|
LL | fn main() {}
| ^^^^^^^^^
error: aborting due to 1 previous error

View file

@ -1,8 +1,8 @@
//@ revisions: stock gated
//@[gated] check-pass
// gate-test-const_trait_impl
#![cfg_attr(gated, feature(const_trait_impl))]
#![feature(rustc_attrs)]
struct S;
#[const_trait] //[stock]~ ERROR `const_trait` is a temporary placeholder
@ -18,5 +18,4 @@ macro_rules! discard { ($ty:ty) => {} }
discard! { impl ~const T } //[stock]~ ERROR const trait impls are experimental
discard! { impl const T } //[stock]~ ERROR const trait impls are experimental
#[rustc_error]
fn main() {} //[gated]~ ERROR fatal error triggered by #[rustc_error]
fn main() {}

View file

@ -8,5 +8,5 @@
#![feature(rustc_attrs)]
#[rustc_error(delayed_bug_from_inside_query)]
#[rustc_delayed_bug_from_inside_query]
fn main() {}

View file

@ -1,4 +1,4 @@
error: internal compiler error: delayed bug triggered by #[rustc_error(delayed_bug_from_inside_query)]
error: internal compiler error: delayed bug triggered by #[rustc_delayed_bug_from_inside_query]
--> $DIR/span_delayed_bug.rs:12:1
|
LL | fn main() {}

View file

@ -1,4 +1,5 @@
#![feature(rustc_attrs)]
//@ check-pass
#![feature(type_alias_impl_trait)]
pub type Foo = impl Fn() -> usize;
@ -8,5 +9,4 @@ pub const fn bar() -> Foo {
}
const BAZR: Foo = bar();
#[rustc_error]
fn main() {} //~ ERROR
fn main() {}

View file

@ -1,8 +0,0 @@
error: fatal error triggered by #[rustc_error]
--> $DIR/issue-53096.rs:12:1
|
LL | fn main() {}
| ^^^^^^^^^
error: aborting due to 1 previous error

View file

@ -1,4 +1,6 @@
#![feature(type_alias_impl_trait, rustc_attrs)]
//@ check-pass
#![feature(type_alias_impl_trait)]
pub type Debuggable = impl core::fmt::Debug;
@ -9,8 +11,6 @@ pub fn foo() -> Debuggable {
static mut TEST: Option<Debuggable> = None;
#[rustc_error]
fn main() {
//~^ ERROR
unsafe { TEST = Some(foo()) }
}

View file

@ -1,8 +0,0 @@
error: fatal error triggered by #[rustc_error]
--> $DIR/issue-60407.rs:13:1
|
LL | fn main() {
| ^^^^^^^^^
error: aborting due to 1 previous error