diff options
| -rw-r--r-- | tests/ui/allow-non-lint-warnings.rs | 8 | ||||
| -rw-r--r-- | tests/ui/diagnostic-flags/allow-non-lint-warnings.rs | 27 | ||||
| -rw-r--r-- | tests/ui/diagnostic-flags/allow-non-lint-warnings.without_flag.stderr | 8 |
3 files changed, 35 insertions, 8 deletions
diff --git a/tests/ui/allow-non-lint-warnings.rs b/tests/ui/allow-non-lint-warnings.rs deleted file mode 100644 index f8f5a78ebff..00000000000 --- a/tests/ui/allow-non-lint-warnings.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ compile-flags: -Awarnings -//@ check-pass - -#[derive()] -#[derive(Copy, Clone)] -pub struct Foo; - -pub fn main() {} diff --git a/tests/ui/diagnostic-flags/allow-non-lint-warnings.rs b/tests/ui/diagnostic-flags/allow-non-lint-warnings.rs new file mode 100644 index 00000000000..40b9e6536f5 --- /dev/null +++ b/tests/ui/diagnostic-flags/allow-non-lint-warnings.rs @@ -0,0 +1,27 @@ +// ignore-tidy-linelength +//! Check that `-A warnings` cli flag applies to non-lint warnings as well. +//! +//! This test tries to exercise that by checking that the "relaxing a default bound only does +//! something for `?Sized`; all other traits are not bound by default" non-lint warning (normally +//! warn-by-default) is suppressed if the `-A warnings` cli flag is passed. +//! +//! Take special note that `warnings` is a special pseudo lint group in relationship to non-lint +//! warnings, which is somewhat special. This test does not exercise other `-A <other_lint_group>` +//! that check that they are working in the same way, only `warnings` specifically. +//! +//! # Relevant context +//! +//! - 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>. +#![crate_type = "lib"] + +//@ revisions: without_flag with_flag + +//@[with_flag] compile-flags: -Awarnings + +//@ check-pass + +pub trait Trait {} +pub fn f<T: ?Trait>() {} +//[without_flag]~^ WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default diff --git a/tests/ui/diagnostic-flags/allow-non-lint-warnings.without_flag.stderr b/tests/ui/diagnostic-flags/allow-non-lint-warnings.without_flag.stderr new file mode 100644 index 00000000000..b037847c70f --- /dev/null +++ b/tests/ui/diagnostic-flags/allow-non-lint-warnings.without_flag.stderr @@ -0,0 +1,8 @@ +warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default + --> $DIR/allow-non-lint-warnings.rs:26:13 + | +LL | pub fn f<T: ?Trait>() {} + | ^^^^^^ + +warning: 1 warning emitted + |
