Skip to content

Commit a79f29f

Browse files
committed
Auto merge of rust-lang#120679 - matthiaskrgr:rollup-div27ks, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#120023 (tidy: reduce allocs) - rust-lang#120396 (Account for unbounded type param receiver in suggestions) - rust-lang#120435 (Suggest name value cfg when only value is used for check-cfg) - rust-lang#120507 (Account for non-overlapping unmet trait bounds in suggestion) - rust-lang#120520 (Some cleanups around diagnostic levels.) - rust-lang#120575 (Simplify codegen diagnostic handling) - rust-lang#120670 (cleanup effect var handling) Failed merges: - rust-lang#120423 (update indirect structural match lints to match RFC and to show up for dependencies) r? `@ghost` `@rustbot` modify labels: rollup
2 parents ea37e80 + 937bf02 commit a79f29f

39 files changed

+621
-382
lines changed

Cargo.lock

+36-44
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,9 @@ dependencies = [
4949

5050
[[package]]
5151
name = "aho-corasick"
52-
version = "0.7.20"
52+
version = "1.1.2"
5353
source = "registry+https://github.com/rust-lang/crates.io-index"
54-
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
55-
dependencies = [
56-
"memchr",
57-
]
58-
59-
[[package]]
60-
name = "aho-corasick"
61-
version = "1.0.2"
62-
source = "registry+https://github.com/rust-lang/crates.io-index"
63-
checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41"
54+
checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
6455
dependencies = [
6556
"memchr",
6657
]
@@ -319,13 +310,12 @@ dependencies = [
319310

320311
[[package]]
321312
name = "bstr"
322-
version = "1.5.0"
313+
version = "1.9.0"
323314
source = "registry+https://github.com/rust-lang/crates.io-index"
324-
checksum = "a246e68bb43f6cd9db24bea052a53e40405417c5fb372e3d1a8a7f770a564ef5"
315+
checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc"
325316
dependencies = [
326317
"memchr",
327-
"once_cell",
328-
"regex-automata 0.1.10",
318+
"regex-automata 0.4.3",
329319
"serde",
330320
]
331321

@@ -596,7 +586,7 @@ dependencies = [
596586
name = "clippy_dev"
597587
version = "0.0.1"
598588
dependencies = [
599-
"aho-corasick 1.0.2",
589+
"aho-corasick",
600590
"clap",
601591
"indoc",
602592
"itertools",
@@ -1597,15 +1587,15 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
15971587

15981588
[[package]]
15991589
name = "globset"
1600-
version = "0.4.10"
1590+
version = "0.4.14"
16011591
source = "registry+https://github.com/rust-lang/crates.io-index"
1602-
checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc"
1592+
checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1"
16031593
dependencies = [
1604-
"aho-corasick 0.7.20",
1594+
"aho-corasick",
16051595
"bstr",
1606-
"fnv",
16071596
"log",
1608-
"regex",
1597+
"regex-automata 0.4.3",
1598+
"regex-syntax 0.8.2",
16091599
]
16101600

16111601
[[package]]
@@ -1944,17 +1934,16 @@ checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed"
19441934

19451935
[[package]]
19461936
name = "ignore"
1947-
version = "0.4.20"
1937+
version = "0.4.22"
19481938
source = "registry+https://github.com/rust-lang/crates.io-index"
1949-
checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492"
1939+
checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1"
19501940
dependencies = [
1941+
"crossbeam-deque",
19511942
"globset",
1952-
"lazy_static",
19531943
"log",
19541944
"memchr",
1955-
"regex",
1945+
"regex-automata 0.4.3",
19561946
"same-file",
1957-
"thread_local",
19581947
"walkdir",
19591948
"winapi-util",
19601949
]
@@ -2274,9 +2263,9 @@ dependencies = [
22742263

22752264
[[package]]
22762265
name = "log"
2277-
version = "0.4.19"
2266+
version = "0.4.20"
22782267
source = "registry+https://github.com/rust-lang/crates.io-index"
2279-
checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
2268+
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
22802269

22812270
[[package]]
22822271
name = "lzma-sys"
@@ -2378,9 +2367,9 @@ dependencies = [
23782367

23792368
[[package]]
23802369
name = "memchr"
2381-
version = "2.5.0"
2370+
version = "2.7.1"
23822371
source = "registry+https://github.com/rust-lang/crates.io-index"
2383-
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
2372+
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
23842373
dependencies = [
23852374
"compiler_builtins",
23862375
"rustc-std-workspace-core",
@@ -2490,9 +2479,6 @@ dependencies = [
24902479
[[package]]
24912480
name = "miropt-test-tools"
24922481
version = "0.1.0"
2493-
dependencies = [
2494-
"regex",
2495-
]
24962482

24972483
[[package]]
24982484
name = "native-tls"
@@ -3153,13 +3139,14 @@ dependencies = [
31533139

31543140
[[package]]
31553141
name = "regex"
3156-
version = "1.8.4"
3142+
version = "1.10.2"
31573143
source = "registry+https://github.com/rust-lang/crates.io-index"
3158-
checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f"
3144+
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
31593145
dependencies = [
3160-
"aho-corasick 1.0.2",
3146+
"aho-corasick",
31613147
"memchr",
3162-
"regex-syntax 0.7.2",
3148+
"regex-automata 0.4.3",
3149+
"regex-syntax 0.8.2",
31633150
]
31643151

31653152
[[package]]
@@ -3181,16 +3168,21 @@ dependencies = [
31813168
]
31823169

31833170
[[package]]
3184-
name = "regex-syntax"
3185-
version = "0.6.29"
3171+
name = "regex-automata"
3172+
version = "0.4.3"
31863173
source = "registry+https://github.com/rust-lang/crates.io-index"
3187-
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
3174+
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
3175+
dependencies = [
3176+
"aho-corasick",
3177+
"memchr",
3178+
"regex-syntax 0.8.2",
3179+
]
31883180

31893181
[[package]]
31903182
name = "regex-syntax"
3191-
version = "0.7.2"
3183+
version = "0.6.29"
31923184
source = "registry+https://github.com/rust-lang/crates.io-index"
3193-
checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78"
3185+
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
31943186

31953187
[[package]]
31963188
name = "regex-syntax"
@@ -5940,9 +5932,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
59405932

59415933
[[package]]
59425934
name = "walkdir"
5943-
version = "2.3.3"
5935+
version = "2.4.0"
59445936
source = "registry+https://github.com/rust-lang/crates.io-index"
5945-
checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698"
5937+
checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee"
59465938
dependencies = [
59475939
"same-file",
59485940
"winapi-util",

compiler/rustc_codegen_ssa/src/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1810,7 +1810,7 @@ impl Translate for SharedEmitter {
18101810
}
18111811

18121812
impl Emitter for SharedEmitter {
1813-
fn emit_diagnostic(&mut self, diag: &rustc_errors::Diagnostic) {
1813+
fn emit_diagnostic(&mut self, diag: rustc_errors::Diagnostic) {
18141814
let args: FxHashMap<DiagnosticArgName, DiagnosticArgValue> =
18151815
diag.args().map(|(name, arg)| (name.clone(), arg.clone())).collect();
18161816
drop(self.sender.send(SharedEmitterMessage::Diagnostic(Diagnostic {

compiler/rustc_error_messages/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ impl From<Cow<'static, str>> for DiagnosticMessage {
378378
}
379379
}
380380

381-
/// A workaround for "good path" ICEs when formatting types in disabled lints.
381+
/// A workaround for good_path_delayed_bug ICEs when formatting types in disabled lints.
382382
///
383383
/// Delays formatting until `.into(): DiagnosticMessage` is used.
384384
pub struct DelayDm<F>(pub F);

compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs

+13-9
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ impl Translate for AnnotateSnippetEmitter {
4444

4545
impl Emitter for AnnotateSnippetEmitter {
4646
/// The entry point for the diagnostics generation
47-
fn emit_diagnostic(&mut self, diag: &Diagnostic) {
47+
fn emit_diagnostic(&mut self, mut diag: Diagnostic) {
4848
let fluent_args = to_fluent_args(diag.args());
4949

50-
let mut children = diag.children.clone();
51-
let (mut primary_span, suggestions) = self.primary_span_formatted(diag, &fluent_args);
50+
let mut suggestions = diag.suggestions.unwrap_or(vec![]);
51+
self.primary_span_formatted(&mut diag.span, &mut suggestions, &fluent_args);
5252

5353
self.fix_multispans_in_extern_macros_and_render_macro_backtrace(
54-
&mut primary_span,
55-
&mut children,
54+
&mut diag.span,
55+
&mut diag.children,
5656
&diag.level,
5757
self.macro_backtrace,
5858
);
@@ -62,9 +62,9 @@ impl Emitter for AnnotateSnippetEmitter {
6262
&diag.messages,
6363
&fluent_args,
6464
&diag.code,
65-
&primary_span,
66-
&children,
67-
suggestions,
65+
&diag.span,
66+
&diag.children,
67+
&suggestions,
6868
);
6969
}
7070

@@ -85,7 +85,11 @@ fn source_string(file: Lrc<SourceFile>, line: &Line) -> String {
8585
/// Maps `Diagnostic::Level` to `snippet::AnnotationType`
8686
fn annotation_type_for_level(level: Level) -> AnnotationType {
8787
match level {
88-
Level::Bug | Level::DelayedBug(_) | Level::Fatal | Level::Error => AnnotationType::Error,
88+
Level::Bug
89+
| Level::Fatal
90+
| Level::Error
91+
| Level::DelayedBug
92+
| Level::GoodPathDelayedBug => AnnotationType::Error,
8993
Level::ForceWarning(_) | Level::Warning => AnnotationType::Warning,
9094
Level::Note | Level::OnceNote => AnnotationType::Note,
9195
Level::Help | Level::OnceHelp => AnnotationType::Help,

compiler/rustc_errors/src/diagnostic.rs

+8-12
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use crate::snippet::Style;
22
use crate::{
3-
CodeSuggestion, DelayedBugKind, DiagnosticBuilder, DiagnosticMessage, EmissionGuarantee,
4-
ErrCode, Level, MultiSpan, SubdiagnosticMessage, Substitution, SubstitutionPart,
5-
SuggestionStyle,
3+
CodeSuggestion, DiagnosticBuilder, DiagnosticMessage, EmissionGuarantee, ErrCode, Level,
4+
MultiSpan, SubdiagnosticMessage, Substitution, SubstitutionPart, SuggestionStyle,
65
};
76
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
87
use rustc_error_messages::fluent_value_from_str_list_sep_by_and;
@@ -235,19 +234,16 @@ impl Diagnostic {
235234

236235
pub fn is_error(&self) -> bool {
237236
match self.level {
238-
Level::Bug
239-
| Level::DelayedBug(DelayedBugKind::Normal)
240-
| Level::Fatal
241-
| Level::Error
242-
| Level::FailureNote => true,
237+
Level::Bug | Level::Fatal | Level::Error | Level::DelayedBug => true,
243238

244-
Level::ForceWarning(_)
239+
Level::GoodPathDelayedBug
240+
| Level::ForceWarning(_)
245241
| Level::Warning
246-
| Level::DelayedBug(DelayedBugKind::GoodPath)
247242
| Level::Note
248243
| Level::OnceNote
249244
| Level::Help
250245
| Level::OnceHelp
246+
| Level::FailureNote
251247
| Level::Allow
252248
| Level::Expect(_) => false,
253249
}
@@ -306,11 +302,11 @@ impl Diagnostic {
306302
#[track_caller]
307303
pub fn downgrade_to_delayed_bug(&mut self) {
308304
assert!(
309-
self.is_error(),
305+
matches!(self.level, Level::Error | Level::DelayedBug),
310306
"downgrade_to_delayed_bug: cannot downgrade {:?} to DelayedBug: not an error",
311307
self.level
312308
);
313-
self.level = Level::DelayedBug(DelayedBugKind::Normal);
309+
self.level = Level::DelayedBug;
314310
}
315311

316312
/// Appends a labeled span to the diagnostic.

0 commit comments

Comments
 (0)