Skip to content

Rollup of 8 pull requests #141113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
May 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
f918b89
Wf is not coinductive
compiler-errors Apr 28, 2025
38c05a6
Adjust tests
compiler-errors Apr 29, 2025
292ecd5
Remove some unnecessary erases
compiler-errors May 8, 2025
ab1c49a
Add `#[must_use]` to Array::map
JulianKnodt May 13, 2025
7b2dcf2
Async drop fix for dropee from another crate (#140858)
azhogin May 15, 2025
839534e
ci: split the dist-ohos job
marcoieni May 15, 2025
a64ed16
Lowercase git url for rust-lang/enzyme.git
erickt May 15, 2025
cf878d8
HIR: explain in comment why `ExprKind::If` "then" is an `Expr`
samueltardieu May 15, 2025
43ff885
Add ui test macro-shorthand-issue-140659
xizheyin May 16, 2025
742c27b
Do not emit help when shorthand from macro when suggest `?` or `expect`
xizheyin May 16, 2025
1c17324
Create tests/ui/typeck/suggestions/ and move some tests in tests/ui/t…
xizheyin May 16, 2025
8c14588
Rollup merge of #140208 - compiler-errors:wf-coinductive, r=lcnr
matthiaskrgr May 17, 2025
642cd65
Rollup merge of #140957 - JulianKnodt:array_must_use, r=Mark-Simulacrum
matthiaskrgr May 17, 2025
04bc9d1
Rollup merge of #141031 - azhogin:azhogin/async-drop-dependency-fix, …
matthiaskrgr May 17, 2025
0031282
Rollup merge of #141036 - marcoieni:split-dist-ohos, r=Kobzol
matthiaskrgr May 17, 2025
8e30998
Rollup merge of #141051 - compiler-errors:less-erase, r=nnethercote
matthiaskrgr May 17, 2025
4c52b5d
Rollup merge of #141056 - erickt:enzyme, r=Mark-Simulacrum
matthiaskrgr May 17, 2025
59ad0cb
Rollup merge of #141059 - samueltardieu:push-trvpulpskwwp, r=compiler…
matthiaskrgr May 17, 2025
14f3ef9
Rollup merge of #141070 - xizheyin:issue-140659, r=chenyukang
matthiaskrgr May 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
shallow = true
[submodule "src/tools/enzyme"]
path = src/tools/enzyme
url = https://github.com/rust-lang/Enzyme.git
url = https://github.com/rust-lang/enzyme.git
shallow = true
[submodule "src/gcc"]
path = src/gcc
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2744,6 +2744,8 @@ pub enum ExprKind<'hir> {
///
/// The "then" expr is always `ExprKind::Block`. If present, the "else" expr is always
/// `ExprKind::Block` (for `else`) or `ExprKind::If` (for `else if`).
/// Note that using an `Expr` instead of a `Block` for the "then" part is intentional,
/// as it simplifies the type coercion machinery.
If(&'hir Expr<'hir>, &'hir Expr<'hir>, Option<&'hir Expr<'hir>>),
/// A conditionless loop (can be exited with `break`, `continue`, or `return`).
///
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_hir_typeck/src/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,11 +490,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
&& let Some(from_trait) = fcx.tcx.get_diagnostic_item(sym::From)
{
let ty = fcx.resolve_vars_if_possible(self.cast_ty);
// Erase regions to avoid panic in `prove_value` when calling
// `type_implements_trait`.
let ty = fcx.tcx.erase_regions(ty);
let expr_ty = fcx.resolve_vars_if_possible(self.expr_ty);
let expr_ty = fcx.tcx.erase_regions(expr_ty);
if fcx
.infcx
.type_implements_trait(from_trait, [ty, expr_ty], fcx.param_env)
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2043,6 +2043,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
};

let sugg = match self.tcx.hir_maybe_get_struct_pattern_shorthand_field(expr) {
Some(_) if expr.span.from_expansion() => return false,
Some(ident) => format!(": {ident}{sugg}"),
None => sugg.to_string(),
};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ pub struct Destructor {
#[derive(Copy, Clone, Debug, HashStable, Encodable, Decodable)]
pub struct AsyncDestructor {
/// The `DefId` of the `impl AsyncDrop`
pub impl_did: LocalDefId,
pub impl_did: DefId,
}

#[derive(Clone, Copy, PartialEq, Eq, HashStable, TyEncodable, TyDecodable)]
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_middle/src/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1453,9 +1453,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
// contain named regions. So we erase and anonymize everything
// here to compare the types modulo regions below.
let proj = cx.tcx().erase_regions(proj);
let proj = cx.tcx().anonymize_bound_vars(proj);
let super_proj = cx.tcx().erase_regions(super_proj);
let super_proj = cx.tcx().anonymize_bound_vars(super_proj);

proj == super_proj
});
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ impl<'tcx> TyCtxt<'tcx> {
dtor_candidate = Some(impl_did);
}

Some(ty::AsyncDestructor { impl_did: dtor_candidate? })
Some(ty::AsyncDestructor { impl_did: dtor_candidate?.into() })
}

/// Returns the set of types that are required to be alive in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for SubTypeChecker<'a, 'tcx> {
let mut rval_ty = rvalue.ty(self.local_decls, self.tcx);
// Not erasing this causes `Free Regions` errors in validator,
// when rval is `ReStatic`.
rval_ty = self.tcx.erase_regions_ty(rval_ty);
rval_ty = self.tcx.erase_regions(rval_ty);
place_ty = self.tcx.erase_regions(place_ty);
if place_ty != rval_ty {
let temp = self
Expand Down
7 changes: 6 additions & 1 deletion compiler/rustc_trait_selection/src/traits/select/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
ty::PredicateKind::Clause(ty::ClauseKind::Trait(data)) => {
self.infcx.tcx.trait_is_coinductive(data.def_id())
}
ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_)) => true,
ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_)) => {
// FIXME(generic_const_exprs): GCE needs well-formedness predicates to be
// coinductive, but GCE is on the way out anyways, so this should eventually
// be replaced with `false`.
self.infcx.tcx.features().generic_const_exprs()
}
_ => false,
})
}
Expand Down
1 change: 1 addition & 0 deletions library/core/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ impl<T, const N: usize> [T; N] {
/// let y = x.map(|v| v.len());
/// assert_eq!(y, [6, 9, 3, 3]);
/// ```
#[must_use]
#[stable(feature = "array_map", since = "1.55.0")]
pub fn map<F, U>(self, f: F) -> [U; N]
where
Expand Down
2 changes: 1 addition & 1 deletion library/coretests/tests/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ fn array_map_drop_safety() {
let success = std::panic::catch_unwind(|| {
let items = [0; 10];
let mut nth = 0;
items.map(|_| {
let _ = items.map(|_| {
assert!(nth < num_to_create);
nth += 1;
DropCounter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,18 @@ RUN sh /scripts/ohos-openssl.sh

COPY scripts/ohos/aarch64-unknown-linux-ohos-clang.sh /usr/local/bin/
COPY scripts/ohos/aarch64-unknown-linux-ohos-clang++.sh /usr/local/bin/
COPY scripts/ohos/armv7-unknown-linux-ohos-clang.sh /usr/local/bin/
COPY scripts/ohos/armv7-unknown-linux-ohos-clang++.sh /usr/local/bin/
COPY scripts/ohos/x86_64-unknown-linux-ohos-clang.sh /usr/local/bin/
COPY scripts/ohos/x86_64-unknown-linux-ohos-clang++.sh /usr/local/bin/

# env
ENV AARCH64_UNKNOWN_LINUX_OHOS_OPENSSL_DIR=/opt/ohos-openssl/prelude/arm64-v8a
ENV ARMV7_UNKNOWN_LINUX_OHOS_OPENSSL_DIR=/opt/ohos-openssl/prelude/armeabi-v7a
ENV X86_64_UNKNOWN_LINUX_OHOS_OPENSSL_DIR=/opt/ohos-openssl/prelude/x86_64

ENV AARCH64_UNKNOWN_LINUX_OHOS_OPENSSL_NO_VENDOR=1
ENV ARMV7_UNKNOWN_LINUX_OHOS_OPENSSL_NO_VENDOR=1
ENV X86_64_UNKNOWN_LINUX_OHOS_OPENSSL_NO_VENDOR=1

ENV TARGETS=aarch64-unknown-linux-ohos
ENV TARGETS=$TARGETS,armv7-unknown-linux-ohos
ENV TARGETS=$TARGETS,x86_64-unknown-linux-ohos

ENV \
CC_aarch64_unknown_linux_ohos=/usr/local/bin/aarch64-unknown-linux-ohos-clang.sh \
AR_aarch64_unknown_linux_ohos=/opt/ohos-sdk/native/llvm/bin/llvm-ar \
CXX_aarch64_unknown_linux_ohos=/usr/local/bin/aarch64-unknown-linux-ohos-clang++.sh
ENV \
CC_armv7_unknown_linux_ohos=/usr/local/bin/armv7-unknown-linux-ohos-clang.sh \
AR_armv7_unknown_linux_ohos=/opt/ohos-sdk/native/llvm/bin/llvm-ar \
CXX_armv7_unknown_linux_ohos=/usr/local/bin/armv7-unknown-linux-ohos-clang++.sh
ENV \
CC_x86_64_unknown_linux_ohos=/usr/local/bin/x86_64-unknown-linux-ohos-clang.sh \
AR_x86_64_unknown_linux_ohos=/opt/ohos-sdk/native/llvm/bin/llvm-ar \
CXX_x86_64_unknown_linux_ohos=/usr/local/bin/x86_64-unknown-linux-ohos-clang++.sh

ENV RUST_CONFIGURE_ARGS \
--enable-profiler \
Expand Down
53 changes: 53 additions & 0 deletions src/ci/docker/host-x86_64/dist-ohos-armv7/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM ubuntu:24.04

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
python3 \
git \
cmake \
sudo \
gdb \
libssl-dev \
pkg-config \
xz-utils \
unzip \
&& rm -rf /var/lib/apt/lists/*

COPY scripts/ohos-sdk.sh /scripts/
RUN sh /scripts/ohos-sdk.sh

COPY scripts/ohos-openssl.sh /scripts/
RUN sh /scripts/ohos-openssl.sh

COPY scripts/ohos/armv7-unknown-linux-ohos-clang.sh /usr/local/bin/
COPY scripts/ohos/armv7-unknown-linux-ohos-clang++.sh /usr/local/bin/

# env
ENV ARMV7_UNKNOWN_LINUX_OHOS_OPENSSL_DIR=/opt/ohos-openssl/prelude/armeabi-v7a

ENV ARMV7_UNKNOWN_LINUX_OHOS_OPENSSL_NO_VENDOR=1

ENV TARGETS=armv7-unknown-linux-ohos

ENV \
CC_armv7_unknown_linux_ohos=/usr/local/bin/armv7-unknown-linux-ohos-clang.sh \
AR_armv7_unknown_linux_ohos=/opt/ohos-sdk/native/llvm/bin/llvm-ar \
CXX_armv7_unknown_linux_ohos=/usr/local/bin/armv7-unknown-linux-ohos-clang++.sh

ENV RUST_CONFIGURE_ARGS \
--enable-profiler \
--disable-docs \
--tools=cargo,clippy,rustdocs,rustfmt,rust-analyzer,rust-analyzer-proc-macro-srv,analysis,src,wasm-component-ld \
--enable-extended \
--enable-sanitizers

ENV SCRIPT python3 ../x.py dist --host=$TARGETS --target $TARGETS

COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
53 changes: 53 additions & 0 deletions src/ci/docker/host-x86_64/dist-ohos-x86_64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM ubuntu:24.04

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
python3 \
git \
cmake \
sudo \
gdb \
libssl-dev \
pkg-config \
xz-utils \
unzip \
&& rm -rf /var/lib/apt/lists/*

COPY scripts/ohos-sdk.sh /scripts/
RUN sh /scripts/ohos-sdk.sh

COPY scripts/ohos-openssl.sh /scripts/
RUN sh /scripts/ohos-openssl.sh

COPY scripts/ohos/x86_64-unknown-linux-ohos-clang.sh /usr/local/bin/
COPY scripts/ohos/x86_64-unknown-linux-ohos-clang++.sh /usr/local/bin/

# env
ENV X86_64_UNKNOWN_LINUX_OHOS_OPENSSL_DIR=/opt/ohos-openssl/prelude/x86_64

ENV X86_64_UNKNOWN_LINUX_OHOS_OPENSSL_NO_VENDOR=1

ENV TARGETS=x86_64-unknown-linux-ohos

ENV \
CC_x86_64_unknown_linux_ohos=/usr/local/bin/x86_64-unknown-linux-ohos-clang.sh \
AR_x86_64_unknown_linux_ohos=/opt/ohos-sdk/native/llvm/bin/llvm-ar \
CXX_x86_64_unknown_linux_ohos=/usr/local/bin/x86_64-unknown-linux-ohos-clang++.sh

ENV RUST_CONFIGURE_ARGS \
--enable-profiler \
--disable-docs \
--tools=cargo,clippy,rustdocs,rustfmt,rust-analyzer,rust-analyzer-proc-macro-srv,analysis,src,wasm-component-ld \
--enable-extended \
--enable-sanitizers

ENV SCRIPT python3 ../x.py dist --host=$TARGETS --target $TARGETS

COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
10 changes: 8 additions & 2 deletions src/ci/github-actions/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,14 @@ auto:
- name: dist-loongarch64-musl
<<: *job-linux-4c

- name: dist-ohos
<<: *job-linux-4c-largedisk
- name: dist-ohos-aarch64
<<: *job-linux-4c

- name: dist-ohos-armv7
<<: *job-linux-4c

- name: dist-ohos-x86_64
<<: *job-linux-4c

- name: dist-powerpc-linux
<<: *job-linux-4c
Expand Down
16 changes: 0 additions & 16 deletions tests/crashes/123456.rs

This file was deleted.

5 changes: 4 additions & 1 deletion tests/ui/associated-types/issue-64855-2.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//@ check-pass
// This was originally a test for a `ReEmpty` ICE, but became an unintentional test of
// the coinductiveness of WF predicates. That behavior was removed, and thus this is
// also inadvertently a test for the (non-)co-inductiveness of WF predicates.

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

fn main() {}
15 changes: 15 additions & 0 deletions tests/ui/associated-types/issue-64855-2.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error[E0275]: overflow evaluating the requirement `Bar<'a> well-formed`
--> $DIR/issue-64855-2.rs:5:36
|
LL | pub struct Bar<'a>(&'a Self) where Self: ;
| ^^^^
|
note: required by a bound in `Bar`
--> $DIR/issue-64855-2.rs:5:36
|
LL | pub struct Bar<'a>(&'a Self) where Self: ;
| ^^^^ required by this bound in `Bar`

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0275`.
5 changes: 5 additions & 0 deletions tests/ui/associated-types/issue-64855.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
// This was originally a test for a `ReEmpty` ICE, but became an unintentional test of
// the coinductiveness of WF predicates. That behavior was removed, and thus this is
// also inadvertently a test for the (non-)co-inductiveness of WF predicates.

pub trait Foo {
type Type;
}

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

fn main() {}
21 changes: 17 additions & 4 deletions tests/ui/associated-types/issue-64855.stderr
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
error[E0277]: the trait bound `Bar<T>: Foo` is not satisfied
--> $DIR/issue-64855.rs:5:19
--> $DIR/issue-64855.rs:9:19
|
LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
| ^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bar<T>`
|
help: this trait has no implementations, consider adding one
--> $DIR/issue-64855.rs:1:1
--> $DIR/issue-64855.rs:5:1
|
LL | pub trait Foo {
| ^^^^^^^^^^^^^

error: aborting due to 1 previous error
error[E0275]: overflow evaluating the requirement `Bar<T> well-formed`
--> $DIR/issue-64855.rs:9:46
|
LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
| ^^^^
|
note: required by a bound in `Bar`
--> $DIR/issue-64855.rs:9:46
|
LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
| ^^^^ required by this bound in `Bar`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.
Some errors have detailed explanations: E0275, E0277.
For more information about an error, try `rustc --explain E0275`.
28 changes: 28 additions & 0 deletions tests/ui/async-await/async-drop/auxiliary/async-drop-dep.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//@ edition:2021

#![feature(async_drop)]
#![allow(incomplete_features)]

pub struct HasDrop;
impl Drop for HasDrop{
fn drop(&mut self) {
println!("Sync drop");
}
}

pub struct MongoDrop;
impl MongoDrop {
pub async fn new() -> Result<Self, HasDrop> {
Ok(Self)
}
}
impl Drop for MongoDrop{
fn drop(&mut self) {
println!("Sync drop");
}
}
impl std::future::AsyncDrop for MongoDrop {
async fn drop(self: std::pin::Pin<&mut Self>) {
println!("Async drop");
}
}
Loading
Loading