Skip to content

Commit

Permalink
Rollup merge of #135406 - Aditya-PS-05:fix/unstable-lint-docs, r=comp…
Browse files Browse the repository at this point in the history
…iler-errors

Update unstable lint docs to include required feature attributes

closes #135298

## Summary
This PR updates the documentation examples for the following unstable lints to ensure they include the necessary feature attributes for proper usage:

- fuzzy_provenance_casts
- lossy_provenance_casts
- unqualified_local_imports
- test_unstable_lint

## Changes Made:

- Added the appropriate #![feature(...)] attributes to the example code for each lint.
- Updated the examples to produce correct and meaningful warnings, ensuring they align with current lint behavior.

Reference:
- Used the `must_not_suspend` lint documentation as a template for these updates.
  • Loading branch information
GuillaumeGomez authored Jan 12, 2025
2 parents 834f575 + 7ece88a commit d8e88c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_lint/src/unqualified_local_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ declare_lint! {
/// ### Example
///
/// ```rust,edition2018
/// #![feature(unqualified_local_imports)]
/// #![warn(unqualified_local_imports)]
///
/// mod localmod {
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2671,6 +2671,7 @@ declare_lint! {
/// ### Example
///
/// ```rust
/// #![feature(strict_provenance_lints)]
/// #![warn(fuzzy_provenance_casts)]
///
/// fn main() {
Expand Down Expand Up @@ -2714,6 +2715,7 @@ declare_lint! {
/// ### Example
///
/// ```rust
/// #![feature(strict_provenance_lints)]
/// #![warn(lossy_provenance_casts)]
///
/// fn main() {
Expand Down Expand Up @@ -4033,6 +4035,8 @@ declare_lint! {
/// ### Example
///
/// ```rust
/// // This lint is intentionally used to test the compiler's behavior
/// // when an unstable lint is enabled without the corresponding feature gate.
/// #![allow(test_unstable_lint)]
/// ```
///
Expand Down

0 comments on commit d8e88c9

Please sign in to comment.