Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/librustc/middle/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,13 @@ impl<'v> Visitor<'v> for Annotator {
b: &'v Block, s: Span, _: NodeId) {
match fk {
FkMethod(_, _, meth) => {
self.annotate(meth.id, &meth.attrs, |v| visit::walk_fn(v, fk, fd, b, s));
// Methods are not already annotated, so we annotate it
self.annotate(meth.id, &meth.attrs, |_| {});
}
_ => visit::walk_fn(self, fk, fd, b, s)
_ => {}
}
// Items defined in a function body have no reason to have
// a stability attribute, so we don't recurse.
}

fn visit_trait_item(&mut self, t: &TraitItem) {
Expand Down
14 changes: 14 additions & 0 deletions src/test/compile-fail/lint-stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,20 @@ mod this_crate {
foo.trait_stable();
}

#[deprecated]
fn test_fn_body() {
fn fn_in_body() {}
fn_in_body();
}

impl MethodTester {
#[deprecated]
fn test_method_body(&self) {
fn fn_in_body() {}
fn_in_body();
}
}

#[deprecated]
pub trait DeprecatedTrait {}

Expand Down