Skip to content

Commit

Permalink
Auto merge of #82639 - jyn514:stable-options, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Don't pass -Z unstable-options by default for UI tests

Unconditionally passing -Z unstable-options makes it impossible to test whether an option requires unstable-options or not.

This uncovered quite a lot of bugs, I'll open issues for each. These don't strictly need to be fixed before this is merged, it just makes the diff much larger because of the changes to diagnostics.

- #82636
- #82637
- #82638
  • Loading branch information
bors committed Jun 10, 2021
2 parents 0279cb1 + 1cdc81b commit 40c1623
Show file tree
Hide file tree
Showing 67 changed files with 86 additions and 817 deletions.
1 change: 0 additions & 1 deletion src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,6 @@ note: if you're sure you want to do this, please open an issue as to why. In the
}
}
flags.push(format!("-Cdebuginfo={}", builder.config.rust_debuginfo_level_tests));
flags.push("-Zunstable-options".to_string());
flags.push(builder.config.cmd.rustc_args().join(" "));

if let Some(linker) = builder.linker(target) {
Expand Down
4 changes: 2 additions & 2 deletions src/test/rustdoc-ui/run-directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

// revisions: correct incorrect
// check-pass
// [correct]compile-flags:--test --test-run-directory={{src-base}}
// [incorrect]compile-flags:--test --test-run-directory={{src-base}}/coverage
// [correct]compile-flags:--test --test-run-directory={{src-base}} -Zunstable-options
// [incorrect]compile-flags:--test --test-run-directory={{src-base}}/coverage -Zunstable-options
// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"

Expand Down
1 change: 1 addition & 0 deletions src/test/ui-fulldeps/internal-lints/pass_ty_by_ref_self.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// compile-flags: -Z unstable-options
// NOTE: This test doesn't actually require `fulldeps`
// so we could instead use it as an `ui` test.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
error: passing `TyCtxt<'tcx>` by reference
--> $DIR/pass_ty_by_ref_self.rs:17:15
--> $DIR/pass_ty_by_ref_self.rs:18:15
|
LL | fn by_ref(&self) {}
| ^^^^^ help: try passing by value: `TyCtxt<'tcx>`
|
note: the lint level is defined here
--> $DIR/pass_ty_by_ref_self.rs:7:9
--> $DIR/pass_ty_by_ref_self.rs:8:9
|
LL | #![deny(rustc::ty_pass_by_reference)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: passing `Ty<'tcx>` by reference
--> $DIR/pass_ty_by_ref_self.rs:30:21
--> $DIR/pass_ty_by_ref_self.rs:31:21
|
LL | fn by_ref(self: &Ty<'tcx>) {}
| ^^^^^^^^^ help: try passing by value: `Ty<'tcx>`
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/annotate-snippet/missing-type.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// compile-flags: --error-format human-annotate-rs
// compile-flags: --error-format human-annotate-rs -Z unstable-options

pub fn main() {
let x: Iter; //~ ERROR cannot find type `Iter` in this scope
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/annotate-snippet/multispan.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// aux-build:multispan.rs
// compile-flags: --error-format human-annotate-rs
// compile-flags: --error-format human-annotate-rs -Z unstable-options

#![feature(proc_macro_hygiene)]

Expand Down
8 changes: 1 addition & 7 deletions src/test/ui/deduplicate-diagnostics.duplicate.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ error[E0452]: malformed lint attribute input
LL | #[deny("literal")]
| ^^^^^^^^^ bad attribute argument

error[E0452]: malformed lint attribute input
--> $DIR/deduplicate-diagnostics.rs:8:8
|
LL | #[deny("literal")]
| ^^^^^^^^^ bad attribute argument

error: aborting due to 5 previous errors
error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0452`.
1 change: 0 additions & 1 deletion src/test/ui/deduplicate-diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ struct S;

#[deny("literal")] //~ ERROR malformed lint attribute input
//[duplicate]~| ERROR malformed lint attribute input
//[duplicate]~| ERROR malformed lint attribute input
fn main() {}
2 changes: 0 additions & 2 deletions src/test/ui/error-codes/E0452.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
//~| ERROR E0452
//~| ERROR E0452
//~| ERROR E0452
//~| ERROR E0452
//~| ERROR E0452
fn main() {
}
14 changes: 1 addition & 13 deletions src/test/ui/error-codes/E0452.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@ error[E0452]: malformed lint attribute input
LL | #![allow(foo = "")]
| ^^^^^^^^ bad attribute argument

error[E0452]: malformed lint attribute input
--> $DIR/E0452.rs:1:10
|
LL | #![allow(foo = "")]
| ^^^^^^^^ bad attribute argument

error[E0452]: malformed lint attribute input
--> $DIR/E0452.rs:1:10
|
LL | #![allow(foo = "")]
| ^^^^^^^^ bad attribute argument

error: aborting due to 6 previous errors
error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0452`.
1 change: 0 additions & 1 deletion src/test/ui/error-codes/E0453.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
#[allow(non_snake_case)]
//~^ ERROR allow(non_snake_case) incompatible
//~| ERROR allow(non_snake_case) incompatible
//~| ERROR allow(non_snake_case) incompatible
fn main() {
}
11 changes: 1 addition & 10 deletions src/test/ui/error-codes/E0453.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@ LL |
LL | #[allow(non_snake_case)]
| ^^^^^^^^^^^^^^ overruled by previous forbid

error[E0453]: allow(non_snake_case) incompatible with previous forbid
--> $DIR/E0453.rs:3:9
|
LL | #![forbid(non_snake_case)]
| -------------- `forbid` level set here
LL |
LL | #[allow(non_snake_case)]
| ^^^^^^^^^^^^^^ overruled by previous forbid

error: aborting due to 3 previous errors
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0453`.
6 changes: 1 addition & 5 deletions src/test/ui/error-codes/E0602.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ error[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`

error[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`

error: aborting due to 3 previous errors
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0602`.
1 change: 0 additions & 1 deletion src/test/ui/feature-gates/feature-gate-lint-reasons.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![warn(nonstandard_style, reason = "the standard should be respected")]
//~^ ERROR lint reasons are experimental
//~| ERROR lint reasons are experimental
//~| ERROR lint reasons are experimental

fn main() {}
11 changes: 1 addition & 10 deletions src/test/ui/feature-gates/feature-gate-lint-reasons.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@ LL | #![warn(nonstandard_style, reason = "the standard should be respected")]
= note: see issue #54503 <https://github.com/rust-lang/rust/issues/54503> for more information
= help: add `#![feature(lint_reasons)]` to the crate attributes to enable

error[E0658]: lint reasons are experimental
--> $DIR/feature-gate-lint-reasons.rs:1:28
|
LL | #![warn(nonstandard_style, reason = "the standard should be respected")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #54503 <https://github.com/rust-lang/rust/issues/54503> for more information
= help: add `#![feature(lint_reasons)]` to the crate attributes to enable

error: aborting due to 3 previous errors
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.
3 changes: 0 additions & 3 deletions src/test/ui/lint/crate_level_only_lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@ mod foo {
#![allow(uncommon_codepoints)]
//~^ ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes]
//~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes]
//~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes]

#[allow(uncommon_codepoints)]
//~^ ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes]
//~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes]
//~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes]
const BAR: f64 = 0.000001;

}

#[allow(uncommon_codepoints)]
//~^ ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes]
//~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes]
//~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes]
fn main() {
}
28 changes: 5 additions & 23 deletions src/test/ui/lint/crate_level_only_lint.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ LL | #![deny(uncommon_codepoints, unused_attributes)]
| ^^^^^^^^^^^^^^^^^

error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:9:9
--> $DIR/crate_level_only_lint.rs:8:9
|
LL | #[allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^

error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:17:9
--> $DIR/crate_level_only_lint.rs:15:9
|
LL | #[allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^
Expand All @@ -29,34 +29,16 @@ LL | #![allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^

error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:9:9
--> $DIR/crate_level_only_lint.rs:8:9
|
LL | #[allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^

error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:17:9
--> $DIR/crate_level_only_lint.rs:15:9
|
LL | #[allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^

error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:4:10
|
LL | #![allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^

error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:9:9
|
LL | #[allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^

error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:17:9
|
LL | #[allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^

error: aborting due to 9 previous errors
error: aborting due to 6 previous errors

6 changes: 0 additions & 6 deletions src/test/ui/lint/forbid-group-group-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,4 @@
//~| WARNING previously accepted by the compiler
//~| ERROR incompatible with previous
//~| WARNING previously accepted by the compiler
//~| ERROR incompatible with previous
//~| WARNING previously accepted by the compiler
//~| ERROR incompatible with previous
//~| WARNING previously accepted by the compiler
//~| ERROR incompatible with previous
//~| WARNING previously accepted by the compiler
fn main() {}
38 changes: 1 addition & 37 deletions src/test/ui/lint/forbid-group-group-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -75,41 +75,5 @@ LL | #[allow(nonstandard_style)]
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>

error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
|
LL | #![forbid(warnings)]
| -------- `forbid` level set here
...
LL | #[allow(nonstandard_style)]
| ^^^^^^^^^^^^^^^^^ overruled by previous forbid
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>

error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
|
LL | #![forbid(warnings)]
| -------- `forbid` level set here
...
LL | #[allow(nonstandard_style)]
| ^^^^^^^^^^^^^^^^^ overruled by previous forbid
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>

error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
|
LL | #![forbid(warnings)]
| -------- `forbid` level set here
...
LL | #[allow(nonstandard_style)]
| ^^^^^^^^^^^^^^^^^ overruled by previous forbid
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>

error: aborting due to 9 previous errors
error: aborting due to 6 previous errors

2 changes: 0 additions & 2 deletions src/test/ui/lint/forbid-group-member.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
//~| WARNING previously accepted
//~| WARNING incompatible with previous forbid
//~| WARNING previously accepted
//~| WARNING incompatible with previous forbid
//~| WARNING previously accepted
fn main() {
let a: ();
}
14 changes: 1 addition & 13 deletions src/test/ui/lint/forbid-group-member.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,5 @@ LL | #[allow(unused_variables)]
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>

warning: allow(unused_variables) incompatible with previous forbid
--> $DIR/forbid-group-member.rs:8:9
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL |
LL | #[allow(unused_variables)]
| ^^^^^^^^^^^^^^^^ overruled by previous forbid
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>

warning: 4 warnings emitted
warning: 3 warnings emitted

1 change: 0 additions & 1 deletion src/test/ui/lint/forbid-member-group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#[allow(unused)]
//~^ ERROR incompatible with previous forbid
//~| ERROR incompatible with previous forbid
//~| ERROR incompatible with previous forbid
fn main() {
let a: ();
}
11 changes: 1 addition & 10 deletions src/test/ui/lint/forbid-member-group.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@ LL |
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid

error[E0453]: allow(unused) incompatible with previous forbid
--> $DIR/forbid-member-group.rs:6:9
|
LL | #![forbid(unused_variables)]
| ---------------- `forbid` level set here
LL |
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid

error: aborting due to 3 previous errors
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0453`.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// compile-flags: --force-warns elided_lifetimes_in_paths
// compile-flags: --force-warns elided_lifetimes_in_paths -Zunstable-options
// check-pass

struct Foo<'a> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// compile-flags: --force-warns const_err
// compile-flags: --force-warns const_err -Zunstable-options
// check-pass

#![allow(const_err)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/lint/force-warn/force-allowed-warning.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// compile-flags: --force-warns dead_code
// compile-flags: --force-warns dead_code -Zunstable-options
// check-pass

#![allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/lint/force-warn/force-deny-by-default-lint.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// compile-flags: --force-warns const_err
// compile-flags: --force-warns const_err -Zunstable-options
// check-pass

const C: i32 = 1 / 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// compile-flags: --force-warns dead_code
// compile-flags: --force-warns dead_code -Zunstable-options
// check-pass

#![allow(warnings)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// compile-flags: --force-warns nonstandard_style
// compile-flags: --force-warns nonstandard_style -Zunstable-options
// check-pass

#![allow(warnings)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/lint/force-warn/force-lint-in-allowed-group.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// compile-flags: --force-warns bare_trait_objects
// compile-flags: --force-warns bare_trait_objects -Zunstable-options
// check-pass

#![allow(rust_2018_idioms)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// compile-flags: --force-warns rust_2018_idioms
// compile-flags: --force-warns rust_2018_idioms -Zunstable-options
// check-pass

#![allow(bare_trait_objects)]
Expand Down
Loading

0 comments on commit 40c1623

Please sign in to comment.