Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f5d6eb3
hir: Stop keeping prefixes for most of `use` list stems
petrochenkov Jan 30, 2024
17f0919
rustc_monomorphize: fix outdated comment in partition
klensy Feb 3, 2024
934618f
Emit a diagnostic for invalid target options
saethlin Feb 4, 2024
a4cb55f
For E0223, suggest methods that look similar to the path
trevyn Feb 3, 2024
285d8c2
Suggest `[tail @ ..]` on `[..tail]` and `[...tail]` where `tail` is u…
fmease Feb 3, 2024
e8c3cbf
Make `Diagnostic::is_error` return false for `Level::FailureNote`.
nnethercote Jan 30, 2024
5dd0431
Tighten the assertion in `downgrade_to_delayed_bug`.
nnethercote Jan 31, 2024
c367386
Refactor `emit_diagnostic`.
nnethercote Jan 31, 2024
59e0bc2
Split `Level::DelayedBug` in two.
nnethercote Jan 31, 2024
9cd6c68
cleanup effect var handling
lcnr Feb 5, 2024
d9508a1
Make `Emitter::emit_diagnostic` consuming.
nnethercote Feb 2, 2024
f32aa1a
rustc_metadata: fix typo
klensy Feb 5, 2024
d321437
Remove b-naber from the compiler review rotation
fmease Feb 5, 2024
0b6af71
Create helper `maybe_report_similar_assoc_fn`
trevyn Feb 6, 2024
25635b9
miri: fix ICE with symbolic alignment check on extern static
RalfJung Feb 5, 2024
f130878
Make async closures test use async bound modifier
compiler-errors Feb 6, 2024
5587be8
Rollup merge of #120520 - nnethercote:rename-good-path, r=oli-obk
matthiaskrgr Feb 6, 2024
a3d3ccf
Rollup merge of #120575 - nnethercote:simplify-codegen-diag-handling,…
matthiaskrgr Feb 6, 2024
89aa85d
Rollup merge of #120597 - fmease:sugg-on-js-style-spread-op-in-pat, r…
matthiaskrgr Feb 6, 2024
5a2cec2
Rollup merge of #120602 - klensy:mono-comment, r=nnethercote
matthiaskrgr Feb 6, 2024
3731acc
Rollup merge of #120609 - petrochenkov:nousestem2, r=compiler-errors
matthiaskrgr Feb 6, 2024
8906977
Rollup merge of #120631 - saethlin:invalid-target-ice, r=compiler-errors
matthiaskrgr Feb 6, 2024
eae477d
Rollup merge of #120632 - trevyn:issue-109195, r=oli-obk
matthiaskrgr Feb 6, 2024
cee6212
Rollup merge of #120670 - lcnr:effect-var-storage, r=fee1-dead
matthiaskrgr Feb 6, 2024
054fa0b
Rollup merge of #120673 - klensy:typo2, r=compiler-errors
matthiaskrgr Feb 6, 2024
6908d3e
Rollup merge of #120683 - RalfJung:symbolic-alignment-ice, r=oli-obk
matthiaskrgr Feb 6, 2024
0ab3f01
Rollup merge of #120690 - fmease:review-rotation-update, r=compiler-e…
matthiaskrgr Feb 6, 2024
d98a8a1
Rollup merge of #120713 - compiler-errors:async-bounds-on-tests, r=fm…
matthiaskrgr Feb 6, 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
Split Level::DelayedBug in two.
The two kinds of delayed bug have quite different semantics so a
stronger conceptual separation is nice. (`is_error` is a good example,
because the two kinds have different behaviour.)

The commit also moves the `DelayedBug` variant after `Error` in `Level`,
to reflect the fact that it's weaker than `Error` -- it might trigger an
error but also might not. (The pre-existing `downgrade_to_delayed_bug`
function also reflects the notion that delayed bugs are lower/after
normal errors.)

Plus it condenses some of the comments on `Level` into a table, for
easier reading, and introduces `can_be_top_or_sub` to indicate which
levels can be used in top-level diagnostics vs. subdiagnostics.

Finally, it renames `DiagCtxtInner::span_delayed_bugs` as
`DiagCtxtInner::delayed_bugs`. The `span_` prefix is unnecessary because
some delayed bugs don't have a span.
  • Loading branch information
nnethercote committed Feb 4, 2024
commit 59e0bc2de7134a2d88e9c14db32884e631e90373
2 changes: 1 addition & 1 deletion compiler/rustc_error_messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ impl From<Cow<'static, str>> for DiagnosticMessage {
}
}

/// A workaround for "good path" ICEs when formatting types in disabled lints.
/// A workaround for good_path_delayed_bug ICEs when formatting types in disabled lints.
///
/// Delays formatting until `.into(): DiagnosticMessage` is used.
pub struct DelayDm<F>(pub F);
Expand Down
6 changes: 5 additions & 1 deletion compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ 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::Fatal
| Level::Error
| Level::DelayedBug
| Level::GoodPathDelayedBug => AnnotationType::Error,
Level::ForceWarning(_) | Level::Warning => AnnotationType::Warning,
Level::Note | Level::OnceNote => AnnotationType::Note,
Level::Help | Level::OnceHelp => AnnotationType::Help,
Expand Down
18 changes: 7 additions & 11 deletions compiler/rustc_errors/src/diagnostic.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::snippet::Style;
use crate::{
CodeSuggestion, DelayedBugKind, DiagnosticBuilder, DiagnosticMessage, EmissionGuarantee,
ErrCode, Level, MultiSpan, SubdiagnosticMessage, Substitution, SubstitutionPart,
SuggestionStyle,
CodeSuggestion, DiagnosticBuilder, DiagnosticMessage, EmissionGuarantee, ErrCode, Level,
MultiSpan, SubdiagnosticMessage, Substitution, SubstitutionPart, SuggestionStyle,
};
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
use rustc_error_messages::fluent_value_from_str_list_sep_by_and;
Expand Down Expand Up @@ -235,14 +234,11 @@ impl Diagnostic {

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

Level::ForceWarning(_)
Level::GoodPathDelayedBug
| Level::ForceWarning(_)
| Level::Warning
| Level::DelayedBug(DelayedBugKind::GoodPath)
| Level::Note
| Level::OnceNote
| Level::Help
Expand Down Expand Up @@ -306,11 +302,11 @@ impl Diagnostic {
#[track_caller]
pub fn downgrade_to_delayed_bug(&mut self) {
assert!(
matches!(self.level, Level::Error | Level::DelayedBug(_)),
matches!(self.level, Level::Error | Level::DelayedBug),
"downgrade_to_delayed_bug: cannot downgrade {:?} to DelayedBug: not an error",
self.level
);
self.level = Level::DelayedBug(DelayedBugKind::Normal);
self.level = Level::DelayedBug;
}

/// Appends a labeled span to the diagnostic.
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_errors/src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2116,6 +2116,7 @@ impl HumanEmitter {
}
if !self.short_message {
for child in children {
assert!(child.level.can_be_top_or_sub().1);
let span = &child.span;
if let Err(err) = self.emit_messages_default_inner(
span,
Expand Down
Loading