1
Fork 0

librustc: Stop assuming that implementations and traits only contain

methods.

This paves the way to associated items by introducing an extra level of
abstraction ("impl-or-trait item") between traits/implementations and
methods. This new abstraction is encoded in the metadata and used
throughout the compiler where appropriate.

There are no functional changes; this is purely a refactoring.
This commit is contained in:
Patrick Walton 2014-08-04 13:56:56 -07:00
parent 404978ea72
commit 9907fa4acc
49 changed files with 1909 additions and 1103 deletions

View file

@ -154,7 +154,7 @@ pub struct Static {
pub struct Trait {
pub name: Ident,
pub methods: Vec<ast::TraitMethod>, //should be TraitMethod
pub items: Vec<ast::TraitItem>, //should be TraitItem
pub generics: ast::Generics,
pub parents: Vec<ast::TraitRef>,
pub attrs: Vec<ast::Attribute>,
@ -168,7 +168,7 @@ pub struct Impl {
pub generics: ast::Generics,
pub trait_: Option<ast::TraitRef>,
pub for_: ast::P<ast::Ty>,
pub methods: Vec<Gc<ast::Method>>,
pub items: Vec<ast::ImplItem>,
pub attrs: Vec<ast::Attribute>,
pub where: Span,
pub vis: ast::Visibility,