-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Rollup of 5 pull requests #148420
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 5 pull requests #148420
Conversation
Ubuntu 25.10 has `llvm-21` packages that we can test with. The `Dockerfile` is otherwise the same as the `llvm-20` runners.
```
error[E0401]: can't use generic parameters from outer item
--> $DIR/enum-definition-with-outer-generic-parameter-5997.rs:3:16
|
LL | fn f<Z>() -> bool {
| - type parameter from outer item
LL | enum E { V(Z) }
| ^ use of generic parameter from outer item
|
help: try introducing a local generic parameter here
|
LL | enum E<Z> { V(Z) }
| +++
```
```
error[E0401]: can't use generic parameters from outer item
--> $DIR/E0401.rs:4:39
|
LL | fn foo<T>(x: T) {
| - type parameter from outer item
LL | fn bfnr<U, V: Baz<U>, W: Fn()>(y: T) {
| ---- ^ use of generic parameter from outer item
| |
| generic parameter used in this inner function
|
help: try introducing a local generic parameter here
|
LL | fn bfnr<T, U, V: Baz<U>, W: Fn()>(y: T) {
| ++
```
```
error[E0401]: can't reference `Self` constructor from outer item
--> $DIR/do-not-ice-on-note_and_explain.rs:6:13
|
LL | impl<B> A<B> {
| ------------ the inner item doesn't inherit generics from this impl, so `Self` is invalid to reference
LL | fn d() {
LL | fn d() {
| - `Self` used in this inner item
LL | Self(1)
| ^^^^ help: replace `Self` with the actual type: `A`
```
```
error[E0401]: can't use generic parameters from outer item
--> $DIR/const-param-from-outer-fn.rs:3:9
|
LL | fn foo<const X: u32>() {
| - const parameter from outer item
LL | fn bar() -> u32 {
| --- generic parameter used in this inner function
LL | X
| ^ use of generic parameter from outer item
|
help: try introducing a local generic parameter here
|
LL | fn bar<X>() -> u32 {
| +++
```
…cs to cg_llvm This is a workaround for an LLVM bug, so put it in cg_llvm.
The panic runtime uses #[rustc_std_internal_symbol] which has the same effect as this special case with respect to symbol visibility.
When encountering an unmet `Ty: [const] Trait` bound, if `Trait` is `#[const_trait]` and there's an `impl Trait for Ty` point at it. If local, suggest `impl const Trait for Ty`, otherwise just point at it.
```
error[E0277]: the trait bound `NonConstAdd: [const] Add` is not satisfied
--> $DIR/assoc-type.rs:37:16
|
LL | type Bar = NonConstAdd;
| ^^^^^^^^^^^
|
note: required by a bound in `Foo::Bar`
--> $DIR/assoc-type.rs:33:15
|
LL | type Bar: [const] Add;
| ^^^^^^^^^^^ required by this bound in `Foo::Bar`
help: make the `impl` of trait `Add` `const`
|
LL | impl const Add for NonConstAdd {
| +++++
```
```
error[E0277]: the trait bound `T: [const] PartialEq` is not satisfied
--> tests/ui/traits/const-traits/call-generic-method-fail.rs:5:5
|
5 | *t == *t
| ^^^^^^^^
|
note: trait `PartialEq` is implemented but not `const`
--> /home/gh-estebank/rust/library/core/src/ptr/const_ptr.rs:1590:1
|
1590 | impl<T: PointeeSized> PartialEq for *const T {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: trait `PartialEq` is implemented but not `const`
--> /home/gh-estebank/rust/library/core/src/ptr/mut_ptr.rs:2011:1
|
2011 | impl<T: PointeeSized> PartialEq for *mut T {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
Point at trait and associated item when that associated item is used in a const context. Suggest making the trait `#[const_trait]`.
```
error[E0015]: cannot call non-const method `<() as Trait>::foo` in constant functions
--> $DIR/inline-incorrect-early-bound-in-ctfe.rs:26:8
|
LL | ().foo();
| ^^^^^
|
note: method `foo` is not const because trait `Trait` is not const
--> $DIR/inline-incorrect-early-bound-in-ctfe.rs:13:1
|
LL | trait Trait {
| ^^^^^^^^^^^ this trait is not const
LL | fn foo(self);
| ------------- this method is not const
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
help: consider making trait `Trait` const
|
LL + #[const_trait]
LL | trait Trait {
|
```
```
error[E0015]: cannot call non-const associated function `Foo::{constant#0}::Foo::<17>::value` in constants
--> $DIR/nested-type.rs:15:5
|
LL | struct Foo<const N: [u8; {
| __________________________-
LL | | struct Foo<const N: usize>;
LL | |
LL | | impl<const N: usize> Foo<N> {
... |
LL | | Foo::<17>::value()
| | ^^^^^^^^^^^^^^^^^^
LL | |
LL | | }]>;
| |_- calls in constants are limited to constant functions, tuple structs and tuple variants
```
Provide additional context to errors involving const traits
When encountering an unmet `Ty: [const] Trait` bound, if `Trait` is `#[const_trait]` and there's an `impl Trait for Ty` point at it. If local, suggest `impl const Trait for Ty`, otherwise just point at it.
```
error[E0277]: the trait bound `NonConstAdd: [const] Add` is not satisfied
--> $DIR/assoc-type.rs:37:16
|
LL | type Bar = NonConstAdd;
| ^^^^^^^^^^^
|
note: required by a bound in `Foo::Bar`
--> $DIR/assoc-type.rs:33:15
|
LL | type Bar: [const] Add;
| ^^^^^^^^^^^ required by this bound in `Foo::Bar`
help: make the `impl` of trait `Add` `const`
|
LL | impl const Add for NonConstAdd {
| +++++
```
```
error[E0277]: the trait bound `T: [const] PartialEq` is not satisfied
--> tests/ui/traits/const-traits/call-generic-method-fail.rs:5:5
|
5 | *t == *t
| ^^^^^^^^
|
note: trait `PartialEq` is implemented but not `const`
--> /home/gh-estebank/rust/library/core/src/ptr/const_ptr.rs:1590:1
|
1590 | impl<T: PointeeSized> PartialEq for *const T {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: trait `PartialEq` is implemented but not `const`
--> /home/gh-estebank/rust/library/core/src/ptr/mut_ptr.rs:2011:1
|
2011 | impl<T: PointeeSized> PartialEq for *mut T {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
ci: add runners for vanilla LLVM 21 Ubuntu 25.10 has `llvm-21` packages that we can test with. The `Dockerfile` is otherwise the same as the `llvm-20` runners.
…fleLapkin rustc_codegen: fix musttail returns for cast/indirect ABIs Fixes rust-lang#148239 rust-lang#144986 Explicit tail calls trigger `bug!` for any callee whose ABI returns via `PassMode::Cast`, and we forgot to to forward the hidden `sret` out-pointer when the ABI requested an indirect return. The former causes ICE, the latter produced malformed IR (wrong codegen) if the return value is large enough to need `sret`. Updated the musttail helper to accept cast-mode returns, made it so that we pass the return pointer through the tail-call path. Added two UI tests to demonstrate each case. This is my first time contributing, please do check if I did it right. r? theemathas
…, r=WaffleLapkin Remove a special case and move another one out of reachable_non_generics One is no longer necessary, the other is best placed in cg_llvm as it works around a cg_llvm bug.
…ouwer Point at inner item when it uses generic type param from outer item or `Self` Partially address rust-lang#37892. In E0401 generated in resolve: ``` error[E0401]: can't use generic parameters from outer item --> $DIR/E0401.rs:4:39 | LL | fn foo<T>(x: T) { | - type parameter from outer item LL | fn bfnr<U, V: Baz<U>, W: Fn()>(y: T) { | ---- ^ use of generic parameter from outer item | | | generic parameter used in this inner function | help: try introducing a local generic parameter here | LL | fn bfnr<T, U, V: Baz<U>, W: Fn()>(y: T) { | ++ ``` In E0401 generated in hir_typeck: ``` error[E0401]: can't reference `Self` constructor from outer item --> $DIR/do-not-ice-on-note_and_explain.rs:6:13 | LL | impl<B> A<B> { | ------------ the inner item doesn't inherit generics from this impl, so `Self` is invalid to reference LL | fn d() { LL | fn d() { | - `Self` used in this inner item LL | Self(1) | ^^^^ help: replace `Self` with the actual type: `A` ```
|
If this rollup fails for any reason, please prefer to create a newer, larger rollup. No reason to retry this particular subset of PRs. |
|
☀️ Test successful - checks-actions |
|
📌 Perf builds for each rolled up PR:
previous master: c5dabe8cf7 In the case of a perf regression, run the following command for each PR you suspect might be the cause: |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing c5dabe8 (parent) -> 7878a91 (this PR) Test differencesShow 46 test diffsStage 1
Stage 2
Additionally, 38 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 7878a919448eb219b630d1866ca06c0d412483f2 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (7878a91): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary -2.8%, secondary 0.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 474.179s -> 475.242s (0.22%) |
Successful merges:
Self#148370 (Point at inner item when it uses generic type param from outer item orSelf)r? @ghost
@rustbot modify labels: rollup
Create a similar rollup