Skip to content

Commit

Permalink
Cleanup feature gates.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Feb 17, 2022
1 parent ebf467d commit 5ff235b
Show file tree
Hide file tree
Showing 111 changed files with 236 additions and 272 deletions.
10 changes: 5 additions & 5 deletions compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,11 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
tcx.ensure().check_mod_const_bodies(module);
});
},
{
sess.time("unused_lib_feature_checking", || {
rustc_passes::stability::check_unused_or_stable_features(tcx)
});
},
{
// We force these querie to run,
// since they might not otherwise get called.
Expand Down Expand Up @@ -1002,11 +1007,6 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
tcx.hir()
.par_for_each_module(|module| tcx.ensure().check_mod_deathness(module));
},
{
sess.time("unused_lib_feature_checking", || {
rustc_passes::stability::check_unused_or_stable_features(tcx)
});
},
{
sess.time("lint_checking", || {
rustc_lint::check_crate(tcx, || {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// compile-flags:-C panic=abort

#![feature(alloc_error_handler, panic_handler)]
#![feature(alloc_error_handler)]
#![no_std]
#![no_main]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// compile-flags:-C panic=abort

#![feature(alloc_error_handler, panic_handler)]
#![feature(alloc_error_handler)]
#![no_std]
#![no_main]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// compile-flags:-C panic=abort

#![feature(alloc_error_handler, panic_handler)]
#![feature(alloc_error_handler)]
#![no_std]
#![no_main]

Expand Down
1 change: 0 additions & 1 deletion src/test/ui/asm/naked-functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// ignore-wasm32

#![feature(naked_functions)]
#![feature(or_patterns)]
#![feature(asm_const, asm_sym, asm_unwind)]
#![crate_type = "lib"]

Expand Down
64 changes: 32 additions & 32 deletions src/test/ui/asm/naked-functions.stderr
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
error: asm with the `pure` option must have at least one output
--> $DIR/naked-functions.rs:111:14
--> $DIR/naked-functions.rs:110:14
|
LL | asm!("", options(readonly, nostack), options(pure));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^

error: patterns not allowed in naked function parameters
--> $DIR/naked-functions.rs:21:5
--> $DIR/naked-functions.rs:20:5
|
LL | mut a: u32,
| ^^^^^

error: patterns not allowed in naked function parameters
--> $DIR/naked-functions.rs:23:5
--> $DIR/naked-functions.rs:22:5
|
LL | &b: &i32,
| ^^

error: patterns not allowed in naked function parameters
--> $DIR/naked-functions.rs:25:6
--> $DIR/naked-functions.rs:24:6
|
LL | (None | Some(_)): Option<std::ptr::NonNull<u8>>,
| ^^^^^^^^^^^^^^

error: patterns not allowed in naked function parameters
--> $DIR/naked-functions.rs:27:5
--> $DIR/naked-functions.rs:26:5
|
LL | P { x, y }: P,
| ^^^^^^^^^^

error: referencing function parameters is not allowed in naked functions
--> $DIR/naked-functions.rs:36:5
--> $DIR/naked-functions.rs:35:5
|
LL | a + 1
| ^
|
= help: follow the calling convention in asm block to use parameters

error[E0787]: naked functions must contain a single asm block
--> $DIR/naked-functions.rs:34:1
--> $DIR/naked-functions.rs:33:1
|
LL | / pub unsafe extern "C" fn inc(a: u32) -> u32 {
LL | |
Expand All @@ -48,21 +48,21 @@ LL | | }
| |_^

error: referencing function parameters is not allowed in naked functions
--> $DIR/naked-functions.rs:42:31
--> $DIR/naked-functions.rs:41:31
|
LL | asm!("/* {0} */", in(reg) a, options(noreturn));
| ^
|
= help: follow the calling convention in asm block to use parameters

error[E0787]: only `const` and `sym` operands are supported in naked functions
--> $DIR/naked-functions.rs:42:23
--> $DIR/naked-functions.rs:41:23
|
LL | asm!("/* {0} */", in(reg) a, options(noreturn));
| ^^^^^^^^^

error[E0787]: naked functions must contain a single asm block
--> $DIR/naked-functions.rs:48:1
--> $DIR/naked-functions.rs:47:1
|
LL | / pub unsafe extern "C" fn inc_closure(a: u32) -> u32 {
LL | |
Expand All @@ -72,7 +72,7 @@ LL | | }
| |_^

error[E0787]: only `const` and `sym` operands are supported in naked functions
--> $DIR/naked-functions.rs:65:10
--> $DIR/naked-functions.rs:64:10
|
LL | in(reg) a,
| ^^^^^^^^^
Expand All @@ -87,7 +87,7 @@ LL | out(reg) e,
| ^^^^^^^^^^

error[E0787]: asm in naked functions must use `noreturn` option
--> $DIR/naked-functions.rs:63:5
--> $DIR/naked-functions.rs:62:5
|
LL | / asm!("/* {0} {1} {2} {3} {4} {5} {6} */",
LL | |
Expand All @@ -99,7 +99,7 @@ LL | | );
| |_____^

error[E0787]: naked functions must contain a single asm block
--> $DIR/naked-functions.rs:54:1
--> $DIR/naked-functions.rs:53:1
|
LL | / pub unsafe extern "C" fn unsupported_operands() {
LL | |
Expand All @@ -119,33 +119,33 @@ LL | | }
| |_^

error[E0787]: naked functions must contain a single asm block
--> $DIR/naked-functions.rs:77:1
--> $DIR/naked-functions.rs:76:1
|
LL | / pub extern "C" fn missing_assembly() {
LL | |
LL | | }
| |_^

error[E0787]: asm in naked functions must use `noreturn` option
--> $DIR/naked-functions.rs:84:5
--> $DIR/naked-functions.rs:83:5
|
LL | asm!("");
| ^^^^^^^^

error[E0787]: asm in naked functions must use `noreturn` option
--> $DIR/naked-functions.rs:86:5
--> $DIR/naked-functions.rs:85:5
|
LL | asm!("");
| ^^^^^^^^

error[E0787]: asm in naked functions must use `noreturn` option
--> $DIR/naked-functions.rs:88:5
--> $DIR/naked-functions.rs:87:5
|
LL | asm!("");
| ^^^^^^^^

error[E0787]: naked functions must contain a single asm block
--> $DIR/naked-functions.rs:82:1
--> $DIR/naked-functions.rs:81:1
|
LL | / pub extern "C" fn too_many_asm_blocks() {
LL | |
Expand All @@ -163,15 +163,15 @@ LL | | }
| |_^

error: referencing function parameters is not allowed in naked functions
--> $DIR/naked-functions.rs:97:11
--> $DIR/naked-functions.rs:96:11
|
LL | *&y
| ^
|
= help: follow the calling convention in asm block to use parameters

error[E0787]: naked functions must contain a single asm block
--> $DIR/naked-functions.rs:95:5
--> $DIR/naked-functions.rs:94:5
|
LL | / pub extern "C" fn inner(y: usize) -> usize {
LL | |
Expand All @@ -182,75 +182,75 @@ LL | | }
| |_____^

error[E0787]: asm options unsupported in naked functions: `nomem`, `preserves_flags`
--> $DIR/naked-functions.rs:105:5
--> $DIR/naked-functions.rs:104:5
|
LL | asm!("", options(nomem, preserves_flags, noreturn));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0787]: asm options unsupported in naked functions: `nostack`, `pure`, `readonly`
--> $DIR/naked-functions.rs:111:5
--> $DIR/naked-functions.rs:110:5
|
LL | asm!("", options(readonly, nostack), options(pure));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0787]: asm in naked functions must use `noreturn` option
--> $DIR/naked-functions.rs:111:5
--> $DIR/naked-functions.rs:110:5
|
LL | asm!("", options(readonly, nostack), options(pure));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0787]: asm options unsupported in naked functions: `may_unwind`
--> $DIR/naked-functions.rs:119:5
--> $DIR/naked-functions.rs:118:5
|
LL | asm!("", options(noreturn, may_unwind));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: Rust ABI is unsupported in naked functions
--> $DIR/naked-functions.rs:124:15
--> $DIR/naked-functions.rs:123:15
|
LL | pub unsafe fn default_abi() {
| ^^^^^^^^^^^
|
= note: `#[warn(undefined_naked_function_abi)]` on by default

warning: Rust ABI is unsupported in naked functions
--> $DIR/naked-functions.rs:130:15
--> $DIR/naked-functions.rs:129:15
|
LL | pub unsafe fn rust_abi() {
| ^^^^^^^^

error: naked functions cannot be inlined
--> $DIR/naked-functions.rs:170:1
--> $DIR/naked-functions.rs:169:1
|
LL | #[inline]
| ^^^^^^^^^

error: naked functions cannot be inlined
--> $DIR/naked-functions.rs:177:1
--> $DIR/naked-functions.rs:176:1
|
LL | #[inline(always)]
| ^^^^^^^^^^^^^^^^^

error: naked functions cannot be inlined
--> $DIR/naked-functions.rs:184:1
--> $DIR/naked-functions.rs:183:1
|
LL | #[inline(never)]
| ^^^^^^^^^^^^^^^^

error: naked functions cannot be inlined
--> $DIR/naked-functions.rs:191:1
--> $DIR/naked-functions.rs:190:1
|
LL | #[inline]
| ^^^^^^^^^

error: naked functions cannot be inlined
--> $DIR/naked-functions.rs:193:1
--> $DIR/naked-functions.rs:192:1
|
LL | #[inline(always)]
| ^^^^^^^^^^^^^^^^^

error: naked functions cannot be inlined
--> $DIR/naked-functions.rs:195:1
--> $DIR/naked-functions.rs:194:1
|
LL | #[inline(never)]
| ^^^^^^^^^^^^^^^^
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/associated-consts/associated-const-in-trait.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// #29924

#![feature(associated_consts)]

trait Trait {
const N: usize;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/associated-const-in-trait.rs:9:6
--> $DIR/associated-const-in-trait.rs:7:6
|
LL | impl dyn Trait {
| ^^^^^^^^^ `Trait` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/associated-const-in-trait.rs:6:11
--> $DIR/associated-const-in-trait.rs:4:11
|
LL | trait Trait {
| ----- this trait cannot be made into an object...
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/async-await/try-on-option-in-async.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(try_trait, async_closure)]
#![feature(async_closure)]
// edition:2018
fn main() {}

Expand Down
3 changes: 3 additions & 0 deletions src/test/ui/attributes/const-stability-on-macro.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#![feature(staged_api)]
#![stable(feature = "rust1", since = "1.0.0")]

#[rustc_const_stable(feature = "foo", since = "0")]
//~^ ERROR macros cannot have const stability attributes
macro_rules! foo {
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/attributes/const-stability-on-macro.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: macros cannot have const stability attributes
--> $DIR/const-stability-on-macro.rs:1:1
--> $DIR/const-stability-on-macro.rs:4:1
|
LL | #[rustc_const_stable(feature = "foo", since = "0")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid const stability attribute
Expand All @@ -8,7 +8,7 @@ LL | macro_rules! foo {
| ---------------- const stability attribute affects this macro

error: macros cannot have const stability attributes
--> $DIR/const-stability-on-macro.rs:7:1
--> $DIR/const-stability-on-macro.rs:10:1
|
LL | #[rustc_const_unstable(feature = "bar", issue="none")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid const stability attribute
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/attributes/extented-attribute-macro-error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// normalize-stderr-test: "couldn't read.*" -> "couldn't read the file"

#![feature(extended_key_value_attributes)]
#![doc = include_str!("../not_existing_file.md")]
struct Documented {}
//~^^ ERROR couldn't read
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: couldn't read the file
--> $DIR/extented-attribute-macro-error.rs:4:10
--> $DIR/extented-attribute-macro-error.rs:3:10
|
LL | #![doc = include_str!("../not_existing_file.md")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/const-generics/issues/issue-82956.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(generic_const_exprs, array_map)]
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]

pub struct ConstCheck<const CHECK: bool>;
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/consts/const-array-oob-arith.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(const_indexing)]

const ARR: [i32; 6] = [42, 43, 44, 45, 46, 47];
const IDX: usize = 3;
const VAL: i32 = ARR[IDX];
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/consts/const-array-oob-arith.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error[E0308]: mismatched types
--> $DIR/const-array-oob-arith.rs:7:45
--> $DIR/const-array-oob-arith.rs:5:45
|
LL | const BLUB: [i32; (ARR[0] - 40) as usize] = [5];
| ^^^ expected an array with a fixed size of 2 elements, found one with 1 element

error[E0308]: mismatched types
--> $DIR/const-array-oob-arith.rs:10:44
--> $DIR/const-array-oob-arith.rs:8:44
|
LL | const BOO: [i32; (ARR[0] - 41) as usize] = [5, 99];
| ^^^^^^^ expected an array with a fixed size of 1 element, found one with 2 elements
Expand Down
Loading

0 comments on commit 5ff235b

Please sign in to comment.