Skip to content

Commit

Permalink
Rename buffer_lint_with_diagnostic to buffer_lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiretza committed May 20, 2024
1 parent 2d0277e commit 92749e6
Show file tree
Hide file tree
Showing 28 changed files with 57 additions and 57 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ impl<'a> AstValidator<'a> {
.span_to_snippet(span)
.is_ok_and(|snippet| !snippet.starts_with("#["))
{
self.lint_buffer.buffer_lint_with_diagnostic(
self.lint_buffer.buffer_lint(
MISSING_ABI,
id,
span,
Expand Down Expand Up @@ -1426,7 +1426,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
Self::check_decl_no_pat(&sig.decl, |span, ident, mut_ident| {
if mut_ident && matches!(ctxt, FnCtxt::Assoc(_)) {
if let Some(ident) = ident {
self.lint_buffer.buffer_lint_with_diagnostic(
self.lint_buffer.buffer_lint(
PATTERNS_IN_FNS_WITHOUT_BODY,
id,
span,
Expand Down Expand Up @@ -1506,7 +1506,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
Some((right, snippet))
}
};
self.lint_buffer.buffer_lint_with_diagnostic(
self.lint_buffer.buffer_lint(
DEPRECATED_WHERE_CLAUSE_LOCATION,
item.id,
err.span,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_attr/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ pub fn cfg_matches(
try_gate_cfg(cfg.name, cfg.span, sess, features);
match sess.psess.check_config.expecteds.get(&cfg.name) {
Some(ExpectedValues::Some(values)) if !values.contains(&cfg.value) => {
sess.psess.buffer_lint_with_diagnostic(
sess.psess.buffer_lint(
UNEXPECTED_CFGS,
cfg.span,
lint_node_id,
Expand All @@ -539,7 +539,7 @@ pub fn cfg_matches(
);
}
None if sess.psess.check_config.exhaustive_names => {
sess.psess.buffer_lint_with_diagnostic(
sess.psess.buffer_lint(
UNEXPECTED_CFGS,
cfg.span,
lint_node_id,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_builtin_macros/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,15 +510,15 @@ fn expand_preparsed_asm(
};

if template_str.contains(".intel_syntax") {
ecx.psess().buffer_lint_with_diagnostic(
ecx.psess().buffer_lint(
lint::builtin::BAD_ASM_STYLE,
find_span(".intel_syntax"),
ecx.current_expansion.lint_node_id,
BuiltinLintDiag::AvoidUsingIntelSyntax,
);
}
if template_str.contains(".att_syntax") {
ecx.psess().buffer_lint_with_diagnostic(
ecx.psess().buffer_lint(
lint::builtin::BAD_ASM_STYLE,
find_span(".att_syntax"),
ecx.current_expansion.lint_node_id,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1621,7 +1621,7 @@ impl<'a> TraitDef<'a> {
};

if let Some(ty) = exception {
cx.sess.psess.buffer_lint_with_diagnostic(
cx.sess.psess.buffer_lint(
BYTE_SLICE_IN_PACKED_STRUCT_WITH_DERIVE,
sp,
ast::CRATE_NODE_ID,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/source_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ pub(crate) fn expand_include<'cx>(
fn make_expr(mut self: Box<ExpandInclude<'a>>) -> Option<P<ast::Expr>> {
let expr = parse_expr(&mut self.p).ok()?;
if self.p.token != token::Eof {
self.p.psess.buffer_lint_with_diagnostic(
self.p.psess.buffer_lint(
INCOMPLETE_INCLUDE,
self.p.token.span,
self.node_id,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/test_harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ struct InnerItemLinter<'a> {
impl<'a> Visitor<'a> for InnerItemLinter<'_> {
fn visit_item(&mut self, i: &'a ast::Item) {
if let Some(attr) = attr::find_by_name(&i.attrs, sym::rustc_test_marker) {
self.sess.psess.buffer_lint_with_diagnostic(
self.sess.psess.buffer_lint(
UNNAMEABLE_TEST_ITEMS,
attr.span,
i.id,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub(crate) fn warn_on_duplicate_attribute(ecx: &ExtCtxt<'_>, item: &Annotatable,
};
if let Some(attrs) = attrs {
if let Some(attr) = attr::find_by_name(attrs, name) {
ecx.psess().buffer_lint_with_diagnostic(
ecx.psess().buffer_lint(
DUPLICATE_MACRO_ATTRIBUTES,
attr.span,
ecx.current_expansion.lint_node_id,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_expand/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,7 @@ fn pretty_printing_compatibility_hack(item: &Item, sess: &Session) -> bool {
};

if crate_matches {
sess.psess.buffer_lint_with_diagnostic(
sess.psess.buffer_lint(
PROC_MACRO_BACK_COMPAT,
item.ident.span,
ast::CRATE_NODE_ID,
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_expand/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ impl<'a> StripUnconfigured<'a> {

// Lint on zero attributes in source.
if expanded_attrs.is_empty() {
self.sess.psess.buffer_lint_with_diagnostic(
self.sess.psess.buffer_lint(
rustc_lint_defs::builtin::UNUSED_ATTRIBUTES,
attr.span,
ast::CRATE_NODE_ID,
Expand Down Expand Up @@ -341,15 +341,15 @@ impl<'a> StripUnconfigured<'a> {
item_span,
);
if attr.has_name(sym::crate_type) {
self.sess.psess.buffer_lint_with_diagnostic(
self.sess.psess.buffer_lint(
rustc_lint_defs::builtin::DEPRECATED_CFG_ATTR_CRATE_TYPE_NAME,
attr.span,
ast::CRATE_NODE_ID,
BuiltinLintDiag::CrateTypeInCfgAttr,
);
}
if attr.has_name(sym::crate_name) {
self.sess.psess.buffer_lint_with_diagnostic(
self.sess.psess.buffer_lint(
rustc_lint_defs::builtin::DEPRECATED_CFG_ATTR_CRATE_TYPE_NAME,
attr.span,
ast::CRATE_NODE_ID,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_expand/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
}

if attr.is_doc_comment() {
self.cx.sess.psess.buffer_lint_with_diagnostic(
self.cx.sess.psess.buffer_lint(
UNUSED_DOC_COMMENTS,
current_span,
self.cx.current_expansion.lint_node_id,
Expand All @@ -1810,7 +1810,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
// `#[cfg]` and `#[cfg_attr]` are special - they are
// eagerly evaluated.
if attr_name != sym::cfg && attr_name != sym::cfg_attr {
self.cx.sess.psess.buffer_lint_with_diagnostic(
self.cx.sess.psess.buffer_lint(
UNUSED_ATTRIBUTES,
attr.span,
self.cx.current_expansion.lint_node_id,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_expand/src/mbe/macro_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ fn check_binders(
// FIXME: Report this as a hard error eventually and remove equivalent errors from
// `parse_tt_inner` and `nameize`. Until then the error may be reported twice, once
// as a hard error and then once as a buffered lint.
psess.buffer_lint_with_diagnostic(
psess.buffer_lint(
MISSING_FRAGMENT_SPECIFIER,
span,
node_id,
Expand Down Expand Up @@ -646,6 +646,6 @@ fn ops_is_prefix(
fn buffer_lint(psess: &ParseSess, span: MultiSpan, node_id: NodeId, diag: BuiltinLintDiag) {
// Macros loaded from other crates have dummy node ids.
if node_id != DUMMY_NODE_ID {
psess.buffer_lint_with_diagnostic(META_VARIABLE_MISUSE, span, node_id, diag);
psess.buffer_lint(META_VARIABLE_MISUSE, span, node_id, diag);
}
}
4 changes: 2 additions & 2 deletions compiler/rustc_expand/src/mbe/macro_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl<'a> ParserAnyMacro<'a> {
// but `m!()` is allowed in expression positions (cf. issue #34706).
if kind == AstFragmentKind::Expr && parser.token == token::Semi {
if is_local {
parser.psess.buffer_lint_with_diagnostic(
parser.psess.buffer_lint(
SEMICOLON_IN_EXPRESSIONS_FROM_MACROS,
parser.token.span,
lint_node_id,
Expand Down Expand Up @@ -1150,7 +1150,7 @@ fn check_matcher_core<'tt>(
name,
Some(NonterminalKind::PatParam { inferred: false }),
));
sess.psess.buffer_lint_with_diagnostic(
sess.psess.buffer_lint(
RUST_2021_INCOMPATIBLE_OR_PATTERNS,
span,
ast::CRATE_NODE_ID,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_interface/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ pub(crate) fn check_attr_crate_type(
n,
None,
);
lint_buffer.buffer_lint_with_diagnostic(
lint_buffer.buffer_lint(
lint::builtin::UNKNOWN_CRATE_TYPES,
ast::CRATE_NODE_ID,
span,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint_defs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ impl LintBuffer {
self.map.swap_remove(&id).unwrap_or_default()
}

pub fn buffer_lint_with_diagnostic(
pub fn buffer_lint(
&mut self,
lint: &'static Lint,
id: NodeId,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_metadata/src/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
continue;
}

self.sess.psess.buffer_lint_with_diagnostic(
self.sess.psess.buffer_lint(
lint::builtin::UNUSED_CRATE_DEPENDENCIES,
span,
ast::CRATE_NODE_ID,
Expand Down Expand Up @@ -1015,7 +1015,7 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
// Make a point span rather than covering the whole file
let span = krate.spans.inner_span.shrink_to_lo();

self.sess.psess.buffer_lint_with_diagnostic(
self.sess.psess.buffer_lint(
lint::builtin::WASM_C_ABI,
span,
ast::CRATE_NODE_ID,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/middle/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ pub fn early_report_macro_deprecation(
path,
since_kind: deprecated_since_kind(is_in_effect, depr.since.clone()),
};
lint_buffer.buffer_lint_with_diagnostic(deprecation_lint(is_in_effect), node_id, span, diag);
lint_buffer.buffer_lint(deprecation_lint(is_in_effect), node_id, span, diag);
}

fn late_report_deprecation(
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_parse/src/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ impl<'psess, 'src> StringReader<'psess, 'src> {
let content = self.str_from(content_start);
if contains_text_flow_control_chars(content) {
let span = self.mk_sp(start, self.pos);
self.psess.buffer_lint_with_diagnostic(
self.psess.buffer_lint(
TEXT_DIRECTION_CODEPOINT_IN_COMMENT,
span,
ast::CRATE_NODE_ID,
Expand Down Expand Up @@ -722,7 +722,7 @@ impl<'psess, 'src> StringReader<'psess, 'src> {
self.dcx().emit_err(errors::UnknownPrefix { span: prefix_span, prefix, sugg });
} else {
// Before Rust 2021, only emit a lint for migration.
self.psess.buffer_lint_with_diagnostic(
self.psess.buffer_lint(
RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX,
prefix_span,
ast::CRATE_NODE_ID,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_parse/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,7 @@ impl<'a> Parser<'a> {
| ExprKind::Block(_, None)
)
{
self.psess.buffer_lint_with_diagnostic(
self.psess.buffer_lint(
BREAK_WITH_LABEL_AND_LOOP,
lo.to(expr.span),
ast::CRATE_NODE_ID,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_parse/src/validate_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ fn emit_malformed_attribute(
suggestions.push(format!("#{inner}[{name} = \"{descr}\"]"));
}
if should_warn(name) {
psess.buffer_lint_with_diagnostic(
psess.buffer_lint(
ILL_FORMED_ATTRIBUTE_INPUT,
span,
ast::CRATE_NODE_ID,
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_resolve/src/check_unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl<'a, 'b, 'tcx> UnusedImportCheckVisitor<'a, 'b, 'tcx> {
// We do this in any edition.
if warn_if_unused {
if let Some(&span) = maybe_unused_extern_crates.get(&extern_crate.id) {
self.r.lint_buffer.buffer_lint_with_diagnostic(
self.r.lint_buffer.buffer_lint(
UNUSED_EXTERN_CRATES,
extern_crate.id,
span,
Expand Down Expand Up @@ -203,7 +203,7 @@ impl<'a, 'b, 'tcx> UnusedImportCheckVisitor<'a, 'b, 'tcx> {
.span
.find_ancestor_inside(extern_crate.span)
.unwrap_or(extern_crate.ident.span);
self.r.lint_buffer.buffer_lint_with_diagnostic(
self.r.lint_buffer.buffer_lint(
UNUSED_EXTERN_CRATES,
extern_crate.id,
extern_crate.span,
Expand Down Expand Up @@ -388,7 +388,7 @@ impl Resolver<'_, '_> {
{
if let ImportKind::MacroUse { .. } = import.kind {
if !import.span.is_dummy() {
self.lint_buffer.buffer_lint_with_diagnostic(
self.lint_buffer.buffer_lint(
MACRO_USE_EXTERN_CRATE,
import.root_id,
import.span,
Expand All @@ -409,7 +409,7 @@ impl Resolver<'_, '_> {
}
}
ImportKind::MacroUse { .. } => {
self.lint_buffer.buffer_lint_with_diagnostic(
self.lint_buffer.buffer_lint(
UNUSED_IMPORTS,
import.root_id,
import.span,
Expand Down Expand Up @@ -477,7 +477,7 @@ impl Resolver<'_, '_> {
}
};

visitor.r.lint_buffer.buffer_lint_with_diagnostic(
visitor.r.lint_buffer.buffer_lint(
UNUSED_IMPORTS,
unused.use_tree_id,
ms,
Expand Down Expand Up @@ -533,7 +533,7 @@ impl Resolver<'_, '_> {
continue;
}

self.lint_buffer.buffer_lint_with_diagnostic(
self.lint_buffer.buffer_lint(
UNUSED_QUALIFICATIONS,
unn_qua.node_id,
unn_qua.path_span,
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_resolve/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
self.report_with_use_injections(krate);

for &(span_use, span_def) in &self.macro_expanded_macro_export_errors {
self.lint_buffer.buffer_lint_with_diagnostic(
self.lint_buffer.buffer_lint(
MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS,
CRATE_NODE_ID,
span_use,
Expand All @@ -142,7 +142,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
let NameBindingKind::Import { import, .. } = ambiguity_error.b1.0.kind else {
unreachable!()
};
self.lint_buffer.buffer_lint_with_diagnostic(
self.lint_buffer.buffer_lint(
AMBIGUOUS_GLOB_IMPORTS,
import.root_id,
ambiguity_error.ident.span,
Expand Down Expand Up @@ -522,7 +522,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
}

let diag = BuiltinLintDiag::AbsPathWithModule(root_span);
self.lint_buffer.buffer_lint_with_diagnostic(
self.lint_buffer.buffer_lint(
ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
node_id,
root_span,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/ident.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
match binding {
Ok(binding) => {
if let Some(lint_id) = derive_fallback_lint_id {
this.lint_buffer.buffer_lint_with_diagnostic(
this.lint_buffer.buffer_lint(
PROC_MACRO_DERIVE_RESOLUTION_FALLBACK,
lint_id,
orig_ident.span,
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_resolve/src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
&& binding.res() != Res::Err
&& exported_ambiguities.contains(&binding)
{
self.lint_buffer.buffer_lint_with_diagnostic(
self.lint_buffer.buffer_lint(
AMBIGUOUS_GLOB_REEXPORTS,
import.root_id,
import.root_span,
Expand Down Expand Up @@ -654,7 +654,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
&& glob_binding.vis.is_public()
&& !binding.vis.is_public()
{
self.lint_buffer.buffer_lint_with_diagnostic(
self.lint_buffer.buffer_lint(
HIDDEN_GLOB_REEXPORTS,
binding_id,
binding.span,
Expand Down Expand Up @@ -1013,7 +1013,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
&& !max_vis.is_at_least(import_vis, self.tcx)
{
let def_id = self.local_def_id(id);
self.lint_buffer.buffer_lint_with_diagnostic(
self.lint_buffer.buffer_lint(
UNUSED_IMPORTS,
id,
import.span,
Expand Down Expand Up @@ -1246,7 +1246,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
if !any_successful_reexport {
let (ns, binding) = reexport_error.unwrap();
if pub_use_of_private_extern_crate_hack(import, binding) {
self.lint_buffer.buffer_lint_with_diagnostic(
self.lint_buffer.buffer_lint(
PUB_USE_OF_PRIVATE_EXTERN_CRATE,
import_id,
import.span,
Expand Down
Loading

0 comments on commit 92749e6

Please sign in to comment.