mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-21 11:23:03 +00:00
Move the lint for the stability lints to the method name only
Closes #17337.
This commit is contained in:
parent
f56c67ba86
commit
a667a6917b
@ -1492,6 +1492,8 @@ impl LintPass for Stability {
|
||||
});
|
||||
if skip { return; }
|
||||
|
||||
let mut span = e.span;
|
||||
|
||||
let id = match e.node {
|
||||
ast::ExprPath(..) | ast::ExprStruct(..) => {
|
||||
match cx.tcx.def_map.borrow().find(&e.id) {
|
||||
@ -1499,7 +1501,8 @@ impl LintPass for Stability {
|
||||
None => return
|
||||
}
|
||||
}
|
||||
ast::ExprMethodCall(..) => {
|
||||
ast::ExprMethodCall(i, _, _) => {
|
||||
span = i.span;
|
||||
let method_call = typeck::MethodCall::expr(e.id);
|
||||
match cx.tcx.method_map.borrow().find(&method_call) {
|
||||
Some(method) => {
|
||||
@ -1556,7 +1559,7 @@ impl LintPass for Stability {
|
||||
_ => format!("use of {} item", label)
|
||||
};
|
||||
|
||||
cx.span_lint(lint, e.span, msg.as_slice());
|
||||
cx.span_lint(lint, span, msg.as_slice());
|
||||
}
|
||||
}
|
||||
|
||||
|
23
src/test/compile-fail/issue-17337.rs
Normal file
23
src/test/compile-fail/issue-17337.rs
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(deprecated)]
|
||||
|
||||
struct Foo;
|
||||
|
||||
impl Foo {
|
||||
#[deprecated]
|
||||
fn foo(self) {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
Foo
|
||||
.foo(); //~ ERROR use of deprecated item
|
||||
}
|
Loading…
Reference in New Issue
Block a user