Rollup of 11 pull requests#152185
Conversation
It contains the `Cursor` type and an `impl Cursor` block with a few methods. But there is a larger `impl Cursor` block in the crate root. The only other thing in the `cursor` module is the simple `FrontmatterAllowed` type. So this commit just moves everything in the `cursor` module (which isn't much) into the crate root.
Every diagnostic struct in `rustc_parse` is in the `errors` module, except for `ForbiddenLetReason` and `MisspelledKw`. There's no good reason for this, and presumably it is just an accidental inconsistency. This commit moves them into `errors`.
From the `parser` module to the `errors` module, which is where most of its uses are. This means the `errors` module no longer depends on the `parser` module, removing a cyclic dependency between the two modules.
These don't correspond to specific instructions and will produce different instructions on x86/x86_64 based on ABI details.
Otherwise this picks up vim .swp files.
It actually generates vrfin now
Update expected instructions for LLVM 22
Avoid `unsafe fn` in aarch64, powerpc and s390x tests
wasm: use `intrinsics::simd` for the narrow functions
powerpc: implement `vnmsubfp` using `intrinsics::simd`
x86: use `intrinsics::simd` for `hadds`/`hsubs`
This reverts commit 32146718741ee22ff0d54d21b9ab60353014c980.
When encountering a value that has a borrow checker error where the type was previously moved, when suggesting cloning verify that it is not already being derived. If it is, explain why the `derive(Clone)` doesn't apply:
```
note: if `TypedAddress<T>` implemented `Clone`, you could clone the value
--> $DIR/derive-clone-implicit-bound.rs:6:1
|
LL | #[derive(Clone, Copy)]
| ----- derived `Clone` adds implicit bounds on type parameters
LL | pub struct TypedAddress<T>{
| ^^^^^^^^^^^^^^^^^^^^^^^^-^
| | |
| | introduces an implicit `T: Clone` bound
| consider manually implementing `Clone` for this type
...
LL | let old = self.return_value(offset);
| ------ you could clone this value
```
When encountering a bound coming from a derive macro, suggest manual impl of the trait.
Use the span for the specific param when adding bounds in builtin derive macros, so the diagnostic will point at them as well as the derive macro itself.
```
error[E0277]: can't compare `SomeNode` with `SomeNode`
--> f29.rs:24:15
|
24 | accept_eq(&node);
| --------- ^^^^^ no implementation for `SomeNode == SomeNode`
| |
| required by a bound introduced by this call
|
= note: -Ztrack-diagnostics: created at compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:279:39
= help: the trait `PartialEq` is not implemented for `SomeNode`
note: required for `Id<SomeNode>` to implement `PartialEq`
--> f29.rs:3:10
|
3 | #[derive(PartialEq, Eq)]
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
4 | pub struct Id<T>(PhantomData<T>);
| -
= help: consider manually implementing `PartialEq` to avoid undesired bounds
note: required by a bound in `accept_eq`
--> f29.rs:15:23
|
15 | fn accept_eq(_: &impl PartialEq) { }
| ^^^^^^^^^ required by this bound in `accept_eq`
help: consider annotating `SomeNode` with `#[derive(PartialEq)]`
|
13 + #[derive(PartialEq)]
14 | struct SomeNode();
|
```
```
note: required for `B<C>` to implement `Copy`
--> $DIR/deriving-copyclone.rs:9:10
|
LL | #[derive(Copy, Clone)]
| ^^^^ unsatisfied trait bound introduced in this `derive` macro
LL | struct B<T> {
| - would need to be `Copy`
```
… for derive
On type errors where the difference is expecting an owned type and getting a reference, if the expression is a `.clone()` call and the type is annotated with `#[derive(Clone)]`, we now explain implicit bounds and suggest manually implementing `Clone`.
```
error[E0308]: mismatched types
--> $DIR/derive-implicit-bound-on-clone.rs:10:5
|
LL | fn clone_me<T, K>(x: &ContainsRc<T, K>) -> ContainsRc<T, K> {
| ---------------- expected `ContainsRc<T, K>` because of return type
LL | x.clone()
| ^^^^^^^^^ expected `ContainsRc<T, K>`, found `&ContainsRc<T, K>`
|
= note: expected struct `ContainsRc<_, _>`
found reference `&ContainsRc<_, _>`
note: `ContainsRc<T, K>` does not implement `Clone`, so `&ContainsRc<T, K>` was cloned instead
--> $DIR/derive-implicit-bound-on-clone.rs:10:5
|
LL | x.clone()
| ^
help: `Clone` is not implemented because the some trait bounds could not be satisfied
--> $DIR/derive-implicit-bound-on-clone.rs:5:19
|
LL | #[derive(Clone)]
| ----- in this derive macro expansion
LL | struct ContainsRc<T, K> {
| ^ ^ derive introduces an implicit unsatisfied trait bound `K: Clone`
| |
| derive introduces an implicit unsatisfied trait bound `T: Clone`
= help: consider manually implementing `Clone` to avoid the implict type parameter bounds
```
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
💔 Test for ce8d2f4 failed: CI. Failed job:
|
|
@bors retry |
This comment has been minimized.
This comment has been minimized.
…uwer Rollup of 11 pull requests Successful merges: - #152174 (stdarch subtree update) - #151278 (Provide more context on trait bounds being unmet due to imperfect derive) - #151955 (escape symbol names in global asm) - #149329 (Mark match arms in try and for as being from desugarings.) - #151474 (Minor structural improvements) - #151744 (fix refining_impl_trait suggestion with return_type_notation) - #152107 (Convert to inline diagnostics in `rustc_borrowck`) - #152117 (Convert to inline diagnostics in `rustc_trait_selection`) - #152136 (Consolidate type const checks on `tcx.is_type_const`) - #152170 (Port `rustc_effective_visibility` to the new attribute parser) - #152184 (Port rustc_abi to the attribute parser)
|
@bors treeclosed=1000 The rollup failed 5 times in a row (a few times on the previous rollup #152181) with a rustdoc-gui error, all PRs into main are also failing with the same error. |
|
Tree closed for PRs with priority less than 1000. |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
💔 Test for 41dca5b failed: CI. Failed job:
|
|
Closing in favor of a smaller rollup #152200 that cherry-picks the PR to disable 4 rustdoc-gui tests. |
|
@bors treeopen |
|
Tree is now open for merging. |
Successful merges:
rustc_borrowck#152107 (Convert to inline diagnostics inrustc_borrowck)rustc_trait_selection#152117 (Convert to inline diagnostics inrustc_trait_selection)tcx.is_type_const#152136 (Consolidate type const checks ontcx.is_type_const)rustc_effective_visibilityto the new attribute parser #152170 (Portrustc_effective_visibilityto the new attribute parser)r? @ghost
Create a similar rollup