Skip to content

Commit b5c7a55

Browse files
committed
Adjust allow-non-lint-warnings.rs
- Document `allow-non-lint-warnings.rs` - Move `allow-non-lint-warnings.rs` under `tests/ui/diagnostic-flags/` - Improve the test to use two *differential* revisions: 1. One revision checks that without `-A warnings` the code sample actually emits a warning. 2. The other revision checks that `-A warnings` suppresses the warning. This makes sure that if the code sample no longer warns, the test doesn't silently pass but fail to check its intended purpose.
1 parent dd3b313 commit b5c7a55

File tree

3 files changed

+35
-8
lines changed

3 files changed

+35
-8
lines changed

Diff for: tests/ui/allow-non-lint-warnings.rs

-8
This file was deleted.

Diff for: tests/ui/diagnostic-flags/allow-non-lint-warnings.rs

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// ignore-tidy-linelength
2+
//! Check that `-A warnings` cli flag applies to non-lint warnings as well.
3+
//!
4+
//! This test tries to exercise that by checking that the "relaxing a default bound only does
5+
//! something for `?Sized`; all other traits are not bound by default" non-lint warning (normally
6+
//! warn-by-default) is suppressed if the `-A warnings` cli flag is passed.
7+
//!
8+
//! Take special note that `warnings` is a special pseudo lint group in relationship to non-lint
9+
//! warnings, which is somewhat special. This test does not exercise other `-A <other_lint_group>`
10+
//! that check that they are working in the same way, only `warnings` specifically.
11+
//!
12+
//! # Relevant context
13+
//!
14+
//! - Original impl PR: <https://github.com/rust-lang/rust/pull/21248>.
15+
//! - RFC 507 "Release channels":
16+
//! <https://github.com/rust-lang/rfcs/blob/c017755b9bfa0421570d92ba38082302e0f3ad4f/text/0507-release-channels.md>.
17+
#![crate_type = "lib"]
18+
19+
//@ revisions: without_flag with_flag
20+
21+
//@[with_flag] compile-flags: -Awarnings
22+
23+
//@ check-pass
24+
25+
pub trait Trait {}
26+
pub fn f<T: ?Trait>() {}
27+
//[without_flag]~^ WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
2+
--> $DIR/allow-non-lint-warnings.rs:26:13
3+
|
4+
LL | pub fn f<T: ?Trait>() {}
5+
| ^^^^^^
6+
7+
warning: 1 warning emitted
8+

0 commit comments

Comments
 (0)