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

Comments

Projects
None yet
4 participants
@nikomatsakis
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 added a commit to nikomatsakis/rust that referenced this issue Oct 14, 2016

nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Oct 14, 2016

nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Oct 19, 2016

nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Oct 21, 2016

nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Nov 1, 2016

keeperofdakeys added a commit to keeperofdakeys/rust that referenced this issue Nov 5, 2016

keeperofdakeys added a commit to keeperofdakeys/rust that referenced this issue Nov 6, 2016

@nagisa

This comment has been minimized.

Show comment
Hide comment
@nagisa

nagisa Jan 19, 2017

Contributor

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.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@nikomatsakis

nikomatsakis Jan 19, 2017

Contributor

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

Contributor

nikomatsakis commented Jan 19, 2017

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

alexcrichton added a commit to alexcrichton/rust that referenced this issue Jan 19, 2017

Rollup merge of #39195 - nagisa:deny-extra-requirement-in-impl, r=eddyb
Deny extra_requirement_in_impl forward-compat lint

Part of #37166

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

Rollup merge of #39195 - nagisa:deny-extra-requirement-in-impl, r=eddyb
Deny extra_requirement_in_impl forward-compat lint

Part of #37166
@Mark-Simulacrum

This comment has been minimized.

Show comment
Hide comment
@Mark-Simulacrum

Mark-Simulacrum May 13, 2017

Member

This appears unrelated to metadata, untagging.

Member

Mark-Simulacrum commented May 13, 2017

This appears unrelated to metadata, untagging.

@nikomatsakis

This comment has been minimized.

Show comment
Hide comment
@nikomatsakis

nikomatsakis Nov 1, 2017

Contributor

@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. =)

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@rfcbot

rfcbot 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 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.

nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Nov 1, 2017

nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Nov 1, 2017

nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Nov 3, 2017

nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Nov 7, 2017

Nashenas88 added 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

This comment has been minimized.

Show comment
Hide comment
@rfcbot

rfcbot Feb 16, 2018

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

rfcbot commented Feb 16, 2018

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

@rfcbot

This comment has been minimized.

Show comment
Hide comment
@rfcbot

rfcbot Feb 16, 2018

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

rfcbot commented Feb 16, 2018

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

@rfcbot

This comment has been minimized.

Show comment
Hide comment
@rfcbot

rfcbot Feb 26, 2018

The final comment period is now complete.

rfcbot commented Feb 26, 2018

The final comment period is now complete.

@nikomatsakis

This comment has been minimized.

Show comment
Hide comment
@nikomatsakis

nikomatsakis Feb 27, 2018

Contributor

It seems like this got done a long time ago.

Contributor

nikomatsakis commented Feb 27, 2018

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