Skip to content
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

Rollup of 7 pull requests #128191

Closed
wants to merge 14 commits into from

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

ChrisDenton and others added 14 commits July 20, 2024 08:21
Support ?Trait bounds in supertraits and dyn Trait under a feature gate

This patch allows `maybe` polarity bounds under a feature gate. The only language change here is that corresponding hard errors are replaced by feature gates. Example:
```rust
#![feature(allow_maybe_polarity)]
...
trait Trait1 : ?Trait { ... } // ok
fn foo(_: Box<(dyn Trait2 + ?Trait)>) {} // ok
fn bar<T: ?Sized + ?Trait>(_: &T) {} // ok
```
Maybe bounds still don't do anything (except for `Sized` trait), however this patch will allow us to [experiment with default auto traits](rust-lang#120706 (comment)).

This is a part of the [MCP: Low level components for async drop](rust-lang/compiler-team#727)
…e, r=compiler-errors

Use Cow<'static, str> for InlineAsmTemplatePiece::String

This removes a bunch of `&'static str -> String` allocations in codegen cranelift.
Inject arm32 shims into Windows metadata generation

I had been keen to eventually move to using windows-sys as a normal Cargo dependency. But for linking, compile times and other reasons that's unlikely to ever happen.

So if we're sticking with generated bindings then injecting any necessary missing type definitions (i.e. for the MS unsupported arm32) is simpler than defining whole functions ourselves just because we need to manually implement those types on a tier 3 platform. This also reduces the places we need to change when making changes to how we use `#[link]`.

r? libs
CStr: derive PartialEq, Eq; add test for Ord

While working on rust-lang#128046, I've spotted a peculiarity: `CStr` has `PartialEq, Eq, PartialOrd, Ord` implemented manually and not derived.

While we can't derive `PartialOrd, Ord` (due to inner `[c_char]` being `[i8]` or `[u8]` on different platforms), we *can* derive `PartialEq, Eq` (I think), allowing as to remove `#[allow(clippy::derived_hash_with_manual_eq)]` as well.

(I really hope `c_char: Eq` on all platforms)
…errors

Fix a span error when parsing a wrong param of function.

fixes rust-lang#128042

Before this change, the span of param `*mut Self` in  `fn oof(*mut Self)` contains `(` before it, so the suggestion in E0424 will be error.
…-errors

Turn an unreachable code path into an ICE

We're probably replacing the resolution with a `Res::Err` nowadays instead of just erroring but keeping the `Res`, so this code path should be unreachable
@rustbot rustbot added O-windows Operating system: Windows S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-release Relevant to the release subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Jul 25, 2024
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=7

@bors
Copy link
Contributor

bors commented Jul 25, 2024

📌 Commit f946f4f has been approved by matthiaskrgr

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 25, 2024
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-17 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 46)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 49)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 61)
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-17]
---
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-17', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-17/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---
---- [ui] tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.rs stdout ----
diff of stderr:

3    |
4 LL | fn foo2<T: ?Sized + ?Sized>(a: T) {}
5    |            ^^^^^^   ^^^^^^
+    |
+    = help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable
+    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
7 error[E0203]: type parameter has more than one relaxed default bound, only one is supported
8   --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:16:12

9    |
9    |
10 LL | fn foo3<T: ?Sized + ?Sized + Debug>(a: T) {}
11    |            ^^^^^^   ^^^^^^
+    |
+    = help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable
+    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
13 error[E0203]: type parameter has more than one relaxed default bound, only one is supported
14   --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:20:12

15    |
15    |
16 LL | fn foo4<T: ?Sized + Debug + ?Sized >(a: T) {}
+    |
+    |
+    = help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable
+    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
19 error[E0203]: type parameter has more than one relaxed default bound, only one is supported
20   --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:27:17

21    |
21    |
22 LL | fn foo6(_: impl ?Sized + ?Sized) {}
23    |                 ^^^^^^   ^^^^^^
+    |
+    = help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable
+    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
25 error[E0203]: type parameter has more than one relaxed default bound, only one is supported
26   --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:31:17

27    |
27    |
28 LL | fn foo7(_: impl ?Sized + ?Sized + Debug) {}
29    |                 ^^^^^^   ^^^^^^
+    |
+    = help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable
+    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
31 error[E0203]: type parameter has more than one relaxed default bound, only one is supported
32   --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:35:17

33    |
33    |
34 LL | fn foo8(_: impl ?Sized + Debug + ?Sized ) {}
+    |
+    |
+    = help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable
+    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
37 error[E0277]: the size for values of type `T` cannot be known at compilation time
38   --> $DIR/bad-suggestionf-for-repeated-unsized-bound-127441.rs:9:20



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441/bad-suggestionf-for-repeated-unsized-bound-127441.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441/auxiliary"
--- stderr -------------------------------
error[E0203]: type parameter has more than one relaxed default bound, only one is supported
##[error]  --> /checkout/tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.rs:12:12
   |
   |
LL | fn foo2<T: ?Sized + ?Sized>(a: T) {}
   |            ^^^^^^   ^^^^^^
   |
   = help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0203]: type parameter has more than one relaxed default bound, only one is supported
##[error]  --> /checkout/tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.rs:16:12
   |
   |
LL | fn foo3<T: ?Sized + ?Sized + Debug>(a: T) {}
   |            ^^^^^^   ^^^^^^
   |
   = help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0203]: type parameter has more than one relaxed default bound, only one is supported
##[error]  --> /checkout/tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.rs:20:12
   |
   |
LL | fn foo4<T: ?Sized + Debug + ?Sized >(a: T) {}
   |
   |
   = help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0203]: type parameter has more than one relaxed default bound, only one is supported
##[error]  --> /checkout/tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.rs:27:17
   |
   |
LL | fn foo6(_: impl ?Sized + ?Sized) {}
   |                 ^^^^^^   ^^^^^^
   |
   = help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0203]: type parameter has more than one relaxed default bound, only one is supported
##[error]  --> /checkout/tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.rs:31:17
   |
   |
LL | fn foo7(_: impl ?Sized + ?Sized + Debug) {}
   |                 ^^^^^^   ^^^^^^
   |
   = help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0203]: type parameter has more than one relaxed default bound, only one is supported
##[error]  --> /checkout/tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.rs:35:17
   |
   |
LL | fn foo8(_: impl ?Sized + Debug + ?Sized ) {}
   |
   |
   = help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0277]: the size for values of type `T` cannot be known at compilation time
##[error]  --> /checkout/tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.rs:9:20
   |
   |
LL | fn foo1<T: ?Sized>(a: T) {}
   |         |
   |         this type parameter needs to be `Sized`
   |
   = help: unsized fn params are gated as an unstable feature
   = help: unsized fn params are gated as an unstable feature
help: consider removing the `?Sized` bound to make the type parameter `Sized`
   |
LL - fn foo1<T: ?Sized>(a: T) {}
LL + fn foo1<T>(a: T) {}
help: function arguments must have a statically known size, borrowed types always have a known size
   |
   |
LL | fn foo1<T: ?Sized>(a: &T) {}

error[E0277]: the size for values of type `T` cannot be known at compilation time
##[error]  --> /checkout/tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.rs:12:29
   |
   |
LL | fn foo2<T: ?Sized + ?Sized>(a: T) {}
   |         |
   |         this type parameter needs to be `Sized`
   |
   = help: unsized fn params are gated as an unstable feature
   = help: unsized fn params are gated as an unstable feature
help: consider removing the `?Sized` bound to make the type parameter `Sized`
   |
LL - fn foo2<T: ?Sized + ?Sized>(a: T) {}
LL + fn foo2<T>(a: T) {}
help: function arguments must have a statically known size, borrowed types always have a known size
   |
   |
LL | fn foo2<T: ?Sized + ?Sized>(a: &T) {}

error[E0277]: the size for values of type `T` cannot be known at compilation time
##[error]  --> /checkout/tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.rs:16:37
   |
   |
LL | fn foo3<T: ?Sized + ?Sized + Debug>(a: T) {}
   |         |
   |         this type parameter needs to be `Sized`
   |
   = help: unsized fn params are gated as an unstable feature
   = help: unsized fn params are gated as an unstable feature
help: consider restricting type parameters
   |
LL - fn foo3<T: ?Sized + ?Sized + Debug>(a: T) {}
LL + fn foo3<T: Debug>(a: T) {}
help: function arguments must have a statically known size, borrowed types always have a known size
   |
   |
LL | fn foo3<T: ?Sized + ?Sized + Debug>(a: &T) {}

error[E0277]: the size for values of type `T` cannot be known at compilation time
##[error]  --> /checkout/tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.rs:20:38
   |
   |
LL | fn foo4<T: ?Sized + Debug + ?Sized >(a: T) {}
   |         |
   |         this type parameter needs to be `Sized`
   |
   = help: unsized fn params are gated as an unstable feature
   = help: unsized fn params are gated as an unstable feature
help: consider restricting type parameters
   |
LL - fn foo4<T: ?Sized + Debug + ?Sized >(a: T) {}
LL + fn foo4<T: Debug >(a: T) {}
help: function arguments must have a statically known size, borrowed types always have a known size
   |
   |
LL | fn foo4<T: ?Sized + Debug + ?Sized >(a: &T) {}

error[E0277]: the size for values of type `impl ?Sized` cannot be known at compilation time
##[error]  --> /checkout/tests/ui/trait-bounds/bad-suggestionf-for-repeated-unsized-bound-127441.rs:24:9
   |
   |
LL | fn foo5(_: impl ?Sized) {}
   |         ^  ----------- this type parameter needs to be `Sized`
   |         doesn't have a size known at compile-time
   |
   = help: unsized fn params are gated as an unstable feature
   = help: unsized fn params are gated as an unstable feature
help: consider replacing `?Sized` with `Sized`
   |
LL - fn foo5(_: impl ?Sized) {}
LL + fn foo5(_: impl Sized) {}
help: function arguments must have a statically known size, borrowed types always have a known size
   |
   |
LL | fn foo5(_: &impl ?Sized) {}


error[E0277]: the size for values of type `impl ?Sized + ?Sized` cannot be known at compilation time
   |
   |
LL | fn foo6(_: impl ?Sized + ?Sized) {}
   |         ^  -------------------- this type parameter needs to be `Sized`
   |         doesn't have a size known at compile-time
   |
   = help: unsized fn params are gated as an unstable feature
help: consider restricting type parameters
help: consider restricting type parameters
   |
LL - fn foo6(_: impl ?Sized + ?Sized) {}
LL + fn foo6(_: impl Sized) {}
help: function arguments must have a statically known size, borrowed types always have a known size
   |
   |
LL | fn foo6(_: &impl ?Sized + ?Sized) {}


error[E0277]: the size for values of type `impl ?Sized + ?Sized + Debug` cannot be known at compilation time
   |
   |
LL | fn foo7(_: impl ?Sized + ?Sized + Debug) {}
   |         ^  ---------------------------- this type parameter needs to be `Sized`
   |         doesn't have a size known at compile-time
   |
   = help: unsized fn params are gated as an unstable feature
help: consider restricting type parameters
help: consider restricting type parameters
   |
LL - fn foo7(_: impl ?Sized + ?Sized + Debug) {}
LL + fn foo7(_: impl Debug) {}
help: function arguments must have a statically known size, borrowed types always have a known size
   |
   |
LL | fn foo7(_: &impl ?Sized + ?Sized + Debug) {}


error[E0277]: the size for values of type `impl ?Sized + Debug + ?Sized` cannot be known at compilation time
   |
   |
LL | fn foo8(_: impl ?Sized + Debug + ?Sized ) {}
   |         ^  ---------------------------- this type parameter needs to be `Sized`
   |         doesn't have a size known at compile-time
   |
   = help: unsized fn params are gated as an unstable feature
help: consider restricting type parameters
help: consider restricting type parameters
   |
LL - fn foo8(_: impl ?Sized + Debug + ?Sized ) {}
LL + fn foo8(_: impl Debug ) {}
help: function arguments must have a statically known size, borrowed types always have a known size
   |
   |
LL | fn foo8(_: &impl ?Sized + Debug + ?Sized ) {}

error: aborting due to 14 previous errors

Some errors have detailed explanations: E0203, E0277.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-windows Operating system: Windows rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-release Relevant to the release subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.