Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

extra_requirement_in_impl future-compatibility warning #37166

Closed
nikomatsakis opened this issue Oct 14, 2016 · 9 comments
Closed

extra_requirement_in_impl future-compatibility warning #37166

nikomatsakis opened this issue Oct 14, 2016 · 9 comments
Labels
B-unstable Blocker: Implemented in the nightly compiler and unstable. C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. metabug Issues about issues themselves ("bugs about bugs") T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804

Comments

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Oct 14, 2016

This is the summary issue for the extra_requirement_in_impl future-compatibility warning and other related errors. The goal of this page is describe why this change was made and how you can fix code that is affected by it. It also provides a place to ask questions or register a complaint if you feel the change should not be made. For more information on the policy around future-compatibility warnings, see our breaking change policy guidelines.

What is the warning for?

There has been a longstanding bug in rustc (#18937) that sometimes allowed an impl
to place additional requirements on its methods above and beyond the requirements
that appear in the trait definition. For example:

trait Trait {
    fn foo<F>(&mut self, f: F)
        where F: Clone;
}

impl Trait for i32 {
    fn foo<F>(&mut self, f: F)
        where F: Clone + 'static
    {   //               ^^^^^^^ additional requirement
    }
}

This is unsound and can permit crashes and other arbitrary behavior.
The solution is usually to move the requirement into the trait definition:

trait Trait {
    fn foo<F>(&mut self, f: F)
        where F: Clone + 'static;
}

or else remove the requirement from the impl.

When will this warning become a hard error?

At the beginning of each 6-week release cycle, the Rust compiler team will review the set of outstanding future compatibility warnings and nominate some of them for Final Comment Period. Toward the end of the cycle, we will review any comments and make a final determination whether to convert the warning into a hard error or remove it entirely.

@nikomatsakis nikomatsakis added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. B-unstable Blocker: Implemented in the nightly compiler and unstable. I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness A-metadata Area: Crate metadata metabug Issues about issues themselves ("bugs about bugs") and removed I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness labels Oct 14, 2016
nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Nov 1, 2016
@nagisa
Copy link
Member

nagisa commented Jan 19, 2017

There’s a desire to make this either a “lint-error” or “non-lint-warning” (can’t be disabled) for 1.16 and hard error for 1.17.

@nikomatsakis
Copy link
Contributor Author

Discussed in compiler-team meeting and decided to move this to deny-by-default.

nagisa added a commit to nagisa/rust that referenced this issue Jan 19, 2017
J-F-Liu added a commit to J-F-Liu/pom that referenced this issue Jan 20, 2017
alexcrichton added a commit to alexcrichton/rust that referenced this issue Jan 20, 2017
…pl, r=eddyb

Deny extra_requirement_in_impl forward-compat lint

Part of rust-lang#37166
@Mark-Simulacrum
Copy link
Member

This appears unrelated to metadata, untagging.

@Mark-Simulacrum Mark-Simulacrum removed the A-metadata Area: Crate metadata label May 13, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC label Jul 22, 2017
@nikomatsakis
Copy link
Contributor Author

nikomatsakis commented Nov 1, 2017

@rfcbot fcp close

It has been over a year since these future-compatibility warnings were issued. I move that we make this a HARD ERROR. This is a serious bug with real soundness implications and is currently set to error (deny) by default. Also, the backwards compatibility code happens to be getting in my way right now. =)

@rfcbot
Copy link

rfcbot commented Nov 1, 2017

Team member @nikomatsakis has proposed to close this. The next step is review by the rest of the tagged teams:

No concerns currently listed.

Once a majority of reviewers approve (and none object), 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 rfcbot added the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Nov 1, 2017
nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Nov 7, 2017
Nashenas88 pushed a commit to Nashenas88/rust that referenced this issue Nov 10, 2017
nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Nov 10, 2017
nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Nov 12, 2017
nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Nov 16, 2017
@rfcbot 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 Feb 16, 2018
@rfcbot
Copy link

rfcbot commented Feb 16, 2018

🔔 This is now entering its final comment period, as per the review above. 🔔

1 similar comment
@rfcbot
Copy link

rfcbot commented Feb 16, 2018

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot added the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Feb 16, 2018
@rfcbot
Copy link

rfcbot commented Feb 26, 2018

The final comment period is now complete.

@nikomatsakis nikomatsakis added WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804 E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. labels Feb 27, 2018
@nikomatsakis
Copy link
Contributor Author

It seems like this got done a long time ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-unstable Blocker: Implemented in the nightly compiler and unstable. C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. metabug Issues about issues themselves ("bugs about bugs") T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804
Projects
None yet
Development

No branches or pull requests

4 participants