Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
505c137
Rename some `Diagnostic` setters.
nnethercote Dec 23, 2023
5fe5d5d
Remove lots of `rustc_errors::` qualifiers in `lints.rs`.
nnethercote Jan 2, 2024
096b844
Remove forward for `downgrade_to_delayed_bug`.
nnethercote Jan 3, 2024
caefa55
Fix up `forward!` decls.
nnethercote Jan 3, 2024
b4a6239
Fix `forward!` so it doesn't require trailing commas in some cases.
nnethercote Jan 3, 2024
0487500
Provide better suggestions when encountering a bare trait as a type
estebank Dec 20, 2023
8551cab
Account for multiple trait bounds in bare trait object suggestion
estebank Dec 20, 2023
79bef72
Track `HirId` instead of `Span` in `ObligationCauseCode::SizedArgumen…
estebank Dec 20, 2023
771966b
review comments
estebank Jan 3, 2024
1e92223
Remove unused `DiagnosticBuilder::struct_almost_fatal`.
nnethercote Jan 3, 2024
78ef946
Account for object unsafe traits
estebank Jan 3, 2024
9560c58
Avoid some `rustc_errors::` qualifiers.
nnethercote Jan 4, 2024
4d35981
Remove unused `struct_error` function.
nnethercote Jan 4, 2024
8e6bca6
Inline and remove `StringReader::struct_fatal_span_char`.
nnethercote Jan 4, 2024
698dfc3
Silence redundant warning when E0038 will be emitted
estebank Jan 3, 2024
af32054
Remove `-Zdump-mir-spanview`
Zalathar Jan 4, 2024
8388112
Remove `is_lint` field from `Level::Error`.
nnethercote Jan 4, 2024
cf9484e
Remove `-Zreport-delayed-bugs`.
nnethercote Jan 4, 2024
59c76fb
Make `intrinsics::assume` const stable
AngelicosPhosphoros Jan 4, 2024
35ad2ae
Fix invalid handling for static method calls in jump to definition fe…
GuillaumeGomez Jan 4, 2024
5bc7687
Add regression test for jump to def static method calls
GuillaumeGomez Jan 4, 2024
073ed0e
Move `i586-unknown-netbsd` from tier 2 to tier 3 platform support table
Nemo157 Jan 4, 2024
12b92c8
Visit only reachable blocks in MIR lint
tmiasko Dec 30, 2023
a084e06
Fix validation and linting of injected MIR
tmiasko Jan 1, 2024
df116ec
Migrate memory overlap check from validator to lint
tmiasko Jan 4, 2024
cb9abca
Rename `EmitterWriter` as `HumanEmitter`.
nnethercote Jan 4, 2024
c4d63c7
Rename `AnnotateSnippetEmitterWriter` as `AnnotateSnippetEmitter`.
nnethercote Jan 4, 2024
453ffac
Add some comments to `Emitter`.
nnethercote Jan 4, 2024
f9df1ad
Check for profiler support via a flag, instead of an environment var
Zalathar Oct 27, 2023
aa4bf0b
Allow tests to ignore individual test modes
Zalathar Nov 30, 2023
9ab8c63
Extract a `split_flags` helper in header directive parsing
Zalathar Jan 4, 2024
731ba80
Allow coverage tests to enable `llvm-cov --use-color`
Zalathar Dec 16, 2023
f5a09a9
Unbreak `tests/ui/lint/use_suggestion_json.rs`.
nnethercote Jan 5, 2024
8843223
Change printing of "`--error-format` is unstable" errors.
nnethercote Jan 5, 2024
d180e91
Rollup merge of #119034 - Zalathar:ignore-mode, r=davidtwco
compiler-errors Jan 5, 2024
f41ad1b
Rollup merge of #119148 - estebank:bare-traits, r=davidtwco
compiler-errors Jan 5, 2024
f361b59
Rollup merge of #119538 - nnethercote:cleanup-errors-5, r=compiler-er…
compiler-errors Jan 5, 2024
e74a0cd
Rollup merge of #119566 - Zalathar:remove-spanview, r=Swatinem,Nilstrieb
compiler-errors Jan 5, 2024
c28715b
Rollup merge of #119567 - nnethercote:rm-Zreport-delayed-bugs, r=oli-obk
compiler-errors Jan 5, 2024
3a983ad
Rollup merge of #119577 - tmiasko:lint, r=oli-obk
compiler-errors Jan 5, 2024
8bea1df
Rollup merge of #119583 - AngelicosPhosphoros:const_assume, r=RalfJung
compiler-errors Jan 5, 2024
3f19de6
Rollup merge of #119586 - GuillaumeGomez:jump-to-def-static-methods, …
compiler-errors Jan 5, 2024
3087b36
Rollup merge of #119588 - Nemo157:i586-netbsd-tier-3, r=Nilstrieb
compiler-errors Jan 5, 2024
da700b3
Rollup merge of #119601 - nnethercote:Emitter-cleanups, r=oli-obk
compiler-errors Jan 5, 2024
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
Prev Previous commit
Next Next commit
Remove is_lint field from Level::Error.
Because it's redundant w.r.t. `Diagnostic::is_lint`, which is present
for every diagnostic level.

`struct_lint_level_impl` was the only place that set the `Error` field
to `true`, and it's also the only place that calls
`Diagnostic::is_lint()` to set the `is_lint` field.
  • Loading branch information
nnethercote committed Jan 4, 2024
commit 8388112970288c79ddb217949070cfb04c2798a5
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ fn not_testable_error(cx: &ExtCtxt<'_>, attr_sp: Span, item: Option<&ast::Item>)
// These were a warning before #92959 and need to continue being that to avoid breaking
// stable user code (#94508).
Some(ast::ItemKind::MacCall(_)) => Level::Warning(None),
_ => Level::Error { lint: false },
_ => Level::Error,
};
let mut err = DiagnosticBuilder::<()>::new(dcx, level, msg);
err.span(attr_sp);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ fn report_inline_asm(
cookie = 0;
}
let level = match level {
llvm::DiagnosticLevel::Error => Level::Error { lint: false },
llvm::DiagnosticLevel::Error => Level::Error,
llvm::DiagnosticLevel::Warning => Level::Warning(None),
llvm::DiagnosticLevel::Note | llvm::DiagnosticLevel::Remark => Level::Note,
};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1848,7 +1848,7 @@ impl SharedEmitterMain {
}
Ok(SharedEmitterMessage::InlineAsmError(cookie, msg, level, source)) => {
let err_level = match level {
Level::Error { lint: false } => Level::Error { lint: false },
Level::Error => Level::Error,
Level::Warning(_) => Level::Warning(None),
Level::Note => Level::Note,
_ => bug!("Invalid inline asm diagnostic level"),
Expand Down
4 changes: 1 addition & 3 deletions compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ fn source_string(file: Lrc<SourceFile>, line: &Line) -> String {
/// Maps `Diagnostic::Level` to `snippet::AnnotationType`
fn annotation_type_for_level(level: Level) -> AnnotationType {
match level {
Level::Bug | Level::DelayedBug | Level::Fatal | Level::Error { .. } => {
AnnotationType::Error
}
Level::Bug | Level::DelayedBug | Level::Fatal | Level::Error => AnnotationType::Error,
Level::Warning(_) => AnnotationType::Warning,
Level::Note | Level::OnceNote => AnnotationType::Note,
Level::Help | Level::OnceHelp => AnnotationType::Help,
Expand Down
8 changes: 3 additions & 5 deletions compiler/rustc_errors/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,9 @@ impl Diagnostic {

pub fn is_error(&self) -> bool {
match self.level {
Level::Bug
| Level::DelayedBug
| Level::Fatal
| Level::Error { .. }
| Level::FailureNote => true,
Level::Bug | Level::DelayedBug | Level::Fatal | Level::Error | Level::FailureNote => {
true
}

Level::Warning(_)
| Level::Note
Expand Down
24 changes: 10 additions & 14 deletions compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ impl DiagCtxt {
let key = (span.with_parent(None), key);

if diag.is_error() {
if matches!(diag.level, Error { lint: true }) {
if diag.level == Error && diag.is_lint {
inner.lint_err_count += 1;
} else {
inner.err_count += 1;
Expand All @@ -697,7 +697,7 @@ impl DiagCtxt {
let key = (span.with_parent(None), key);
let diag = inner.stashed_diagnostics.remove(&key)?;
if diag.is_error() {
if matches!(diag.level, Error { lint: true }) {
if diag.level == Error && diag.is_lint {
inner.lint_err_count -= 1;
} else {
inner.err_count -= 1;
Expand Down Expand Up @@ -812,7 +812,7 @@ impl DiagCtxt {
#[rustc_lint_diagnostics]
#[track_caller]
pub fn struct_err(&self, msg: impl Into<DiagnosticMessage>) -> DiagnosticBuilder<'_> {
DiagnosticBuilder::new(self, Error { lint: false }, msg)
DiagnosticBuilder::new(self, Error, msg)
}

/// Construct a builder at the `Error` level with the `msg` and the `code`.
Expand Down Expand Up @@ -1212,7 +1212,7 @@ impl DiagCtxt {

#[track_caller]
pub fn create_err<'a>(&'a self, err: impl IntoDiagnostic<'a>) -> DiagnosticBuilder<'a> {
err.into_diagnostic(self, Error { lint: false })
err.into_diagnostic(self, Error)
}

#[track_caller]
Expand Down Expand Up @@ -1367,7 +1367,7 @@ impl DiagCtxtInner {
for diag in diags {
// Decrement the count tracking the stash; emitting will increment it.
if diag.is_error() {
if matches!(diag.level, Error { lint: true }) {
if diag.level == Error && diag.is_lint {
self.lint_err_count -= 1;
} else {
self.err_count -= 1;
Expand Down Expand Up @@ -1398,7 +1398,7 @@ impl DiagCtxtInner {
&mut self,
diagnostic: &mut Diagnostic,
) -> Option<ErrorGuaranteed> {
if matches!(diagnostic.level, Error { .. } | Fatal) && self.treat_err_as_bug() {
if matches!(diagnostic.level, Error | Fatal) && self.treat_err_as_bug() {
diagnostic.level = Bug;
}

Expand Down Expand Up @@ -1499,7 +1499,7 @@ impl DiagCtxtInner {
}
}
if diagnostic.is_error() {
if matches!(diagnostic.level, Error { lint: true }) {
if diagnostic.level == Error && diagnostic.is_lint {
self.bump_lint_err_count();
} else {
self.bump_err_count();
Expand Down Expand Up @@ -1695,11 +1695,7 @@ pub enum Level {
/// most common case.
///
/// Its `EmissionGuarantee` is `ErrorGuaranteed`.
Error {
/// If this error comes from a lint, don't abort compilation even when abort_if_errors() is
/// called.
lint: bool,
},
Error,

/// A warning about the code being compiled. Does not prevent compilation from finishing.
///
Expand Down Expand Up @@ -1758,7 +1754,7 @@ impl Level {
fn color(self) -> ColorSpec {
let mut spec = ColorSpec::new();
match self {
Bug | DelayedBug | Fatal | Error { .. } => {
Bug | DelayedBug | Fatal | Error => {
spec.set_fg(Some(Color::Red)).set_intense(true);
}
Warning(_) => {
Expand All @@ -1779,7 +1775,7 @@ impl Level {
pub fn to_str(self) -> &'static str {
match self {
Bug | DelayedBug => "error: internal compiler error",
Fatal | Error { .. } => "error",
Fatal | Error => "error",
Warning(_) => "warning",
Note | OnceNote => "note",
Help | OnceHelp => "help",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_expand/src/proc_macro_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ impl ToInternal<SmallVec<[tokenstream::TokenTree; 2]>>
impl ToInternal<rustc_errors::Level> for Level {
fn to_internal(self) -> rustc_errors::Level {
match self {
Level::Error => rustc_errors::Level::Error { lint: false },
Level::Error => rustc_errors::Level::Error,
Level::Warning => rustc_errors::Level::Warning(None),
Level::Note => rustc_errors::Level::Note,
Level::Help => rustc_errors::Level::Help,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ pub fn struct_lint_level(
}
Level::ForceWarn(Some(expect_id)) => rustc_errors::Level::Warning(Some(expect_id)),
Level::Warn | Level::ForceWarn(None) => rustc_errors::Level::Warning(None),
Level::Deny | Level::Forbid => rustc_errors::Level::Error { lint: true },
Level::Deny | Level::Forbid => rustc_errors::Level::Error,
};
let mut err = DiagnosticBuilder::new(sess.dcx(), err_level, "");
if let Some(span) = span {
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ pub fn report_msg<'tcx>(
let span = stacktrace.first().map_or(DUMMY_SP, |fi| fi.span);
let sess = machine.tcx.sess;
let level = match diag_level {
DiagLevel::Error => Level::Error { lint: false },
DiagLevel::Error => Level::Error,
DiagLevel::Warning => Level::Warning(None),
DiagLevel::Note => Level::Note,
};
Expand Down