Skip to content

Commit

Permalink
Add a compatibility clause for UFCS method calls
Browse files Browse the repository at this point in the history
  • Loading branch information
sfackler committed Oct 13, 2014
1 parent cb7becf commit 08984a6
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions active/0000-enum-namespacing.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,32 @@ This should not affect much if any code in practice, as Rust's naming
conventions state that variants should be capitalized and method names should
not.

## With other post-1.0 work

Part of the UFCS work will (or at least discussed) allowing this:
```
trait Foo {
fn Baz();
}
enum Bar {
Baz,
}
impl Foo for Bar {
fn Baz() {}
}
fn main() {
Bar::Baz(); // instead of Foo::<for Bar>::Baz()
}
```
If this is implemented before namespaced enums, we must add a restriction,
similar to the one for intrinsic methods, that prohibits something like
`Foo::Baz` from being called as in the above example. Note that the trait may
be implemented for `Bar` without any problems, and the method may be called via
the long form. It's just `Bar::Baz()` that must be disallowed.

## Later

The compiler's resolve stage will be altered in two ways. It will place an
Expand Down

0 comments on commit 08984a6

Please sign in to comment.