Skip to content

Commit cf70855

Browse files
committed
Auto merge of rust-lang#90188 - matthiaskrgr:rollup-74cwv5c, r=matthiaskrgr
Rollup of 11 pull requests Successful merges: - rust-lang#83233 (Implement split_array and split_array_mut) - rust-lang#88300 (Stabilise unix_process_wait_more, extra ExitStatusExt methods) - rust-lang#89416 (nice_region_error: Include lifetime placeholders in error output) - rust-lang#89468 (Report fatal lexer errors in `--cfg` command line arguments) - rust-lang#89730 (add feature flag for `type_changing_struct_update`) - rust-lang#89920 (Implement -Z location-detail flag) - rust-lang#90070 (Add edition configuration to compiletest) - rust-lang#90087 (Sync rustfmt subtree) - rust-lang#90117 (Make RSplit<T, P>: Clone not require T: Clone) - rust-lang#90122 (CI: make docker cache download and `docker load` time out after 10 minutes) - rust-lang#90166 (Add comment documenting why we can't use a simpler solution) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents a3f7c4d + a05a129 commit cf70855

File tree

187 files changed

+3500
-1021
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+3500
-1021
lines changed

Cargo.lock

+37-43
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,23 @@ version = "1.0.1"
265265
source = "registry+https://github.com/rust-lang/crates.io-index"
266266
checksum = "81a18687293a1546b67c246452202bbbf143d239cb43494cc163da14979082da"
267267

268+
[[package]]
269+
name = "camino"
270+
version = "1.0.5"
271+
source = "registry+https://github.com/rust-lang/crates.io-index"
272+
checksum = "52d74260d9bf6944e2208aa46841b4b8f0d7ffc0849a06837b2f510337f86b2b"
273+
dependencies = [
274+
"serde",
275+
]
276+
268277
[[package]]
269278
name = "cargo"
270279
version = "0.58.0"
271280
dependencies = [
272281
"anyhow",
273282
"atty",
274283
"bytesize",
275-
"cargo-platform",
284+
"cargo-platform 0.1.2",
276285
"cargo-test-macro",
277286
"cargo-test-support",
278287
"cargo-util",
@@ -374,6 +383,15 @@ dependencies = [
374383
"serde",
375384
]
376385

386+
[[package]]
387+
name = "cargo-platform"
388+
version = "0.1.2"
389+
source = "registry+https://github.com/rust-lang/crates.io-index"
390+
checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27"
391+
dependencies = [
392+
"serde",
393+
]
394+
377395
[[package]]
378396
name = "cargo-test-macro"
379397
version = "0.1.0"
@@ -421,23 +439,24 @@ dependencies = [
421439

422440
[[package]]
423441
name = "cargo_metadata"
424-
version = "0.8.2"
442+
version = "0.12.0"
425443
source = "registry+https://github.com/rust-lang/crates.io-index"
426-
checksum = "700b3731fd7d357223d0000f4dbf1808401b694609035c3c411fbc0cd375c426"
444+
checksum = "d5a5f7b42f606b7f23674f6f4d877628350682bc40687d3fae65679a58d55345"
427445
dependencies = [
428-
"semver 0.9.0",
446+
"semver 0.11.0",
429447
"serde",
430-
"serde_derive",
431448
"serde_json",
432449
]
433450

434451
[[package]]
435452
name = "cargo_metadata"
436-
version = "0.12.0"
453+
version = "0.14.0"
437454
source = "registry+https://github.com/rust-lang/crates.io-index"
438-
checksum = "d5a5f7b42f606b7f23674f6f4d877628350682bc40687d3fae65679a58d55345"
455+
checksum = "c297bd3135f558552f99a0daa180876984ea2c4ffa7470314540dff8c654109a"
439456
dependencies = [
440-
"semver 0.11.0",
457+
"camino",
458+
"cargo-platform 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
459+
"semver 1.0.3",
441460
"serde",
442461
"serde_json",
443462
]
@@ -1070,9 +1089,9 @@ dependencies = [
10701089

10711090
[[package]]
10721091
name = "env_logger"
1073-
version = "0.6.2"
1092+
version = "0.7.1"
10741093
source = "registry+https://github.com/rust-lang/crates.io-index"
1075-
checksum = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3"
1094+
checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
10761095
dependencies = [
10771096
"atty",
10781097
"humantime 1.3.0",
@@ -1083,12 +1102,12 @@ dependencies = [
10831102

10841103
[[package]]
10851104
name = "env_logger"
1086-
version = "0.7.1"
1105+
version = "0.8.4"
10871106
source = "registry+https://github.com/rust-lang/crates.io-index"
1088-
checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
1107+
checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3"
10891108
dependencies = [
10901109
"atty",
1091-
"humantime 1.3.0",
1110+
"humantime 2.0.1",
10921111
"log",
10931112
"regex",
10941113
"termcolor",
@@ -1698,15 +1717,6 @@ version = "0.1.6"
16981717
source = "registry+https://github.com/rust-lang/crates.io-index"
16991718
checksum = "5b141fdc7836c525d4d594027d318c84161ca17aaf8113ab1f81ab93ae897485"
17001719

1701-
[[package]]
1702-
name = "itertools"
1703-
version = "0.8.2"
1704-
source = "registry+https://github.com/rust-lang/crates.io-index"
1705-
checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484"
1706-
dependencies = [
1707-
"either",
1708-
]
1709-
17101720
[[package]]
17111721
name = "itertools"
17121722
version = "0.9.0"
@@ -4673,19 +4683,19 @@ dependencies = [
46734683

46744684
[[package]]
46754685
name = "rustfmt-nightly"
4676-
version = "1.4.37"
4686+
version = "1.4.38"
46774687
dependencies = [
46784688
"annotate-snippets",
46794689
"anyhow",
46804690
"bytecount",
4681-
"cargo_metadata 0.8.2",
4691+
"cargo_metadata 0.14.0",
46824692
"derive-new",
46834693
"diff",
46844694
"dirs",
4685-
"env_logger 0.6.2",
4695+
"env_logger 0.8.4",
46864696
"getopts",
46874697
"ignore",
4688-
"itertools 0.8.2",
4698+
"itertools 0.9.0",
46894699
"lazy_static",
46904700
"log",
46914701
"regex",
@@ -4768,23 +4778,13 @@ dependencies = [
47684778
"libc",
47694779
]
47704780

4771-
[[package]]
4772-
name = "semver"
4773-
version = "0.9.0"
4774-
source = "registry+https://github.com/rust-lang/crates.io-index"
4775-
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
4776-
dependencies = [
4777-
"semver-parser 0.7.0",
4778-
"serde",
4779-
]
4780-
47814781
[[package]]
47824782
name = "semver"
47834783
version = "0.11.0"
47844784
source = "registry+https://github.com/rust-lang/crates.io-index"
47854785
checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6"
47864786
dependencies = [
4787-
"semver-parser 0.10.2",
4787+
"semver-parser",
47884788
"serde",
47894789
]
47904790

@@ -4797,12 +4797,6 @@ dependencies = [
47974797
"serde",
47984798
]
47994799

4800-
[[package]]
4801-
name = "semver-parser"
4802-
version = "0.7.0"
4803-
source = "registry+https://github.com/rust-lang/crates.io-index"
4804-
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
4805-
48064800
[[package]]
48074801
name = "semver-parser"
48084802
version = "0.10.2"

compiler/rustc_const_eval/src/interpret/intrinsics/caller_location.rs

+11-4
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,17 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
8080
line: u32,
8181
col: u32,
8282
) -> MPlaceTy<'tcx, M::PointerTag> {
83-
let file =
84-
self.allocate_str(&filename.as_str(), MemoryKind::CallerLocation, Mutability::Not);
85-
let line = Scalar::from_u32(line);
86-
let col = Scalar::from_u32(col);
83+
let loc_details = &self.tcx.sess.opts.debugging_opts.location_detail;
84+
let file = if loc_details.file {
85+
self.allocate_str(&filename.as_str(), MemoryKind::CallerLocation, Mutability::Not)
86+
} else {
87+
// FIXME: This creates a new allocation each time. It might be preferable to
88+
// perform this allocation only once, and re-use the `MPlaceTy`.
89+
// See https://github.com/rust-lang/rust/pull/89920#discussion_r730012398
90+
self.allocate_str("<redacted>", MemoryKind::CallerLocation, Mutability::Not)
91+
};
92+
let line = if loc_details.line { Scalar::from_u32(line) } else { Scalar::from_u32(0) };
93+
let col = if loc_details.column { Scalar::from_u32(col) } else { Scalar::from_u32(0) };
8794

8895
// Allocate memory for `CallerLocation` struct.
8996
let loc_ty = self

compiler/rustc_errors/src/emitter.rs

+17-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc_span::{MultiSpan, SourceFile, Span};
1515
use crate::snippet::{Annotation, AnnotationType, Line, MultilineAnnotation, Style, StyledString};
1616
use crate::styled_buffer::StyledBuffer;
1717
use crate::{
18-
CodeSuggestion, Diagnostic, DiagnosticId, Level, SubDiagnostic, SubstitutionHighlight,
18+
CodeSuggestion, Diagnostic, DiagnosticId, Handler, Level, SubDiagnostic, SubstitutionHighlight,
1919
SuggestionStyle,
2020
};
2121

@@ -523,14 +523,27 @@ impl Emitter for EmitterWriter {
523523
}
524524
}
525525

526-
/// An emitter that does nothing when emitting a diagnostic.
527-
pub struct SilentEmitter;
526+
/// An emitter that does nothing when emitting a non-fatal diagnostic.
527+
/// Fatal diagnostics are forwarded to `fatal_handler` to avoid silent
528+
/// failures of rustc, as witnessed e.g. in issue #89358.
529+
pub struct SilentEmitter {
530+
pub fatal_handler: Handler,
531+
pub fatal_note: Option<String>,
532+
}
528533

529534
impl Emitter for SilentEmitter {
530535
fn source_map(&self) -> Option<&Lrc<SourceMap>> {
531536
None
532537
}
533-
fn emit_diagnostic(&mut self, _: &Diagnostic) {}
538+
fn emit_diagnostic(&mut self, d: &Diagnostic) {
539+
if d.level == Level::Fatal {
540+
let mut d = d.clone();
541+
if let Some(ref note) = self.fatal_note {
542+
d.note(note);
543+
}
544+
self.fatal_handler.emit_diagnostic(&d);
545+
}
546+
}
534547
}
535548

536549
/// Maximum number of lines we will print for a multiline suggestion; arbitrary.

compiler/rustc_feature/src/active.rs

+4
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,10 @@ declare_features! (
684684
/// Allows using the `non_exhaustive_omitted_patterns` lint.
685685
(active, non_exhaustive_omitted_patterns_lint, "1.57.0", Some(89554), None),
686686

687+
/// Allows creation of instances of a struct by moving fields that have
688+
/// not changed from prior instances of the same struct (RFC #2528)
689+
(incomplete, type_changing_struct_update, "1.58.0", Some(86555), None),
690+
687691
// -------------------------------------------------------------------------
688692
// feature-group-end: actual feature gates
689693
// -------------------------------------------------------------------------

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/trait_impl_difference.rs

+48-11
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ use rustc_hir as hir;
99
use rustc_hir::def::Res;
1010
use rustc_hir::def_id::DefId;
1111
use rustc_hir::intravisit::Visitor;
12-
use rustc_middle::ty::error::ExpectedFound;
13-
use rustc_middle::ty::{self, Ty, TyCtxt};
12+
use rustc_middle::ty::print::RegionHighlightMode;
13+
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, TypeVisitor};
14+
1415
use rustc_span::{MultiSpan, Span, Symbol};
1516

17+
use std::ops::ControlFlow;
18+
1619
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
1720
/// Print the error message for lifetime errors when the `impl` doesn't conform to the `trait`.
1821
pub(super) fn try_report_impl_not_conforming_to_trait(&self) -> Option<ErrorReported> {
@@ -69,6 +72,47 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
6972
.tcx()
7073
.sess
7174
.struct_span_err(sp, "`impl` item signature doesn't match `trait` item signature");
75+
76+
// Mark all unnamed regions in the type with a number.
77+
// This diagnostic is called in response to lifetime errors, so be informative.
78+
struct HighlightBuilder<'tcx> {
79+
highlight: RegionHighlightMode,
80+
tcx: TyCtxt<'tcx>,
81+
counter: usize,
82+
}
83+
84+
impl HighlightBuilder<'tcx> {
85+
fn build(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> RegionHighlightMode {
86+
let mut builder =
87+
HighlightBuilder { highlight: RegionHighlightMode::default(), counter: 1, tcx };
88+
builder.visit_ty(ty);
89+
builder.highlight
90+
}
91+
}
92+
93+
impl<'tcx> ty::fold::TypeVisitor<'tcx> for HighlightBuilder<'tcx> {
94+
fn tcx_for_anon_const_substs(&self) -> Option<TyCtxt<'tcx>> {
95+
Some(self.tcx)
96+
}
97+
98+
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
99+
if !r.has_name() && self.counter <= 3 {
100+
self.highlight.highlighting_region(r, self.counter);
101+
self.counter += 1;
102+
}
103+
r.super_visit_with(self)
104+
}
105+
}
106+
107+
let expected_highlight = HighlightBuilder::build(self.tcx(), expected);
108+
let expected = self
109+
.infcx
110+
.extract_inference_diagnostics_data(expected.into(), Some(expected_highlight))
111+
.name;
112+
let found_highlight = HighlightBuilder::build(self.tcx(), found);
113+
let found =
114+
self.infcx.extract_inference_diagnostics_data(found.into(), Some(found_highlight)).name;
115+
72116
err.span_label(sp, &format!("found `{}`", found));
73117
err.span_label(trait_sp, &format!("expected `{}`", expected));
74118

@@ -96,15 +140,8 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
96140
);
97141
}
98142

99-
if let Some((expected, found)) =
100-
self.infcx.expected_found_str_ty(ExpectedFound { expected, found })
101-
{
102-
// Highlighted the differences when showing the "expected/found" note.
103-
err.note_expected_found(&"", expected, &"", found);
104-
} else {
105-
// This fallback shouldn't be necessary, but let's keep it in just in case.
106-
err.note(&format!("expected `{}`\n found `{}`", expected, found));
107-
}
143+
err.note(&format!("expected `{}`\n found `{}`", expected, found));
144+
108145
err.span_help(
109146
type_param_span,
110147
"the lifetime requirements from the `impl` do not correspond to the requirements in \

compiler/rustc_interface/src/interface.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ pub fn parse_cfgspecs(cfgspecs: Vec<String>) -> FxHashSet<(String, Option<String
7575
let cfg = cfgspecs
7676
.into_iter()
7777
.map(|s| {
78-
let sess = ParseSess::with_silent_emitter();
78+
let sess = ParseSess::with_silent_emitter(Some(format!(
79+
"this error occurred on the command line: `--cfg={}`",
80+
s
81+
)));
7982
let filename = FileName::cfg_spec_source_code(&s);
8083
let mut parser = new_parser_from_source_str(&sess, filename, s.to_string());
8184

compiler/rustc_interface/src/tests.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ use rustc_errors::{emitter::HumanReadableErrorType, registry, ColorConfig};
55
use rustc_session::config::InstrumentCoverage;
66
use rustc_session::config::Strip;
77
use rustc_session::config::{build_configuration, build_session_options, to_crate_config};
8-
use rustc_session::config::{rustc_optgroups, ErrorOutputType, ExternLocation, Options, Passes};
8+
use rustc_session::config::{
9+
rustc_optgroups, ErrorOutputType, ExternLocation, LocationDetail, Options, Passes,
10+
};
911
use rustc_session::config::{CFGuard, ExternEntry, LinkerPluginLto, LtoCli, SwitchWithOptPath};
1012
use rustc_session::config::{
1113
Externs, OutputType, OutputTypes, SymbolManglingVersion, WasiExecModel,
@@ -733,6 +735,7 @@ fn test_debugging_options_tracking_hash() {
733735
tracked!(instrument_mcount, true);
734736
tracked!(link_only, true);
735737
tracked!(llvm_plugins, vec![String::from("plugin_name")]);
738+
tracked!(location_detail, LocationDetail { file: true, line: false, column: false });
736739
tracked!(merge_functions, Some(MergeFunctions::Disabled));
737740
tracked!(mir_emit_retag, true);
738741
tracked!(mir_opt_level, Some(4));

0 commit comments

Comments
 (0)