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
5 changes: 3 additions & 2 deletions compiler/rustc_middle/src/middle/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
pub use self::StabilityLevel::*;

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_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_errors::{Applicability, DiagnosticBuilder};
Expand Down Expand Up @@ -211,13 +211,14 @@ pub fn early_report_deprecation(
suggestion: Option<Symbol>,
lint: &'static Lint,
span: Span,
node_id: NodeId,
) {
if span.in_derive_expansion() {
return;
}

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(
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_resolve/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,7 @@ impl<'a> Resolver<'a> {
depr.suggestion,
lint,
span,
node_id,
);
}
}
Expand Down
10 changes: 10 additions & 0 deletions src/test/ui/lint/expansion-time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ mod benches {
fn foo() {}
}

#[deprecated = "reason"]
macro_rules! deprecated {
() => {}
}

#[allow(deprecated)]
mod deprecated {
deprecated!(); // No warning
}

#[warn(incomplete_include)]
fn main() {
// WARN see in the stderr file, the warning points to the included file.
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/lint/expansion-time.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ LL | 2
| ^
|
note: the lint level is defined here
--> $DIR/expansion-time.rs:15:8
--> $DIR/expansion-time.rs:25:8
|
LL | #[warn(incomplete_include)]
| ^^^^^^^^^^^^^^^^^^
Expand Down