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

library/coretests/tests/array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ fn array_map_drop_safety() {
325325
let success = std::panic::catch_unwind(|| {
326326
let items = [0; 10];
327327
let mut nth = 0;
328-
items.map(|_| {
328+
let _ = items.map(|_| {
329329
assert!(nth < num_to_create);
330330
nth += 1;
331331
DropCounter

src/ci/docker/host-x86_64/dist-ohos/Dockerfile renamed to src/ci/docker/host-x86_64/dist-ohos-aarch64/Dockerfile

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,36 +27,18 @@ RUN sh /scripts/ohos-openssl.sh
2727

2828
COPY scripts/ohos/aarch64-unknown-linux-ohos-clang.sh /usr/local/bin/
2929
COPY scripts/ohos/aarch64-unknown-linux-ohos-clang++.sh /usr/local/bin/
30-
COPY scripts/ohos/armv7-unknown-linux-ohos-clang.sh /usr/local/bin/
31-
COPY scripts/ohos/armv7-unknown-linux-ohos-clang++.sh /usr/local/bin/
32-
COPY scripts/ohos/x86_64-unknown-linux-ohos-clang.sh /usr/local/bin/
33-
COPY scripts/ohos/x86_64-unknown-linux-ohos-clang++.sh /usr/local/bin/
3430

3531
# env
3632
ENV AARCH64_UNKNOWN_LINUX_OHOS_OPENSSL_DIR=/opt/ohos-openssl/prelude/arm64-v8a
37-
ENV ARMV7_UNKNOWN_LINUX_OHOS_OPENSSL_DIR=/opt/ohos-openssl/prelude/armeabi-v7a
38-
ENV X86_64_UNKNOWN_LINUX_OHOS_OPENSSL_DIR=/opt/ohos-openssl/prelude/x86_64
3933

4034
ENV AARCH64_UNKNOWN_LINUX_OHOS_OPENSSL_NO_VENDOR=1
41-
ENV ARMV7_UNKNOWN_LINUX_OHOS_OPENSSL_NO_VENDOR=1
42-
ENV X86_64_UNKNOWN_LINUX_OHOS_OPENSSL_NO_VENDOR=1
4335

4436
ENV TARGETS=aarch64-unknown-linux-ohos
45-
ENV TARGETS=$TARGETS,armv7-unknown-linux-ohos
46-
ENV TARGETS=$TARGETS,x86_64-unknown-linux-ohos
4737

4838
ENV \
4939
CC_aarch64_unknown_linux_ohos=/usr/local/bin/aarch64-unknown-linux-ohos-clang.sh \
5040
AR_aarch64_unknown_linux_ohos=/opt/ohos-sdk/native/llvm/bin/llvm-ar \
5141
CXX_aarch64_unknown_linux_ohos=/usr/local/bin/aarch64-unknown-linux-ohos-clang++.sh
52-
ENV \
53-
CC_armv7_unknown_linux_ohos=/usr/local/bin/armv7-unknown-linux-ohos-clang.sh \
54-
AR_armv7_unknown_linux_ohos=/opt/ohos-sdk/native/llvm/bin/llvm-ar \
55-
CXX_armv7_unknown_linux_ohos=/usr/local/bin/armv7-unknown-linux-ohos-clang++.sh
56-
ENV \
57-
CC_x86_64_unknown_linux_ohos=/usr/local/bin/x86_64-unknown-linux-ohos-clang.sh \
58-
AR_x86_64_unknown_linux_ohos=/opt/ohos-sdk/native/llvm/bin/llvm-ar \
59-
CXX_x86_64_unknown_linux_ohos=/usr/local/bin/x86_64-unknown-linux-ohos-clang++.sh
6042

6143
ENV RUST_CONFIGURE_ARGS \
6244
--enable-profiler \
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
FROM ubuntu:24.04
2+
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
RUN apt-get update && apt-get install -y --no-install-recommends \
5+
g++ \
6+
make \
7+
ninja-build \
8+
file \
9+
curl \
10+
ca-certificates \
11+
python3 \
12+
git \
13+
cmake \
14+
sudo \
15+
gdb \
16+
libssl-dev \
17+
pkg-config \
18+
xz-utils \
19+
unzip \
20+
&& rm -rf /var/lib/apt/lists/*
21+
22+
COPY scripts/ohos-sdk.sh /scripts/
23+
RUN sh /scripts/ohos-sdk.sh
24+
25+
COPY scripts/ohos-openssl.sh /scripts/
26+
RUN sh /scripts/ohos-openssl.sh
27+
28+
COPY scripts/ohos/armv7-unknown-linux-ohos-clang.sh /usr/local/bin/
29+
COPY scripts/ohos/armv7-unknown-linux-ohos-clang++.sh /usr/local/bin/
30+
31+
# env
32+
ENV ARMV7_UNKNOWN_LINUX_OHOS_OPENSSL_DIR=/opt/ohos-openssl/prelude/armeabi-v7a
33+
34+
ENV ARMV7_UNKNOWN_LINUX_OHOS_OPENSSL_NO_VENDOR=1
35+
36+
ENV TARGETS=armv7-unknown-linux-ohos
37+
38+
ENV \
39+
CC_armv7_unknown_linux_ohos=/usr/local/bin/armv7-unknown-linux-ohos-clang.sh \
40+
AR_armv7_unknown_linux_ohos=/opt/ohos-sdk/native/llvm/bin/llvm-ar \
41+
CXX_armv7_unknown_linux_ohos=/usr/local/bin/armv7-unknown-linux-ohos-clang++.sh
42+
43+
ENV RUST_CONFIGURE_ARGS \
44+
--enable-profiler \
45+
--disable-docs \
46+
--tools=cargo,clippy,rustdocs,rustfmt,rust-analyzer,rust-analyzer-proc-macro-srv,analysis,src,wasm-component-ld \
47+
--enable-extended \
48+
--enable-sanitizers
49+
50+
ENV SCRIPT python3 ../x.py dist --host=$TARGETS --target $TARGETS
51+
52+
COPY scripts/sccache.sh /scripts/
53+
RUN sh /scripts/sccache.sh
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
FROM ubuntu:24.04
2+
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
RUN apt-get update && apt-get install -y --no-install-recommends \
5+
g++ \
6+
make \
7+
ninja-build \
8+
file \
9+
curl \
10+
ca-certificates \
11+
python3 \
12+
git \
13+
cmake \
14+
sudo \
15+
gdb \
16+
libssl-dev \
17+
pkg-config \
18+
xz-utils \
19+
unzip \
20+
&& rm -rf /var/lib/apt/lists/*
21+
22+
COPY scripts/ohos-sdk.sh /scripts/
23+
RUN sh /scripts/ohos-sdk.sh
24+
25+
COPY scripts/ohos-openssl.sh /scripts/
26+
RUN sh /scripts/ohos-openssl.sh
27+
28+
COPY scripts/ohos/x86_64-unknown-linux-ohos-clang.sh /usr/local/bin/
29+
COPY scripts/ohos/x86_64-unknown-linux-ohos-clang++.sh /usr/local/bin/
30+
31+
# env
32+
ENV X86_64_UNKNOWN_LINUX_OHOS_OPENSSL_DIR=/opt/ohos-openssl/prelude/x86_64
33+
34+
ENV X86_64_UNKNOWN_LINUX_OHOS_OPENSSL_NO_VENDOR=1
35+
36+
ENV TARGETS=x86_64-unknown-linux-ohos
37+
38+
ENV \
39+
CC_x86_64_unknown_linux_ohos=/usr/local/bin/x86_64-unknown-linux-ohos-clang.sh \
40+
AR_x86_64_unknown_linux_ohos=/opt/ohos-sdk/native/llvm/bin/llvm-ar \
41+
CXX_x86_64_unknown_linux_ohos=/usr/local/bin/x86_64-unknown-linux-ohos-clang++.sh
42+
43+
ENV RUST_CONFIGURE_ARGS \
44+
--enable-profiler \
45+
--disable-docs \
46+
--tools=cargo,clippy,rustdocs,rustfmt,rust-analyzer,rust-analyzer-proc-macro-srv,analysis,src,wasm-component-ld \
47+
--enable-extended \
48+
--enable-sanitizers
49+
50+
ENV SCRIPT python3 ../x.py dist --host=$TARGETS --target $TARGETS
51+
52+
COPY scripts/sccache.sh /scripts/
53+
RUN sh /scripts/sccache.sh

src/ci/github-actions/jobs.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,14 @@ auto:
188188
- name: dist-loongarch64-musl
189189
<<: *job-linux-4c
190190

191-
- name: dist-ohos
192-
<<: *job-linux-4c-largedisk
191+
- name: dist-ohos-aarch64
192+
<<: *job-linux-4c
193+
194+
- name: dist-ohos-armv7
195+
<<: *job-linux-4c
196+
197+
- name: dist-ohos-x86_64
198+
<<: *job-linux-4c
193199

194200
- name: dist-powerpc-linux
195201
<<: *job-linux-4c

tests/crashes/123456.rs

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
//@ check-pass
1+
// This was originally a test for a `ReEmpty` ICE, but became an unintentional test of
2+
// the coinductiveness of WF predicates. That behavior was removed, and thus this is
3+
// also inadvertently a test for the (non-)co-inductiveness of WF predicates.
24

35
pub struct Bar<'a>(&'a Self) where Self: ;
6+
//~^ ERROR overflow evaluating the requirement `Bar<'a> well-formed`
47

58
fn main() {}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0275]: overflow evaluating the requirement `Bar<'a> well-formed`
2+
--> $DIR/issue-64855-2.rs:5:36
3+
|
4+
LL | pub struct Bar<'a>(&'a Self) where Self: ;
5+
| ^^^^
6+
|
7+
note: required by a bound in `Bar`
8+
--> $DIR/issue-64855-2.rs:5:36
9+
|
10+
LL | pub struct Bar<'a>(&'a Self) where Self: ;
11+
| ^^^^ required by this bound in `Bar`
12+
13+
error: aborting due to 1 previous error
14+
15+
For more information about this error, try `rustc --explain E0275`.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
// This was originally a test for a `ReEmpty` ICE, but became an unintentional test of
2+
// the coinductiveness of WF predicates. That behavior was removed, and thus this is
3+
// also inadvertently a test for the (non-)co-inductiveness of WF predicates.
4+
15
pub trait Foo {
26
type Type;
37
}
48

59
pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
610
//~^ ERROR the trait bound `Bar<T>: Foo` is not satisfied
11+
//~| ERROR overflow evaluating the requirement `Bar<T> well-formed`
712

813
fn main() {}
Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
11
error[E0277]: the trait bound `Bar<T>: Foo` is not satisfied
2-
--> $DIR/issue-64855.rs:5:19
2+
--> $DIR/issue-64855.rs:9:19
33
|
44
LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
55
| ^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bar<T>`
66
|
77
help: this trait has no implementations, consider adding one
8-
--> $DIR/issue-64855.rs:1:1
8+
--> $DIR/issue-64855.rs:5:1
99
|
1010
LL | pub trait Foo {
1111
| ^^^^^^^^^^^^^
1212

13-
error: aborting due to 1 previous error
13+
error[E0275]: overflow evaluating the requirement `Bar<T> well-formed`
14+
--> $DIR/issue-64855.rs:9:46
15+
|
16+
LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
17+
| ^^^^
18+
|
19+
note: required by a bound in `Bar`
20+
--> $DIR/issue-64855.rs:9:46
21+
|
22+
LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
23+
| ^^^^ required by this bound in `Bar`
24+
25+
error: aborting due to 2 previous errors
1426

15-
For more information about this error, try `rustc --explain E0277`.
27+
Some errors have detailed explanations: E0275, E0277.
28+
For more information about an error, try `rustc --explain E0275`.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//@ edition:2021
2+
3+
#![feature(async_drop)]
4+
#![allow(incomplete_features)]
5+
6+
pub struct HasDrop;
7+
impl Drop for HasDrop{
8+
fn drop(&mut self) {
9+
println!("Sync drop");
10+
}
11+
}
12+
13+
pub struct MongoDrop;
14+
impl MongoDrop {
15+
pub async fn new() -> Result<Self, HasDrop> {
16+
Ok(Self)
17+
}
18+
}
19+
impl Drop for MongoDrop{
20+
fn drop(&mut self) {
21+
println!("Sync drop");
22+
}
23+
}
24+
impl std::future::AsyncDrop for MongoDrop {
25+
async fn drop(self: std::pin::Pin<&mut Self>) {
26+
println!("Async drop");
27+
}
28+
}

0 commit comments

Comments
 (0)