Add support for `const unsafe? extern fn`
This works just as you might expect - an `const extern fn` is a `const fn` that is callable from foreign code.
Currently, panicking is not allowed in `const`s. When https://github.com/rust-lang/rfcs/pull/2345 (https://github.com/rust-lang/rust/issues/51999) is stabilized, then panicking in an `const extern fn` will produce a compile-time error when invoked at compile time, and an abort when invoked at runtime.
Since this is extending the language (we're allowing the `const` keyword in a new context), I believe that this will need an FCP. However, it's a very minor change, so I didn't think that filing an RFC was necessary.
This will allow libc (and other FFI crates) to make many functions `const`, without having to give up on making them `extern` as well.
Tracking issue: https://github.com/rust-lang/rust/issues/64926.
- 771c5d10cf944bf7d221f5d6cb7abd2a06c400e4 Add macros in extern blocks and new proc-macro support.
- 8caabd62ef5fbe99e6be6aa9e76f55bbb8433d95 Update for "modern" `meta` matcher.
- 1b44947d36ccf7eba2b3bd245769eff68abf6d4d Update await desugaring after rust-lang/rust#64292
Remove dead module
This module is not referenced any more. (A quick audit didn't show other stale files like this, so presumably this is the only one.)
Use shorthand initialization in rustdoc
This just fixes a few lints I rust-analyzer was showing. Is this sort of PR useful? Should the lints be fixed as apart of the otherwise unrelated PR I was working on?
Optimize integral pattern matching
Various improvements to integral pattern matching. Together they reduce instruction counts for `unicode_normalization-check-clean` by about 16%.
r? @Mark-Simulacrum
Make re-export collection deterministic
Fixes https://github.com/rust-lang/rust/issues/65036
Previously, we were using an `FxHashMap` to collect module re-exports.
However, re-exports end up getting serialized into crate metadata, which
means that metadata generation was non-deterministic. This resulted in
spurious error messages changes (e.g. PR #64906) due to pretty-printing
implicitly depending on the order of re-exports when computing the
proper path to show to the user.
See #65042 for a long-term strategy to detect this kind of issue
Rollup of 18 pull requests
This contains changes from all the successful runs that bors marked as timed out, plus a revert of #63649 which appears to be the immediate cause of the timeouts.
Successful merges:
- #64708 (Stabilize `Option::as_deref` and `Option::as_deref_mut`)
- #64728 (Stabilize UdpSocket::peer_addr)
- #64765 (std: Reduce checks for `feature = "backtrace"`)
- #64909 (When encountering chained operators use heuristics to recover from bad turbofish)
- #65011 (Do not ICE when dereferencing non-Copy raw pointer)
- #65064 (permit asyncawait-ondeck to be added by anyone)
- #65066 ([const-prop] Fix ICE when trying to eval polymorphic promoted MIR)
- #65100 (Replace GeneratorSubsts with SubstsRef)
- #65105 (Split out some passes from librustc)
- #65106 (Allow unused attributes to avoid incremental bug)
- #65113 (Fix lonely backtick)
- #65116 (Remove unneeded visit_statement definition)
- #65118 (Update the documented default of -Z mutable-noalias)
- #65123 (Account for macro invocation in `let mut $pat` diagnostic.)
- #65124 (Replace some instances of `as *[const | mut] _` with `.cast()`)
- #65126 (Fix typo on `now()` comments)
- #65130 (lint: extern non-exhaustive types are improper)
- #65151 (Revert #63649 - "Upgrade Emscripten targets to use upstream LLVM backend")
Failed merges:
r? @ghost
Revert #63649 - "Upgrade Emscripten targets to use upstream LLVM backend"
This change caused the runtime of the linux-asmjs builder to nearly double from 2+ hours to about 4 hours, which happens to be the bors timeout. (It made it in barely under 4 hours when it was merged.) This is causing timeouts on all new changes.
This reverts commit 7870050796, reversing
changes made to 2e7244807a.
lint: extern non-exhaustive types are improper
This PR makes the `improper_ctype` lint trigger for non-exhaustive types when those types aren't defined in the current crate, as per [this comment](https://github.com/rust-lang/rust/issues/44109#issuecomment-537583344).
cc @Centril
Fix typo on `now()` comments
Fix typo, update words, and remove some redundant word.
Also rustfmt on the rest of the file (hope this is okay :)
revival of #61433
r? @kennytm
Split out some passes from librustc
This is just moving them out to librustc_passes -- I've not measured compile time or run time. I don't expect any significant impact, but this seems prudent regardless.
std: Reduce checks for `feature = "backtrace"`
This is a stylistic change to libstd to reduce the number of checks of
`feature = "backtrace"` now that we unconditionally depend on the
`backtrace` crate and rely on it having an empty implementation.
otherwise.