By moving `RenderOptions` out of `Option`, because the two structs' uses
are almost entirely separate.
The only complication is that `unstable_features` is needed in both
structs, but it's a tiny `Copy` type so its duplication seems fine.
It turns out `markdown::render` is more complex than it first appears,
because it can invoke `doctest::make_test`, which requires session
globals and a thread pool.
So this commit changes it to use `interface::run_compiler`. Three of the
four paths in `main_args` now use `interface::run_compiler`.
rustc's startup has several layers, including:
- `interface::run_compiler` passes a closure, `f`, to
`run_in_thread_pool_with_globals`, which creates a thread pool, sets
up session globals, and passes `f` to `create_compiler_and_run`.
- `create_compiler_and_run` creates a `Session`, a `Compiler`, sets the
source map, and calls `f`.
rustdoc is a bit different.
- `main_args` calls `main_options` via
`run_in_thread_pool_with_globals`, which (again) creates a thread pool
(hardcoded to a single thread!) and sets up session globals.
- `main_options` has four different paths.
- The second one calls `interface::run_compiler`, which redoes the
`run_in_thread_pool_with_globals`! This is bad.
- The fourth one calls `interface::create_compiler_and_run`, which is
reasonable.
- The first and third ones don't do anything of note involving the
above functions, except for some symbol interning which requires
session globals.
In other words, rustdoc calls into `rustc_interface` at three different
levels. It's a bit confused, and feels like code where functionality has
been added by different people at different times without fully
understanding how the globally accessible stuff is set up.
This commit tidies things up. It removes the
`run_in_thread_pool_with_globals` call in `main_args`, and adjust the
four paths in `main_options` as follows.
- `markdown::test` calls `test::test_main`, which provides its own
parallelism and so doesn't need a thread pool. It had one small use of
symbol interning, which required session globals, but the commit
removes this.
- `doctest::run` already calls `interface::run_compiler`, so it doesn't
need further adjustment.
- `markdown::render` is simple but needs session globals for interning
(which can't easily be removed), so it's now wrapped in
`create_session_globals_then`.
- The fourth path now uses `interface::run_compiler`, which is
equivalent to the old `run_in_thread_pool_with_globals` +
`create_compiler_and_run` pairing.
The illumos linker does not support --strip-debug
When building and testing rust 1.64.0 on illumos, we saw a large number of failing tests associated with:
```
= note: ld: fatal: unrecognized option '--strip-debug'
ld: fatal: use the -z help option for usage information
collect2: error: ld returned 1 exit status
```
The illumos linker does not support the `--strip-debug` option (although it does support `--strip-all`).
Remove the redundant `Some(try_opt!(..))` in `checked_pow`
The final return value doesn't need to be tried at all -- we can just
return the checked option directly. The optimizer can probably figure
this out anyway, but there's no need to make it work here.
Make diagnostic for unsatisfied `Termination` bounds more precise
Don't blindly emit a diagnostic claiming that “*`main` has an invalid return type*” if we encounter a type that should but doesn't implement `std::process::Termination` and isn't actually the return type of the program entry `main`.
Fixes#103052.
``@rustbot`` label A-diagnostics T-compiler T-libs
r? diagnostics
Remove "execute" bit from lock file permissions
Previously, flock would set the "execute" bit on Rust lock files. That makes no sense.
This patch clears the "execute" bit on Rust lock files.
See issue #102531.
Add `Box<[T; N]>: TryFrom<Vec<T>>`
We have `[T; N]: TryFrom<Vec<T>>` (#76310) and `Box<[T; N]>: TryFrom<Box<[T]>>`, but not this combination.
`vec.into_boxed_slice().try_into()` isn't quite a replacement for this, as that'll reallocate unnecessarily in the error case.
**Insta-stable, so needs an FCP**
(I tried to make this work with `, A`, but that's disallowed because of `#[fundamental]` https://github.com/rust-lang/rust/issues/29635#issuecomment-1247598385)
The final return value doesn't need to be tried at all -- we can just
return the checked option directly. The optimizer can probably figure
this out anyway, but there's no need to make it work here.
Rollup of 4 pull requests
Successful merges:
- #102454 (Suggest parentheses for possible range method calling)
- #102466 (only allow `ConstEquate` with `feature(gce)`)
- #102945 (Do not register placeholder `RegionOutlives` obligations when `considering_regions` is false)
- #103091 (rustdoc: remove unused HTML class `sidebar-title`)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Do not register placeholder `RegionOutlives` obligations when `considering_regions` is false
**NOTE:** I'm kinda just putting this up for discussion. I'm not certain this is correct...?
This was introduced in [`608625d`](608625dae9 (diff-6e54b18681342ec725d75591dbf384ad08cd73df29db00485fe51b4e90f76ff7R361)).
Interestingly, we only check `data.has_placeholders()` for `RegionOutlives`, and not for `TypeOutlives`... why? For the record, that different treatment between `RegionOutlives` and `TypeOutlives` is why the fix "The compiling succeeds when all `'a : 'b` are replaced with `&'a () : 'b`" in #100689 _"works"_, but it seems like an implementation detail considering this.
Also, why do we care about placeholder regions being registered if `considering_regions` is false? It doesn't seem to affect any UI tests, for example.
r? `@lcnr`
Fixes#102899Fixes#100689
remote-test-server: Show command line arguments
The user of remote-test-server should get at least some minimal command line help as this is often started manually.
r? `@pietroalbini`