This commit adds a test for the current behaviour of signature deduction
of generators when there is a type mismatch between the return type of
the function body and the signature.
rustc: Always handle exported symbols on the wasm target
Currently when linking an artifact rustc will only conditionally call
the `Linker::export_symbols` function, but this causes issues on some
targets, like WebAssembly, where it means that executable outputs will
not have the same symbols exported that cdylib outputs have. This commit
sinks the conditional call to `export_symbols` inside the various
implementations of the function that still need it, and otherwise the
wasm linker is configured to always pass through symbol visibility
lists.
The Genesis of Generic Germination
*Long had its coming been foretold: a collaborative effort with @yodaldevoid, set in motion by @jplatte, to beget a new Kind: one of a very different Sort to those that come before it. Amidst promises of ineffable powers previously thought unobtainable, few dared believe that the prophecies were true. But as they gazed upon that which claimed to be the Beginning, a few gentle sparks of hope fluttered deep within. It was not Time yet. But it was a Sign. And maybe, for some, that was enough.*
There's a long way to go, but we're at the point where we would benefit from GitHub's reviewing capabilities.
r? @eddyb
introduce unescape module
A WIP PR to gauge early feedback
Currently, we deal with escape sequences twice: once when we [lex](112f7e9ac5/src/libsyntax/parse/lexer/mod.rs (L928-L1065)) a string, and a second time when we [unescape](112f7e9ac5/src/libsyntax/parse/mod.rs (L313-L366)) literals. Note that we also produce different sets of diagnostics in these two cases.
This PR aims to remove this duplication, by introducing a new `unescape` module as a single source of truth for character escaping rules.
I think this would be a useful cleanup by itself, but I also need this for https://github.com/rust-lang/rust/pull/59706.
In the current state, the PR has `unescape` module which fully (modulo bugs) deals with string and char literals. I am quite happy about the state of this module
What this PR doesn't have yet are:
* [x] handling of byte and byte string literals (should be simple to add)
* [x] good diagnostics
* [x] actual removal of code from lexer (giant `scan_char_or_byte` should go away completely)
* [x] performance check
* [x] general cleanup of the new code
Diagnostics will be the most labor-consuming bit here, but they are mostly a question of just correctly adjusting spans to sub-tokens. The current setup for diagnostics is that `unescape` produces a plain old `enum` with various problems, and they are rendered into `Handler` separately. This bit is not actually required (it is possible to just pass the `Handler` in), but I like the separation between diagnostics and logic this approach imposes, and such separation should again be useful for #59706
cc @eddyb , @petrochenkov
... on different platforms.
Official rustdoc of
[`usize::to_le_bytes`](https://doc.rust-lang.org/std/primitive.usize.html#method.to_le_bytes)
displays signature
```
pub fn to_ne_bytes(self) -> [u8; 8]
```
which might be misleading: this function returns 4 bytes on 32-bit
systems.
Rollup of 5 pull requests
Successful merges:
- #60131 (Fix broken link in rustc_plugin doc)
- #60426 (Stop `-O`/`-C opt-level` and `-g`/`-C debuginfo` conflicting)
- #60515 (use span instead of div for since version)
- #60530 (rustc: rename all occurences of "freevar" to "upvar".)
- #60536 (Correct code points to match their textual description)
Failed merges:
r? @ghost
Correct code points to match their textual description
Probably due to a copy-paste error, in the sentence
> For example, despite looking similar, the 'é' character is one Unicode code point while 'é' is two Unicode code points:
the two `é`'s were actually the same character in the text (i.e. the same Unicode character U+00E9).
The code listing below instead had two different Unicode characters for the two `é`s, as it was supposed to.
The example shown wasn't clear at first so I started inspecting the text and found this out.
I simply copied the character from the code listing to the description surrounding the code.
It's a minor thing but I thought it would make things clearer for others, especially since the example is about how Rust handles `char`s.
rustc: rename all occurences of "freevar" to "upvar".
Most of the more recent code talks about "(closure) upvars", so I believe that's the name we want to use.
There's also the possibility of using "capture" which is more user-facing, but I'd rather not change *both* "freevar" and "upvar" to something else in this one PR.
cc @nikomatsakis @petrochenkov
Move pointee_info_at from rustc_codegen_llvm to rustc_target.
Makes progress towards #56166.
This is a continuation of https://github.com/rust-lang/rust/pull/57150.
@oli-obk Should I close the older PR?
Rename `PathResolution` to `PartialRes`
Don't use `PartialRes` when `Res` is enough.
Rename `Res::kind_name` to `Res::descr` for consistency.
Remove `Res::Label`, paths can never resolve to labels.
Some further cleanup after https://github.com/rust-lang/rust/pull/60462
r? @eddyb
rustc: collapse relevant DefPathData variants into {Type,Value,Macro,Lifetime}Ns.
`DefPathData` was meant to disambiguate within each namespace, but over the years, that purpose was overlooked, and it started to serve a double-role as a sort of `DefKind` (which #60462 properly adds).
Now, we can go back to *only* categorizing namespaces (at least for the variants with names in them).
r? @petrochenkov or @nikomatsakis cc @michaelwoerister