Stabilize default_alloc_error_handler
Tracking issue: #66741
This turns `feature(default_alloc_error_handler)` on by default, which causes the compiler to automatically generate a default OOM handler which panics if `#[alloc_error_handler]` is not provided.
The FCP completed over 2 years ago but the stabilization was blocked due to an issue with unwinding. This was fixed by #88098 so stabilization can be unblocked.
Closes#66741
As a workaround for the full `#[refine]` semantics not being implemented
yet, forbit returning a concrete future type like `Box<dyn Future>` or a
manually implemented Future.
`-> impl Future` is still permitted; while that can also cause
accidental refinement, that's behind a different feature gate
(`return_position_impl_trait_in_trait`) and that problem exists
regardless of whether the trait method is async, so will have to be
solved more generally.
Fixes#102745
This migrates everything but the `mbe` and `proc_macro` modules. It also
contains a few cleanups and drive-by/accidental diagnostic improvements
which can be seen in the diff for the UI tests.
This ensures that the error is printed even for unused variables,
as well as unifying the handling between the LLVM and GCC backends.
This also fixes unusual behavior around exported Rust-defined variables
with linkage attributes. With the previous behavior, it appears to be
impossible to define such a variable such that it can actually be imported
and used by another crate. This is because on the importing side, the
variable is required to be a pointer, but on the exporting side, the
type checker rejects static variables of pointer type because they do
not implement `Sync`. Even if it were possible to import such a type, it
appears that code generation on the importing side would add an unexpected
additional level of pointer indirection, which would break type safety.
This highlighted that the semantics of linkage on Rust-defined variables
is different to linkage on foreign items. As such, we now model the
difference with two different codegen attributes: linkage for Rust-defined
variables, and import_linkage for foreign items.
This change gives semantics to the test
src/test/ui/linkage-attr/auxiliary/def_illtyped_external.rs which was
previously expected to fail to compile. Therefore, convert it into a
test that is expected to successfully compile.
The update to the GCC backend is speculative and untested.
Add a detailed note for missing comma typo w/ FRU syntax
Thanks to `@pierwill` for working on this with me!
Fixes#104373, perhaps `@alice-i-cecile` can comment on the new error for the example provided on that issue -- feedback is welcome.
```
error[E0063]: missing field `defaulted` in initializer of `Outer`
--> $DIR/multi-line-fru-suggestion.rs:14:5
|
LL | Outer {
| ^^^^^ missing `defaulted`
|
note: this expression may have been misinterpreted as a `..` range expression
--> $DIR/multi-line-fru-suggestion.rs:16:16
|
LL | inner: Inner {
| ________________^
LL | | a: 1,
LL | | b: 2,
LL | | }
| |_________^ this expression does not end in a comma...
LL | ..Default::default()
| ^^^^^^^^^^^^^^^^^^^^ ... so this is interpreted as a `..` range expression, instead of functional record update syntax
help: to set the remaining fields from `Default::default()`, separate the last named field with a comma
|
LL | },
| +
error: aborting due to previous error
For more information about this error, try `rustc --explain E0063`.
```
Rollup of 8 pull requests
Successful merges:
- #102977 (remove HRTB from `[T]::is_sorted_by{,_key}`)
- #103378 (Fix mod_inv termination for the last iteration)
- #103456 (`unchecked_{shl|shr}` should use `u32` as the RHS)
- #103701 (Simplify some pointer method implementations)
- #104047 (Diagnostics `icu4x` based list formatting.)
- #104338 (Enforce that `dyn*` coercions are actually pointer-sized)
- #104498 (Edit docs for `rustc_errors::Handler::stash_diagnostic`)
- #104556 (rustdoc: use `code-header` class to format enum variants)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Issue error when -C link-self-contained option is used on unsupported platforms
The documentation was also updated to reflect this.
I'm assuming the supported platforms are the same as initially written in [RELEASES.md](https://github.com/rust-lang/rust/blob/master/RELEASES.md#compiler-17).
Fixes#103576
Rollup of 11 pull requests
Successful merges:
- #101967 (Move `unix_socket_abstract` feature API to `SocketAddrExt`.)
- #102470 (Stabilize const char convert)
- #104223 (Recover from function pointer types with generic parameter list)
- #104229 (Don't print full paths in overlap errors)
- #104294 (Don't ICE with inline const errors during MIR build)
- #104332 (Fixed some `_i32` notation in `maybe_uninit`’s doc)
- #104349 (fix some typos in comments)
- #104350 (Fix x finding Python on Windows)
- #104356 (interpret: make check_mplace public)
- #104364 (rustdoc: Resolve doc links in external traits having local impls)
- #104378 (Bump chalk to v0.87)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Wrap bundled static libraries into object files
Fixes#103044 (not sure, couldn't test locally)
Bundled static libraries should be wrapped into object files as it's done for metadata file.
r? `@petrochenkov`
Recover from function pointer types with generic parameter list
Give a more helpful error when encountering function pointer types with a generic parameter list like `fn<'a>(&'a str) -> bool` or `fn<T>(T) -> T` and suggest moving lifetime parameters to a `for<>` parameter list.
I've added a bunch of extra code to properly handle (unlikely?) corner cases like `for<'a> fn<'b>()` (where there already exists a `for<>` parameter list) correctly suggesting `for<'a, 'b> fn()` (merging the lists). If you deem this useless, I can simplify the code by suggesting nothing at all in this case.
I am quite open to suggestions regarding the wording of the diagnostic messages.
Fixes#103487.
``@rustbot`` label A-diagnostics
r? diagnostics
implement binding_shadows
migrate till self-in-generic-param-default
use braces in fluent message as suggested by @compiler-errors.
to fix lock file issue reported by CI
migrate 'unreachable label' error
run formatter
name the variables correctly in fluent file
SessionDiagnostic -> Diagnostic
test "pattern/pat-tuple-field-count-cross.rs" passed
test "resolve/bad-env-capture2.rs" passed
test "enum/enum-in-scope.rs" and other depended on "resolve_binding_shadows_something_unacceptable" should be passed now.
fix crash errors while running test-suite. there might be more.
then_some(..) suits better here.
all tests passed
convert TraitImpl and InvalidAsm. TraitImpl is buggy yet. will fix after receiving help from Zulip
migrate "Ralative-2018"
migrate "ancestor only"
migrate "expected found"
migrate "Indeterminate"
migrate "module only"
revert to the older implementation for now. since this is failing at the moment.
follow the convension for fluent variable
order the diag attribute as suggested in review comment
fix merge error. migrate trait-impl-duplicate
make the changes compatible with "Flatten diagnostic slug modules #103345"
fix merge
remove commented code
merge issues
fix review comments
fix tests