Skip to content

#[no_override] for default methods #291

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

Open
rust-highfive opened this issue Sep 24, 2014 · 0 comments
Open

#[no_override] for default methods #291

rust-highfive opened this issue Sep 24, 2014 · 0 comments
Labels
A-attributes Proposals relating to attributes A-privacy Privacy related proposals & ideas A-traits Trait system related proposals & ideas A-typesystem Type system related proposals & ideas T-lang Relevant to the language team, which will review and decide on the RFC.

Comments

@rust-highfive
Copy link

Issue by huonw
Monday Jul 08, 2013 at 14:16 GMT

For earlier discussion, see rust-lang/rust#7649

This issue was labelled with: A-attributes, B-RFC in the Rust repository


If there was a #[no_override] attribute that made it impossible to override a default method, there would be very little need for the FooUtil traits (with this attribute default methods would have almost exactly the same properties as *Util, except the seperate trait can be imported separately). i.e.

trait Foo {
  fn bar(&self);

  #[no_override]
  fn call_bar(&self) { self.bar(); }
}
impl Foo for int {
  fn bar(&self) {}

  fn call_bar(&self) {} // error!
}

This would provide a workaround for #5898 that is a proper solution in its own right.

@nrc nrc added the T-lang Relevant to the language team, which will review and decide on the RFC. label Aug 17, 2016
@Centril Centril added A-typesystem Type system related proposals & ideas A-privacy Privacy related proposals & ideas A-attributes Proposals relating to attributes A-traits Trait system related proposals & ideas labels Nov 26, 2018
wycats added a commit to wycats/rust-rfcs that referenced this issue Mar 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Proposals relating to attributes A-privacy Privacy related proposals & ideas A-traits Trait system related proposals & ideas A-typesystem Type system related proposals & ideas T-lang Relevant to the language team, which will review and decide on the RFC.
Projects
None yet
Development

No branches or pull requests

3 participants