Set opt-level flag for installing tool only on CI
## Context
ensure_version_or_cargo_install uses -Copt-level=0 for quicker installation. However, the flag affects the tool's performance. For example, typos-cli with opt-level=0 takes 15 seconds for checking /compiler on my local, but the tool with default opt-level only takes less than 1 sec.
It fixesrust-lang/rust#147331
## Changes
This PR enables the option only when the test tidy is run on CI.
We've discussed that opt-level=1 should be enough, so I also change the level from 0 to 1.
cg_llvm: Remove inherent methods from several LLVM FFI types
This is mainly motivated by rust-lang/rust#142897, which proposes to move the LLVM FFI bindings out of `rustc_codegen_llvm` and into `rustc_llvm`, which is arguably the more correct place for them from a linking perspective.
---
In order to perform that migration, all of the types used in FFI signatures also need to be moved. However, several of those types have inherent methods that convert from backend-independent types to LLVM FFI types.
Moving the inherent methods as-is would require adding a lot of otherwise-unnecessary dependencies to `rustc_llvm`. And we can't leave them behind as-is, because inherent methods can't be defined in another crate.
Therefore, this PR replaces several of those inherent methods with either extension trait methods or free functions.
ensure_version_or_cargo_install uses -Copt-level=0 for quicker installation.
However, the flag affects the tool's performance. For example, typos-cli with opt-level=0 takes 15 seconds for checking ./compiler, but the tool with default opt-level only takes less than 1 sec.
This commit enables the option only when the test tidy is run on CI.
- cast `&[Arm]` to `&[Arm; 2]` early on to hopefully avoid bounds checks
- use `if let [pattern] = X { .. }` instead of `if let patterns = X {
let pattern = patterns[0]; .. }`
- use `Symbol`s instead of `&str`s
- reduce indentation
Diff best viewed with whitespace ignored
changelog: none
It didn't do anything (behaved like `item`), as with `enforceGranularity = false` (which is the default), the style of the current file is always preferred, regardless of the setting.
We could make it fail when the setting is `preserve` and the current file's style could not be detected, but that makes little sense.
It is a bit weird that the default is `crate` but `preserve` falls back to `item`, however that was the previous behavior.
update autodiff testcases
unblock https://github.com/EnzymeAD/Enzyme/pull/2430 (again).
Just as I landed a fix for the last test, this one broke. The test should now be fine if the name mangling hash changes again.
Also removed an outdated fixme that's not needed since moving autodiff to an intrinsic. The test currently just checks that it compiles, I'll add more precise checks once we actually run this in CI.
r? compiler
Fix doctest output json
Fixesrust-lang/rust#144798.
Hopefully it will work with the new changes in `libtest` without needing to do both at once.
This PR moves the `rustdoc` merged doctest extra information directly into `libtest` to ensure they share the same rendering to prevent the bug uncovered in rust-lang/rust#144798.
cc `@lolbinary` (as you reviewed the first PR)
And since we're making changes to `libtest`:
r? `@Amanieu`
This will make `-Zbuild-std` automatically build the right crates, notably not building `std` by default, which will both be useful for users and also fix the build for https://does-it-build.noratrieb.dev.
Rollup of 7 pull requests
Successful merges:
- rust-lang/rust#147288 (compiletest: Make `DirectiveLine` responsible for name/value splitting)
- rust-lang/rust#147309 (Add documentation about unwinding to wasm targets)
- rust-lang/rust#147310 (Mark `PatternTypo` suggestion as maybe incorrect)
- rust-lang/rust#147320 (Avoid to suggest pattern match on the similarly named in fn signature)
- rust-lang/rust#147328 (Implement non-poisoning `Mutex::with_mut`, `RwLock::with` and `RwLock::with_mut`)
- rust-lang/rust#147337 (Make `fmt::Write` a diagnostic item)
- rust-lang/rust#147349 (Improve the advice given by panic_immediate_abort)
r? `@ghost`
`@rustbot` modify labels: rollup
Improve the advice given by panic_immediate_abort
Now that https://github.com/rust-lang/rust/pull/147338 is merged, users should consider using the Cargo support for immediate-aborting panics.
Make `fmt::Write` a diagnostic item
I'm working on an enhancement to [`clippy::format_push_string`](https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string), which would suggest an autofix to replace `push_str`/`+=` with `write!`. But that could require importing `std::fmt::Write`, and so I need this diagnostic item to check if it's already in scope.
The reason I called it `FmtWrite` and not just `Write` is that there's already an `IoWrite` defined.
Mark `PatternTypo` suggestion as maybe incorrect
Partial fix for https://github.com/rust-lang/rust/issues/147303.
`@rustbot` label A-diagnostics A-suggestion-diagnostics D-invalid-suggestion