3

Change `bindings_with_variant_name` to deny-by-default by timrobertsdev · Pull R...

 1 year ago
source link: https://github.com/rust-lang/rust/pull/104154
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Conversation

Changed the bindings_with_variant_name lint to deny-by-default and fixed up the affected tests.

Addresses #103442.

scottmcm and joshtriplett reacted with heart emoji

Collaborator

rustbot commented Nov 8, 2022

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @lcnr (or someone else) soon.

Please see the contribution instructions for more information.

rustbot

added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

labels

Nov 8, 2022

Contributor

fmease commented Nov 8, 2022

Not sure if I should comment on the issue or here on the PR. In any case, we can't just turn this into a deny-by-default lint without breaking Rust's backward compatibility guarantees, right? This should probably only ever happen in a new edition (e.g. starting from edition 2024) or after marking it as future-incompat and waiting for an extensive period of time. A crater run wouldn't be out of place either, I'd wager.

Contributor

lcnr commented Nov 8, 2022

Crater silently ignores lints from dependencies and having deny by default lints impact the root should be fine, as that's something the user can easily change themselves. Afaik upgrading a lint to deny is therefore generally not considered breaking.

I encountered this lint multiple times myself and iirc I never wanted to continue compilation in these cases as this lint always detected a bug.

I think this requires compiler signoff?

@rfcbot fcp merge

fmease reacted with thumbs up emoji

rfcbot commented Nov 8, 2022

edited by pnkfelix

Team member @lcnr has proposed to merge this. The next step is review by the rest of the tagged team members:

Concerns:

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

rfcbot

added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it.

labels

Nov 8, 2022

Contributor

estebank commented Nov 8, 2022

@rfcbot concern proc-macros
How does this lint in particular interact with evaluated proc macros? I could see a weird situation where a clash occurs intentionally on the part of the macro author, but will the link either not trigger at all or only trigger on the macro's users' code?

Author

timrobertsdev commented Nov 8, 2022

@estebank
I'm not sure what you had in mind, but I put together this (very) short macro to see:

use proc_macro::TokenStream;
use quote::quote;

#[proc_macro_attribute]
pub fn foo(_input: TokenStream, _attributes: TokenStream) -> TokenStream {
    quote! {
        pub enum Foo {
            Bar,
            Baz,
        }

        pub fn bar(foo: Foo) {
            match foo {
                Bar => {},
                Baz => {},
            }
        }
    }.into()
}

Used as:

use macro_crate::foo;
#[foo]
pub struct Dummy;

Results in no errors being reported when checked or built.

estebank reacted with thumbs up emoji

Contributor

estebank commented Nov 9, 2022

@rfcbot resolve proc-macros

scottmcm reacted with heart emoji

Member

scottmcm commented Nov 27, 2022

+100. I'm a big fan of this -- warning lints for general smells, but when there are specific situations that we know are essentially always mistakes, they ought to be deny-only.

(FYI @rust-lang/lang that this is happening.)

Contributor

workingjubilee commented Nov 27, 2022

I agree that while technically valid Rust, it is absolutely improbable that anyone should want code that is formed like this to compile. Like "there's over 2 million Rust programmers and I expect less than 5 would want this to work, and they have already found out how to #![allow(nonstandard_style)]".

inquisitivecrystal

added relnotes Marks issues that should be documented in the release notes of the next release. needs-fcp This change is insta-stable, so needs a completed FCP to proceed.

labels

Nov 30, 2022

rfcbot

added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised.

and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.

labels

Dec 15, 2022

rfcbot commented Dec 15, 2022

bellThis is now entering its final comment period, as per the review above. bell

Contributor

bors commented Dec 18, 2022

umbrella The latest upstream changes (presumably #104417) made this pull request unmergeable. Please resolve the merge conflicts.

timrobertsdev

force-pushed the deny-by-default-bindings_with_variant_name

branch from 4627742 to 0d64d95 Compare

Dec 20, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

lcnr

Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. needs-fcp This change is insta-stable, so needs a completed FCP to proceed. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects

None yet

Milestone

No milestone

10 participants

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK