Skip to content

#[no_override] for default methodsΒ #291

Open
@rust-highfive

Description

@rust-highfive

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-attributesProposals relating to attributesA-privacyPrivacy related proposals & ideasA-traitsTrait system related proposals & ideasA-typesystemType system related proposals & ideasT-langRelevant to the language team, which will review and decide on the RFC.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions