Add the `#[derive_const]` attribute
Closes#102371. This is a minimal patchset for the attribute to work. There are no restrictions on what traits this attribute applies to.
r? `````@oli-obk`````
Remove lock wrappers in `sys_common`
This moves the lazy allocation to `sys` (SGX and UNIX). While this leads to a bit more verbosity, it will simplify future improvements by making room in `sys_common` for platform-independent implementations.
This also removes the condvar check on SGX as it is not necessary for soundness and will be removed anyway once mutex has been made movable.
For simplicity's sake, `libunwind` also uses lazy allocation now on SGX. This will require an update to the C definitions before merging this (CC `@raoulstrackx).`
r? `@m-ou-se`
Rollup of 9 pull requests
Successful merges:
- #100633 (Consider `#[must_use]` annotation on `async fn` as also affecting the `Future::Output`)
- #103445 (`#[test]`: Point at return type if `Termination` bound is unsatisfied)
- #103924 (Fix broken link in description of error code E0706)
- #104146 (Retry binding TCP Socket in remote-test-server)
- #104169 (Migrate `:target` rules to use CSS variables)
- #104202 (Fix ICE #103748)
- #104216 (Don't ICE on operator trait methods with generic methods)
- #104217 (Display help message when fluent arg was referenced incorrectly)
- #104245 (Reduce default configuration's dependency upon static libstdcpp library (#103606))
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Implement the `+whole-archive` modifier for `wasm-ld`
This implements the `Linker::{link_whole_staticlib,link_whole_rlib}` methods for the `WasmLd` linker used on wasm targets. Previously these methods were noops since I think historically `wasm-ld` did not have support for `--whole-archive` but nowadays it does, so the flags are passed through.
Make `Sized` coinductive, again
A revival of #83647
---
What exactly makes co-induction sound? Better question: are there any unsoundness risks from this? `Sized` can't be implemented by custom `impl` blocks, nor can it be conditionally implemented based on anything other than child fields being `Sized`, right?
r? `@nikomatsakis` for whenever he gets back from vacation
Allow specialized const trait impls.
Fixes#95186.
Fixes#95187.
I've done my best to create a comprehensive test suite for the interaction between `min_specialization` and `const_trait_impls`. I wouldn't be surprised if there are interesting cases I haven't tested, please let me know.
Reduce default configuration's dependency upon static libstdcpp library (#103606)
Fixes#103606
Remove default dependency on static libstdcpp except during dist llvm builds (where we want static libraries so `libLLVM.so` is self-contained).
Display help message when fluent arg was referenced incorrectly
The fluent argument syntax is a little special and easy to get wrong, so we emit a small help message when someone gets it wrong.
Example:
```
parser_mismatched_closing_delimiter = mismatched closing delimiter: `${delimiter}`
```
panics with
```
thread 'rustc' panicked at 'Encountered errors while formatting message for `parser_mismatched_closing_delimiter`
help: Argument `delimiter` exists but was not referenced correctly. Try using `{$delimiter}` instead
attr: `None`
args: `FluentArgs([("delimiter", String("}"))])`
errors: `[ResolverError(Reference(Message { id: "delimiter", attribute: None }))]`', compiler/rustc_errors/src/translation.rs:123:21
```
fixes#103539
Retry binding TCP Socket in remote-test-server
This allows retrying binding TCP Socket multiple times. This is useful when using emulators as network might not be available in the beginning.
This was orignally implemented in https://github.com/rust-lang/rust/pull/100316
Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
Fix broken link in description of error code E0706
Corresponding subsection in async book is `07.05` not `07.06`.
The information on the linked page is the same so it may be reasonable to remove the whole sentence.
`#[test]`: Point at return type if `Termination` bound is unsatisfied
Together with #103142 (already merged) this fully fixes#50291.
I don't consider my current solution of changing a few spans “here and there” very clean since the
failed obligation is a `FunctionArgumentObligation` and we point at a type instead of a function argument.
If you agree with me on this point, I can offer to keep the spans of the existing nodes and instead inject
`let _: AssertRetTyIsTermination<$ret_ty>;` (type to be defined in `libtest`) similar to `AssertParamIsEq` etc.
used by some built-in derive-macros.
I haven't tried that approach yet though and cannot promise that it would actually work out or
be “cleaner” for that matter.
````@rustbot```` label A-libtest A-diagnostics
r? ````@estebank````
Consider `#[must_use]` annotation on `async fn` as also affecting the `Future::Output`
No longer lint against `#[must_use] async fn foo()`.
When encountering a statement that awaits on a `Future`, check if the
`Future`'s parent item is annotated with `#[must_use]` and emit a lint
if so. This effectively makes `must_use` an annotation on the
`Future::Output` instead of only the `Future` itself.
Fix#78149.
rustc_codegen_ssa: Better code generation for niche discriminants.
In some cases we can avoid arithmetic before checking whether a niche is a tag.
Also rename some identifiers around niches.
This is relevant to #101872
Retry failed macro matching for diagnostics
When a declarative macro fails to match, retry the matching to collect diagnostic info instead of collecting it on the fly in the hot path. Split out of #103439.
You made a bunch of changes to declarative macro matching, so
r? `@nnethercote`
This change should produce a few small perf wins: https://github.com/rust-lang/rust/pull/103439#issuecomment-1294249602
Recover wrong-cased keywords that start items
(_this pr was inspired by [this tweet](https://twitter.com/Azumanga/status/1552982326409367561)_)
r? `@estebank`
We've talked a bit about this recovery, but I just wanted to make sure that this is the right approach :)
For now I've only added the case insensitive recovery to `use`s, since most other items like `impl` blocks, modules, functions can start with multiple keywords which complicates the matter.
No longer lint against `#[must_use] async fn foo()`.
When encountering a statement that awaits on a `Future`, check if the
`Future`'s parent item is annotated with `#[must_use]` and emit a lint
if so. This effectively makes `must_use` an annotation on the
`Future::Output` instead of only the `Future` itself.
Fix#78149.
Usually, we do want to use the static C++ library when building rustc_llvm, but do not want to have that dependency at compiler runtime. Change the defaults to Make It So.
Use 64 bits for incremental cache in-file positions
We currently use a 32-bit integer to encode byte positions into the incremental cache.
This is not enough when the query chache file is >4GB.
As the overflow check was a `debug_assert`, it was removed in released compilers, making compilation succeed silently.
At the next compilation, cache decoding would try to read unrelated data because of garbled file position, triggering an ICE.
Fixes https://github.com/rust-lang/rust/issues/79786
(I'm closing that bug since it the original report and the subsequent questions are probably different instances. A new bug should be opened for new instances of that ICE.)