-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)C-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
I tried this code:
// main.rs
mod bar;
fn main() {
bar::foo();
}
// bar.rs
#![rustfmt::skip]
pub fn foo() { println!("unformatted") }
I expected to see this happen: No warnings and bar.rs
will not get formatted by cargo fmt
.
Instead, this happened: cargo build
emits a warning, bar.rs
is correctly not formatted by cargo fmt
.
warning: unused attribute
--> src/bar.rs:1:1
|
1 | #![rustfmt::skip]
| ^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_attributes)]` on by default
While trying to minimize I changed mod bar
to be an inline module, but that hits the unstable custom_inner_attributes
feature (#54726). So maybe rustfmt
shouldn't be obeying this attribute? Either way there's an inconsistency here with whether rustc
or rustfmt
believe the attribute is active or not.
Meta
rustc --version --verbose
:
rustc 1.50.0-nightly (0f6f2d681 2020-12-06)
binary: rustc
commit-hash: 0f6f2d681b39c5f95459cd09cb936b6ceb27cd82
commit-date: 2020-12-06
host: x86_64-unknown-linux-gnu
release: 1.50.0-nightly
Osrepnay
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)C-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.