diff options
Diffstat (limited to 'compiler/rustc_lint/src')
| -rw-r--r-- | compiler/rustc_lint/src/builtin.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/context.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/early.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/expect.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/levels.rs | 22 |
5 files changed, 17 insertions, 14 deletions
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 045ff38c056..8afb5f2d32e 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -1728,7 +1728,7 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns { None => format!("&(..={end})"), }; if join.edition() >= Edition::Edition2021 { - cx.sess().emit_err(BuiltinEllipsisInclusiveRangePatterns { + cx.sess().dcx().emit_err(BuiltinEllipsisInclusiveRangePatterns { span: pat.span, suggestion: pat.span, replace, @@ -1746,7 +1746,7 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns { } else { let replace = "..="; if join.edition() >= Edition::Edition2021 { - cx.sess().emit_err(BuiltinEllipsisInclusiveRangePatterns { + cx.sess().dcx().emit_err(BuiltinEllipsisInclusiveRangePatterns { span: pat.span, suggestion: join, replace: replace.to_string(), diff --git a/compiler/rustc_lint/src/context.rs b/compiler/rustc_lint/src/context.rs index c7a9d5e80ac..40b70ba4e04 100644 --- a/compiler/rustc_lint/src/context.rs +++ b/compiler/rustc_lint/src/context.rs @@ -1056,6 +1056,7 @@ pub trait LintContext { // a dummy diagnostic and emit is as usual, which will be suppressed and stored like a normal // expected lint diagnostic. self.sess() + .dcx() .struct_expect( "this is a dummy diagnostic, to submit and store an expectation", expectation, diff --git a/compiler/rustc_lint/src/early.rs b/compiler/rustc_lint/src/early.rs index b9add9e9f06..70af6572246 100644 --- a/compiler/rustc_lint/src/early.rs +++ b/compiler/rustc_lint/src/early.rs @@ -426,7 +426,7 @@ pub fn check_ast_node_inner<'a, T: EarlyLintPass>( // that was not lint-checked (perhaps it doesn't exist?). This is a bug. for (id, lints) in cx.context.buffered.map { for early_lint in lints { - sess.span_delayed_bug( + sess.dcx().span_delayed_bug( early_lint.span, format!( "failed to process buffered lint here (dummy = {})", diff --git a/compiler/rustc_lint/src/expect.rs b/compiler/rustc_lint/src/expect.rs index 5dcc1bce5ff..2b6290e8a00 100644 --- a/compiler/rustc_lint/src/expect.rs +++ b/compiler/rustc_lint/src/expect.rs @@ -16,7 +16,7 @@ fn check_expectations(tcx: TyCtxt<'_>, tool_filter: Option<Symbol>) { } let lint_expectations = tcx.lint_expectations(()); - let fulfilled_expectations = tcx.sess.dcx().steal_fulfilled_expectation_ids(); + let fulfilled_expectations = tcx.dcx().steal_fulfilled_expectation_ids(); tracing::debug!(?lint_expectations, ?fulfilled_expectations); diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index 6eff2bfe13c..17c56f1ca58 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -144,7 +144,7 @@ fn lint_expectations(tcx: TyCtxt<'_>, (): ()) -> Vec<(LintExpectationId, LintExp builder.add_id(hir::CRATE_HIR_ID); tcx.hir().walk_toplevel_module(&mut builder); - tcx.sess.dcx().update_unstable_expectation_id(&builder.provider.unstable_to_stable_ids); + tcx.dcx().update_unstable_expectation_id(&builder.provider.unstable_to_stable_ids); builder.provider.expectations } @@ -562,7 +562,9 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { if lint_name_only == crate::WARNINGS.name_lower() && matches!(level, Level::ForceWarn(_)) { - self.sess.emit_err(UnsupportedGroup { lint_group: crate::WARNINGS.name_lower() }); + self.sess + .dcx() + .emit_err(UnsupportedGroup { lint_group: crate::WARNINGS.name_lower() }); } match self.store.check_lint_name(lint_name_only, tool_name, self.registered_tools) { CheckLintNameResult::Renamed(ref replace) => { @@ -593,7 +595,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { self.emit_lint(RENAMED_AND_REMOVED_LINTS, lint); } CheckLintNameResult::NoTool => { - self.sess.emit_err(CheckNameUnknownTool { + self.sess.dcx().emit_err(CheckNameUnknownTool { tool_name: tool_name.unwrap(), sub: RequestedLevel { level, lint_name }, }); @@ -671,7 +673,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { LintLevelSource::CommandLine(_, _) => OverruledAttributeSub::CommandLineSource, }; if !fcw_warning { - self.sess.emit_err(OverruledAttribute { + self.sess.dcx().emit_err(OverruledAttribute { span: src.span(), overruled: src.span(), lint_level: level.as_str(), @@ -792,7 +794,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { } reason = Some(rationale); } else { - sess.emit_err(MalformedAttribute { + sess.dcx().emit_err(MalformedAttribute { span: name_value.span, sub: MalformedAttributeSub::ReasonMustBeStringLiteral( name_value.span, @@ -802,14 +804,14 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { // found reason, reslice meta list to exclude it metas.pop().unwrap(); } else { - sess.emit_err(MalformedAttribute { + sess.dcx().emit_err(MalformedAttribute { span: item.span, sub: MalformedAttributeSub::BadAttributeArgument(item.span), }); } } ast::MetaItemKind::List(_) => { - sess.emit_err(MalformedAttribute { + sess.dcx().emit_err(MalformedAttribute { span: item.span, sub: MalformedAttributeSub::BadAttributeArgument(item.span), }); @@ -833,7 +835,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { if let Some(item) = li.meta_item() { if let ast::MetaItemKind::NameValue(_) = item.kind { if item.path == sym::reason { - sess.emit_err(MalformedAttribute { + sess.dcx().emit_err(MalformedAttribute { span: sp, sub: MalformedAttributeSub::ReasonMustComeLast(sp), }); @@ -841,7 +843,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { } } } - sess.emit_err(MalformedAttribute { + sess.dcx().emit_err(MalformedAttribute { span: sp, sub: MalformedAttributeSub::BadAttributeArgument(sp), }); @@ -957,7 +959,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { } &CheckLintNameResult::NoTool => { - sess.emit_err(UnknownToolInScopedLint { + sess.dcx().emit_err(UnknownToolInScopedLint { span: tool_ident.map(|ident| ident.span), tool_name: tool_name.unwrap(), lint_name: pprust::path_to_string(&meta_item.path), |
