Rollup merge of #78999 - petrochenkov:deprid, r=eddyb
stability: More precise location for deprecation lint on macros One missing piece of https://github.com/rust-lang/rust/pull/73178.
This commit is contained in:
commit
92dcf6d733
@ -4,7 +4,7 @@
|
|||||||
pub use self::StabilityLevel::*;
|
pub use self::StabilityLevel::*;
|
||||||
|
|
||||||
use crate::ty::{self, TyCtxt};
|
use crate::ty::{self, TyCtxt};
|
||||||
use rustc_ast::CRATE_NODE_ID;
|
use rustc_ast::NodeId;
|
||||||
use rustc_attr::{self as attr, ConstStability, Deprecation, Stability};
|
use rustc_attr::{self as attr, ConstStability, Deprecation, Stability};
|
||||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||||
use rustc_errors::{Applicability, DiagnosticBuilder};
|
use rustc_errors::{Applicability, DiagnosticBuilder};
|
||||||
@ -211,13 +211,14 @@ pub fn early_report_deprecation(
|
|||||||
suggestion: Option<Symbol>,
|
suggestion: Option<Symbol>,
|
||||||
lint: &'static Lint,
|
lint: &'static Lint,
|
||||||
span: Span,
|
span: Span,
|
||||||
|
node_id: NodeId,
|
||||||
) {
|
) {
|
||||||
if span.in_derive_expansion() {
|
if span.in_derive_expansion() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let diag = BuiltinLintDiagnostics::DeprecatedMacro(suggestion, span);
|
let diag = BuiltinLintDiagnostics::DeprecatedMacro(suggestion, span);
|
||||||
lint_buffer.buffer_lint_with_diagnostic(lint, CRATE_NODE_ID, span, message, diag);
|
lint_buffer.buffer_lint_with_diagnostic(lint, node_id, span, message, diag);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn late_report_deprecation(
|
fn late_report_deprecation(
|
||||||
|
@ -1034,6 +1034,7 @@ impl<'a> Resolver<'a> {
|
|||||||
depr.suggestion,
|
depr.suggestion,
|
||||||
lint,
|
lint,
|
||||||
span,
|
span,
|
||||||
|
node_id,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,16 @@ mod benches {
|
|||||||
fn foo() {}
|
fn foo() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deprecated = "reason"]
|
||||||
|
macro_rules! deprecated {
|
||||||
|
() => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(deprecated)]
|
||||||
|
mod deprecated {
|
||||||
|
deprecated!(); // No warning
|
||||||
|
}
|
||||||
|
|
||||||
#[warn(incomplete_include)]
|
#[warn(incomplete_include)]
|
||||||
fn main() {
|
fn main() {
|
||||||
// WARN see in the stderr file, the warning points to the included file.
|
// WARN see in the stderr file, the warning points to the included file.
|
||||||
|
@ -33,7 +33,7 @@ LL | 2
|
|||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/expansion-time.rs:15:8
|
--> $DIR/expansion-time.rs:25:8
|
||||||
|
|
|
|
||||||
LL | #[warn(incomplete_include)]
|
LL | #[warn(incomplete_include)]
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
Loading…
x
Reference in New Issue
Block a user