Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 1d0a389

Browse files
committed
Auto merge of rust-lang#119987 - matthiaskrgr:rollup-f7lkx4w, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - rust-lang#119818 (Silence some follow-up errors [3/x]) - rust-lang#119870 (std: Doc blocking behavior of LazyLock) - rust-lang#119897 (`OutputTypeParameterMismatch` -> `SignatureMismatch`) - rust-lang#119963 (Fix `allow_internal_unstable` for `(min_)specialization`) - rust-lang#119971 (Use `zip_eq` to enforce that things being zipped have equal sizes) - rust-lang#119974 (Minor `trimmed_def_paths` improvements) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 1ead476 + 82f38ab commit 1d0a389

File tree

41 files changed

+230
-213
lines changed

Some content is hidden

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

41 files changed

+230
-213
lines changed

Cargo.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3879,6 +3879,7 @@ dependencies = [
38793879
name = "rustc_hir_analysis"
38803880
version = "0.0.0"
38813881
dependencies = [
3882+
"itertools",
38823883
"rustc_arena",
38833884
"rustc_ast",
38843885
"rustc_attr",
@@ -3917,6 +3918,7 @@ dependencies = [
39173918
name = "rustc_hir_typeck"
39183919
version = "0.0.0"
39193920
dependencies = [
3921+
"itertools",
39203922
"rustc_ast",
39213923
"rustc_attr",
39223924
"rustc_data_structures",
@@ -4200,6 +4202,7 @@ name = "rustc_mir_build"
42004202
version = "0.0.0"
42014203
dependencies = [
42024204
"either",
4205+
"itertools",
42034206
"rustc_apfloat",
42044207
"rustc_arena",
42054208
"rustc_ast",

compiler/rustc_borrowck/src/diagnostics/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
12151215
Applicability::MaybeIncorrect,
12161216
);
12171217
for error in errors {
1218-
if let FulfillmentErrorCode::CodeSelectionError(
1218+
if let FulfillmentErrorCode::SelectionError(
12191219
SelectionError::Unimplemented,
12201220
) = error.code
12211221
&& let ty::PredicateKind::Clause(ty::ClauseKind::Trait(

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1291,7 +1291,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
12911291
}
12921292
// The type doesn't implement Clone because of unmet obligations.
12931293
for error in errors {
1294-
if let traits::FulfillmentErrorCode::CodeSelectionError(
1294+
if let traits::FulfillmentErrorCode::SelectionError(
12951295
traits::SelectionError::Unimplemented,
12961296
) = error.code
12971297
&& let ty::PredicateKind::Clause(ty::ClauseKind::Trait(

compiler/rustc_borrowck/src/type_check/input_output.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//! `RETURN_PLACE` the MIR arguments) are always fully normalized (and
88
//! contain revealed `impl Trait` values).
99
10+
use itertools::Itertools;
1011
use rustc_infer::infer::BoundRegionConversionTime;
1112
use rustc_middle::mir::*;
1213
use rustc_middle::ty::{self, Ty};
@@ -39,9 +40,15 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
3940
user_provided_sig,
4041
);
4142

42-
for (&user_ty, arg_decl) in user_provided_sig.inputs().iter().zip(
43-
// In MIR, closure args begin with an implicit `self`. Skip it!
44-
body.args_iter().skip(1).map(|local| &body.local_decls[local]),
43+
let is_coroutine_with_implicit_resume_ty = self.tcx().is_coroutine(mir_def_id.to_def_id())
44+
&& user_provided_sig.inputs().is_empty();
45+
46+
for (&user_ty, arg_decl) in user_provided_sig.inputs().iter().zip_eq(
47+
// In MIR, closure args begin with an implicit `self`.
48+
// Also, coroutines have a resume type which may be implicitly `()`.
49+
body.args_iter()
50+
.skip(1 + if is_coroutine_with_implicit_resume_ty { 1 } else { 0 })
51+
.map(|local| &body.local_decls[local]),
4552
) {
4653
self.ascribe_user_type_skip_wf(
4754
arg_decl.ty,

compiler/rustc_driver_impl/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use rustc_lint::unerased_lint_store;
3535
use rustc_metadata::creader::MetadataLoader;
3636
use rustc_metadata::locator;
3737
use rustc_session::config::{nightly_options, CG_OPTIONS, Z_OPTIONS};
38-
use rustc_session::config::{ErrorOutputType, Input, OutFileName, OutputType, TrimmedDefPaths};
38+
use rustc_session::config::{ErrorOutputType, Input, OutFileName, OutputType};
3939
use rustc_session::getopts::{self, Matches};
4040
use rustc_session::lint::{Lint, LintId};
4141
use rustc_session::{config, EarlyDiagCtxt, Session};
@@ -204,7 +204,7 @@ impl Callbacks for TimePassesCallbacks {
204204
//
205205
self.time_passes = (config.opts.prints.is_empty() && config.opts.unstable_opts.time_passes)
206206
.then(|| config.opts.unstable_opts.time_passes_format);
207-
config.opts.trimmed_def_paths = TrimmedDefPaths::GoodPath;
207+
config.opts.trimmed_def_paths = true;
208208
}
209209
}
210210

compiler/rustc_hir_analysis/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ doctest = false
99

1010
[dependencies]
1111
# tidy-alphabetical-start
12+
itertools = "0.11"
1213
rustc_arena = { path = "../rustc_arena" }
1314
rustc_ast = { path = "../rustc_ast" }
1415
rustc_attr = { path = "../rustc_attr" }

compiler/rustc_hir_analysis/src/variance/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
//!
44
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/variance.html
55
6+
use itertools::Itertools;
67
use rustc_arena::DroplessArena;
78
use rustc_hir::def::DefKind;
89
use rustc_hir::def_id::{DefId, LocalDefId};
@@ -91,7 +92,7 @@ fn variance_of_opaque(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Varianc
9192
fn visit_opaque(&mut self, def_id: DefId, args: GenericArgsRef<'tcx>) -> ControlFlow<!> {
9293
if def_id != self.root_def_id && self.tcx.is_descendant_of(def_id, self.root_def_id) {
9394
let child_variances = self.tcx.variances_of(def_id);
94-
for (a, v) in args.iter().zip(child_variances) {
95+
for (a, v) in args.iter().zip_eq(child_variances) {
9596
if *v != ty::Bivariant {
9697
a.visit_with(self)?;
9798
}

compiler/rustc_hir_typeck/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ edition = "2021"
55

66
[dependencies]
77
# tidy-alphabetical-start
8+
itertools = "0.11"
89
rustc_ast = { path = "../rustc_ast" }
910
rustc_attr = { path = "../rustc_attr" }
1011
rustc_data_structures = { path = "../rustc_data_structures" }

compiler/rustc_hir_typeck/src/autoderef.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
use super::method::MethodCallee;
33
use super::{FnCtxt, PlaceOp};
44

5+
use itertools::Itertools;
56
use rustc_hir_analysis::autoderef::{Autoderef, AutoderefKind};
67
use rustc_infer::infer::InferOk;
78
use rustc_middle::ty::adjustment::{Adjust, Adjustment, OverloadedDeref};
@@ -32,8 +33,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
3233
&self,
3334
autoderef: &Autoderef<'a, 'tcx>,
3435
) -> InferOk<'tcx, Vec<Adjustment<'tcx>>> {
35-
let mut obligations = vec![];
3636
let steps = autoderef.steps();
37+
if steps.is_empty() {
38+
return InferOk { obligations: vec![], value: vec![] };
39+
}
40+
41+
let mut obligations = vec![];
3742
let targets =
3843
steps.iter().skip(1).map(|&(ty, _)| ty).chain(iter::once(autoderef.final_ty(false)));
3944
let steps: Vec<_> = steps
@@ -54,7 +59,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
5459
None
5560
}
5661
})
57-
.zip(targets)
62+
.zip_eq(targets)
5863
.map(|(autoderef, target)| Adjustment { kind: Adjust::Deref(autoderef), target })
5964
.collect();
6065

compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
8686
// Finally, for ambiguity-related errors, we actually want to look
8787
// for a parameter that is the source of the inference type left
8888
// over in this predicate.
89-
if let traits::FulfillmentErrorCode::CodeAmbiguity { .. } = error.code {
89+
if let traits::FulfillmentErrorCode::Ambiguity { .. } = error.code {
9090
fallback_param_to_point_at = None;
9191
self_param_to_point_at = None;
9292
param_to_point_at =
@@ -361,10 +361,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
361361
error: &traits::FulfillmentError<'tcx>,
362362
span: Span,
363363
) -> bool {
364-
if let traits::FulfillmentErrorCode::CodeSelectionError(
365-
traits::SelectionError::OutputTypeParameterMismatch(
366-
box traits::SelectionOutputTypeParameterMismatch { expected_trait_ref, .. },
367-
),
364+
if let traits::FulfillmentErrorCode::SelectionError(
365+
traits::SelectionError::SignatureMismatch(box traits::SignatureMismatchData {
366+
expected_trait_ref,
367+
..
368+
}),
368369
) = error.code
369370
&& let ty::Closure(def_id, _) | ty::Coroutine(def_id, ..) =
370371
expected_trait_ref.skip_binder().self_ty().kind()

0 commit comments

Comments
 (0)