Consider field attributes when converting from tuple to named struct and the opposite
Fixes#17983.
I tried to use the `SourceChangeBuilder::make_mut()` API, but it duplicated the attribute...
fix: Don't add reference when it isn't needed for the "Extract variable" assist
I.e. don't generate `let var_name = &foo()`. Because it always irritates me when I need to fix that.
Anything that creates a new value don't need a reference. That excludes mostly field accesses and indexing.
I had a thought that we can also not generate a reference for fields and indexing as long as the type is `Copy`, but sometimes people impl `Copy` even when they don't want to copy the values (e.g. a large type), so I didn't do that.
Fix incorrect symbol definitions in SCIP output
The SCIP output incorrectly marks some symbols as definitions because it doesn't account for the file ID when comparing the token's range to its definition's range.
This means that if a symbol is referenced in a file at the same position at which it is defined in another file, that reference will be marked as a definition. I was quite surprised by how common this is. For example, `PartialEq` is defined [here](https://github.com/rust-lang/rust/blob/1.80.1/library/core/src/cmp.rs#L273) and `uuid` references it [here](https://github.com/uuid-rs/uuid/blob/1.8.0/src/lib.rs#L329). And what do you know, they're both at offset 10083! In our large monorepo, this happens for basically every common stdlib type!
feat: Create an assist to convert closure to freestanding fn
The assist converts all captures to parameters.
Closes#17920.
This was more work than I though, since it has to handle a bunch of edge cases...
Based on #17941. Needs to merge it first.
internal: Avoid newlines in fetch errors
Most logs lines don't have newlines, ensure fetch errors follow this pattern. This makes it easier to see which log line is associated with the error.
Before:
2024-08-28T21:11:58.431856Z ERROR FetchWorkspaceError:
rust-analyzer failed to discover workspace
After:
2024-08-28T21:11:58.431856Z ERROR FetchWorkspaceError: rust-analyzer failed to discover workspace
* Use a lookup table for 8-bit integers and the Karatsuba square root
algorithm for larger integers.
* Include optimization hints that give the compiler the exact numeric
range of results.
* Choose test inputs more thoroughly and systematically.
* Check that `isqrt` and `checked_isqrt` have equivalent results for
signed types, either equivalent numerically or equivalent as a panic
and a `None`.
* Check that `isqrt` has numerically-equivalent results for unsigned
types and their `NonZero` counterparts.
* Reuse `ilog10` benchmarks, plus benchmarks that use a uniform
distribution.
Rollup of 14 pull requests
Successful merges:
- #128192 (rustc_target: Add various aarch64 features)
- #129170 (Add an ability to convert between `Span` and `visit::Location`)
- #129343 (Emit specific message for time<=0.3.35)
- #129378 (Clean up cfg-gating of ProcessPrng extern)
- #129401 (Partially stabilize `feature(new_uninit)`)
- #129467 (derive(SmartPointer): assume pointee from the single generic and better error messages)
- #129494 (format code in tests/ui/threads-sendsync)
- #129617 (Update books)
- #129673 (Add fmt::Debug to sync::Weak<T, A>)
- #129683 (copysign with sign being a NaN can have non-portable results)
- #129689 (Move `'tcx` lifetime off of impl and onto methods for `CrateMetadataRef`)
- #129695 (Fix path to run clippy on rustdoc)
- #129712 (Correct trusty targets to be tier 3)
- #129715 (Update `compiler_builtins` to `0.1.123`)
r? `@ghost`
`@rustbot` modify labels: rollup
Correct trusty targets to be tier 3
The Trusty targets were added in https://github.com/rust-lang/rust/pull/129490, but in that PR I accidentally marked them as tier 2. This PR corrects the target metadata to mark them as tier 3.
Fix path to run clippy on rustdoc
Took me a while to find out that the path clippy expected was `src/tools/rustdoc` and not `src/librustdoc`. I think it makes more sense this way as most commands rely on source paths.
r? ```@Kobzol```
Move `'tcx` lifetime off of impl and onto methods for `CrateMetadataRef`
Unconstrained type and const variables are not allowed, but unconstrained lifetimes are. This is not very good style, though, and it leads to unnecessary captures of a lifetime in edition 2024 (not that it matters, but it does trigger the edition migration lint).
copysign with sign being a NaN can have non-portable results
Follow-up to https://github.com/rust-lang/rust/pull/129559.
Cc ```@tgross35``` ```@beetrees```
There's no portable variant we can recommend instead here, is there? Something with a semantics like "if `sign` is a NaN, then return `self` unaltered, otherwise return `self` with the sign changed to that of `sign`"?
Add fmt::Debug to sync::Weak<T, A>
Currently, `sync::Weak<T>` implements `Debug`, but `sync::Weak<T, A>` does not. This appears to be an oversight, as `rc::Weak<T, A>` implements `Debug`. (Note: `sync::Weak` is the weak for `Arc`, and `rc::Weak` is the weak for `Rc`.)
This PR adds the Debug trait for `sync::Weak<T, A>`. The issue was initially brought up here: https://github.com/rust-lang/wg-allocators/issues/131