Skip to content

tidy complains about valid stability attribute #62846

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
RalfJung opened this issue Jul 21, 2019 · 4 comments
Closed

tidy complains about valid stability attribute #62846

RalfJung opened this issue Jul 21, 2019 · 4 comments
Labels
A-stability Area: `#[stable]`, `#[unstable]` etc. A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug.

Comments

@RalfJung
Copy link
Member

With the following stability attribute

    #[unstable(
        feature = "internal_uninit_const",
        issue = "0",
        reason = "hack to work around promotability",
    )]

tidy complained

tidy error: /checkout/src/libcore/mem/maybe_uninit.rs:256: malformed stability attribute: missing `feature` key

Seems like it's parser is a bit too simplified.

See #62799 (comment) for the CI failure and f3abbf7 for the work-around.

@jonas-schievink jonas-schievink added A-stability Area: `#[stable]`, `#[unstable]` etc. A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug. labels Jul 21, 2019
@varkor
Copy link
Member

varkor commented Jul 21, 2019

The parsing is very simplistic:

let level = if line.contains("[unstable(") {
Status::Unstable
} else if line.contains("[stable(") {
Status::Stable
} else {
continue;
};
let feature_name = match find_attr_val(line, "feature") {
Some(name) => name,
None => err!("malformed stability attribute: missing `feature` key"),
};

@RalfJung
Copy link
Member Author

Can't we just make rustc complain about malformed stable/unstable attributes? What is the reason why tidy has to check this?

@petrochenkov
Copy link
Contributor

@RalfJung
rustc already complains about missing features and other ill-formed stability attributes.
Tidy wants to collect those features to complain about something else, first of all (e.g. about a feature not having a dedicated test etc.).

@Mark-Simulacrum
Copy link
Member

I'm going to close this as won't fix. Expanding tidy into a full fledged parser is something I'd like to avoid as much as possible, and this seems like something that's fairly easy to work around. Maybe we could refile on rustc-guide or similar as a "here's a hint that this error might be buggy" and associate how to fix it, not sure.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-stability Area: `#[stable]`, `#[unstable]` etc. A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

5 participants