Skip to content

Commit a43b8d1

Browse files
committed
Auto merge of rust-lang#141113 - matthiaskrgr:rollup-k7izuh8, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang#140208 (Make well-formedness predicates no longer coinductive) - rust-lang#140957 (Add `#[must_use]` to Array::map) - rust-lang#141031 (Async drop fix for dropee from another crate (rust-lang#140858)) - rust-lang#141036 (ci: split the dist-ohos job) - rust-lang#141051 (Remove some unnecessary erases) - rust-lang#141056 (Lowercase git url for rust-lang/enzyme.git) - rust-lang#141059 (HIR: explain in comment why `ExprKind::If` "then" is an `Expr`) - rust-lang#141070 (Do not emit help when shorthand from macro when suggest `?` or `expect`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents b0e9259 + 14f3ef9 commit a43b8d1

37 files changed

+327
-58
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
shallow = true
4646
[submodule "src/tools/enzyme"]
4747
path = src/tools/enzyme
48-
url = https://github.com/rust-lang/Enzyme.git
48+
url = https://github.com/rust-lang/enzyme.git
4949
shallow = true
5050
[submodule "src/gcc"]
5151
path = src/gcc

compiler/rustc_hir/src/hir.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2744,6 +2744,8 @@ pub enum ExprKind<'hir> {
27442744
///
27452745
/// The "then" expr is always `ExprKind::Block`. If present, the "else" expr is always
27462746
/// `ExprKind::Block` (for `else`) or `ExprKind::If` (for `else if`).
2747+
/// Note that using an `Expr` instead of a `Block` for the "then" part is intentional,
2748+
/// as it simplifies the type coercion machinery.
27472749
If(&'hir Expr<'hir>, &'hir Expr<'hir>, Option<&'hir Expr<'hir>>),
27482750
/// A conditionless loop (can be exited with `break`, `continue`, or `return`).
27492751
///

compiler/rustc_hir_typeck/src/cast.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -490,11 +490,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
490490
&& let Some(from_trait) = fcx.tcx.get_diagnostic_item(sym::From)
491491
{
492492
let ty = fcx.resolve_vars_if_possible(self.cast_ty);
493-
// Erase regions to avoid panic in `prove_value` when calling
494-
// `type_implements_trait`.
495-
let ty = fcx.tcx.erase_regions(ty);
496493
let expr_ty = fcx.resolve_vars_if_possible(self.expr_ty);
497-
let expr_ty = fcx.tcx.erase_regions(expr_ty);
498494
if fcx
499495
.infcx
500496
.type_implements_trait(from_trait, [ty, expr_ty], fcx.param_env)

compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,6 +2043,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
20432043
};
20442044

20452045
let sugg = match self.tcx.hir_maybe_get_struct_pattern_shorthand_field(expr) {
2046+
Some(_) if expr.span.from_expansion() => return false,
20462047
Some(ident) => format!(": {ident}{sugg}"),
20472048
None => sugg.to_string(),
20482049
};

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ pub struct Destructor {
11851185
#[derive(Copy, Clone, Debug, HashStable, Encodable, Decodable)]
11861186
pub struct AsyncDestructor {
11871187
/// The `DefId` of the `impl AsyncDrop`
1188-
pub impl_did: LocalDefId,
1188+
pub impl_did: DefId,
11891189
}
11901190

11911191
#[derive(Clone, Copy, PartialEq, Eq, HashStable, TyEncodable, TyDecodable)]

compiler/rustc_middle/src/ty/print/pretty.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,9 +1453,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
14531453
// contain named regions. So we erase and anonymize everything
14541454
// here to compare the types modulo regions below.
14551455
let proj = cx.tcx().erase_regions(proj);
1456-
let proj = cx.tcx().anonymize_bound_vars(proj);
14571456
let super_proj = cx.tcx().erase_regions(super_proj);
1458-
let super_proj = cx.tcx().anonymize_bound_vars(super_proj);
14591457

14601458
proj == super_proj
14611459
});

compiler/rustc_middle/src/ty/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ impl<'tcx> TyCtxt<'tcx> {
465465
dtor_candidate = Some(impl_did);
466466
}
467467

468-
Some(ty::AsyncDestructor { impl_did: dtor_candidate? })
468+
Some(ty::AsyncDestructor { impl_did: dtor_candidate?.into() })
469469
}
470470

471471
/// Returns the set of types that are required to be alive in

compiler/rustc_mir_transform/src/add_subtyping_projections.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for SubTypeChecker<'a, 'tcx> {
3232
let mut rval_ty = rvalue.ty(self.local_decls, self.tcx);
3333
// Not erasing this causes `Free Regions` errors in validator,
3434
// when rval is `ReStatic`.
35-
rval_ty = self.tcx.erase_regions_ty(rval_ty);
35+
rval_ty = self.tcx.erase_regions(rval_ty);
3636
place_ty = self.tcx.erase_regions(place_ty);
3737
if place_ty != rval_ty {
3838
let temp = self

compiler/rustc_trait_selection/src/traits/select/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
12411241
ty::PredicateKind::Clause(ty::ClauseKind::Trait(data)) => {
12421242
self.infcx.tcx.trait_is_coinductive(data.def_id())
12431243
}
1244-
ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_)) => true,
1244+
ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_)) => {
1245+
// FIXME(generic_const_exprs): GCE needs well-formedness predicates to be
1246+
// coinductive, but GCE is on the way out anyways, so this should eventually
1247+
// be replaced with `false`.
1248+
self.infcx.tcx.features().generic_const_exprs()
1249+
}
12451250
_ => false,
12461251
})
12471252
}

library/core/src/array/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ impl<T, const N: usize> [T; N] {
531531
/// let y = x.map(|v| v.len());
532532
/// assert_eq!(y, [6, 9, 3, 3]);
533533
/// ```
534+
#[must_use]
534535
#[stable(feature = "array_map", since = "1.55.0")]
535536
pub fn map<F, U>(self, f: F) -> [U; N]
536537
where

0 commit comments

Comments
 (0)