auto merge of #9336 : alexcrichton/rust/issue-7981, r=catamorphism
Progress on #7981 This doesn't completely close the issue because `struct A;` is still allowed, and it's a much larger change to disallow that. I'm also not entirely sure that we want to disallow that. Regardless, punting that discussion to the issue instead.
This commit is contained in:
commit
a7d68adbdd
24 changed files with 36 additions and 35 deletions
|
|
@ -65,6 +65,7 @@ pub enum ObsoleteSyntax {
|
|||
ObsoletePrivVisibility,
|
||||
ObsoleteTraitFuncVisibility,
|
||||
ObsoleteConstPointer,
|
||||
ObsoleteEmptyImpl,
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for ObsoleteSyntax {
|
||||
|
|
@ -256,6 +257,10 @@ impl ParserObsoleteMethods for Parser {
|
|||
"instead of `&const Foo` or `@const Foo`, write `&Foo` or \
|
||||
`@Foo`"
|
||||
),
|
||||
ObsoleteEmptyImpl => (
|
||||
"empty implementation",
|
||||
"instead of `impl A;`, write `impl A {}`"
|
||||
),
|
||||
};
|
||||
|
||||
self.report(sp, kind, kind_str, desc);
|
||||
|
|
|
|||
|
|
@ -3852,7 +3852,9 @@ impl Parser {
|
|||
}
|
||||
|
||||
let mut meths = ~[];
|
||||
if !self.eat(&token::SEMI) {
|
||||
if self.eat(&token::SEMI) {
|
||||
self.obsolete(*self.span, ObsoleteEmptyImpl);
|
||||
} else {
|
||||
self.expect(&token::LBRACE);
|
||||
while !self.eat(&token::RBRACE) {
|
||||
meths.push(self.parse_method());
|
||||
|
|
|
|||
|
|
@ -598,18 +598,12 @@ pub fn print_item(s: @ps, item: &ast::item) {
|
|||
|
||||
print_type(s, ty);
|
||||
|
||||
if methods.len() == 0 {
|
||||
word(s.s, ";");
|
||||
end(s); // end the head-ibox
|
||||
end(s); // end the outer cbox
|
||||
} else {
|
||||
space(s.s);
|
||||
bopen(s);
|
||||
for meth in methods.iter() {
|
||||
print_method(s, *meth);
|
||||
}
|
||||
bclose(s, item.span);
|
||||
space(s.s);
|
||||
bopen(s);
|
||||
for meth in methods.iter() {
|
||||
print_method(s, *meth);
|
||||
}
|
||||
bclose(s, item.span);
|
||||
}
|
||||
ast::item_trait(ref generics, ref traits, ref methods) => {
|
||||
head(s, visibility_qualified(item.vis, "trait"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue