interpret/validity: properly treat zero-variant enums so that we do not have to check layout.is_uninhabited
I am very happy to finally remove the last of these somewhat ad-hoc checks. :)
r? @oli-obk
Fix const-eval of shared generic reborrows
`Rvalue::Reborrow` const-eval now handles shared generic reborrows produced by `CoerceShared`. Those reborrows intentionally copy from the source ADT into a distinct same-layout target ADT, so the interpreter uses the transmute-capable copy path for `Mutability::Not`.
Promotion is intentionally kept conservative: promotion candidates whose validated temporary graph contains `Rvalue::Reborrow` are rejected, so generic/user-defined reborrows are not promoted.
Fixesrust-lang/rust#156313.
cc @aapoalas
Tracking: rust-lang/rust#145612
@rustbot label F-reborrow
Add missing --set rust.codegen-backends=["gcc"] in the gcc codegen Dockerfile for the core tests
The CI would use cranelift instead of the gcc codegen.
This fixes it and was tested in rust-lang/rust#156964.
r? @Kobzol
cc @GuillaumeGomez
fix breakpoint callback registration in `lldb_batchmode`
We'd been failing to register the callback for a while now, because it couldn't find the specified function. This change imports `lldb_batchmode` and uses the namespaced name of the function.
As an aside, I'm relatively sure this breakpoint callback isn't necessary anymore. Whenever lldb stops at a breakpoint, it updates the selected thread/frame automatically. I don't want to remove it quite yet because I *might* need it for some bookkeeping with the `lldb-repr` directive (and `--bless` behavior)
rustc_on_unimplemented: introduce format specifiers
...as printing options for the annotated item.
See also the test and dev guide prose. This only affects rustc_on_unimplemented, not (yet) the other diagnostic attributes. I plan to do that in some later PR.
```rust
#![feature(rustc_attrs)]
#[rustc_on_unimplemented(
message = "normal: {This}, path: {This:path}, resolved: {This:resolved}"
)]
pub trait Trait<'lifetime, const CONST_GENERIC: usize, A, B> where A: Send {}
```
will do:
```
normal: Trait, path: Trait<'lifetime, CONST_GENERIC, A, B>, resolved: Trait<'_, 6, u8, _>
```
compiletest: sort unexpected and unimportant errors
Sort unexpected errors before printing in tests, this helps inserting annotations manually from bottom to top and searching for errors is a bit simpler.
Output before:
```rust
tests/ui/delegation/explicit-paths.rs:47:9: ERROR: method `foo3` is not a member of trait `Trait` [E0407]
tests/ui/delegation/explicit-paths.rs:48:9: ERROR: method `foo4` is not a member of trait `Trait` [E0407]
tests/ui/delegation/explicit-paths.rs:27:14: ERROR: cannot find function `foo4` in `S` [E0425]
tests/ui/delegation/explicit-paths.rs:37:18: ERROR: cannot find function `foo4` in `F` [E0425]
tests/ui/delegation/explicit-paths.rs:48:18: ERROR: cannot find function `foo4` in `F` [E0425]
tests/ui/delegation/explicit-paths.rs:59:18: ERROR: cannot find function `foo4` in `F` [E0425]
tests/ui/delegation/explicit-paths.rs:67:5: ERROR: conflicting implementations of trait `Trait` for type `S` [E0119]
tests/ui/delegation/explicit-paths.rs:56:36: ERROR: mismatched types [E0308]
tests/ui/delegation/explicit-paths.rs:68:16: ERROR: the trait bound `S2: Trait` is not satisfied [E0277]
tests/ui/delegation/explicit-paths.rs:68:30: ERROR: mismatched types [E0308]
```
Output after:
```rust
tests/ui/delegation/explicit-paths.rs:27:14: ERROR: cannot find function `foo4` in `S` [E0425]
tests/ui/delegation/explicit-paths.rs:37:18: ERROR: cannot find function `foo4` in `F` [E0425]
tests/ui/delegation/explicit-paths.rs:47:9: ERROR: method `foo3` is not a member of trait `Trait` [E0407]
tests/ui/delegation/explicit-paths.rs:48:9: ERROR: method `foo4` is not a member of trait `Trait` [E0407]
tests/ui/delegation/explicit-paths.rs:48:18: ERROR: cannot find function `foo4` in `F` [E0425]
tests/ui/delegation/explicit-paths.rs:56:36: ERROR: mismatched types [E0308]
tests/ui/delegation/explicit-paths.rs:59:18: ERROR: cannot find function `foo4` in `F` [E0425]
tests/ui/delegation/explicit-paths.rs:67:5: ERROR: conflicting implementations of trait `Trait` for type `S` [E0119]
tests/ui/delegation/explicit-paths.rs:68:16: ERROR: the trait bound `S2: Trait` is not satisfied [E0277]
tests/ui/delegation/explicit-paths.rs:68:30: ERROR: mismatched types [E0308]
```
r? @petrochenkov
compiletest: Simplify `//@ needs-asm-mnemonic: ret` to just `//@ needs-asm-ret`
- Simplification of https://github.com/rust-lang/rust/pull/155692.
---
The `needs-asm-mnemonic` directive was very general, but in practice was only being used for `ret`. There are very few other mnemonics that it could plausibly be useful for (e.g. `nop`), because any instruction that requires arguments is probably going to be non-portable.
This PR replaces `needs-asm-mnemonic` with a simpler `needs-asm-ret` directive that uses the same machinery as other simple needs directives.
If we happend to need more mnemonics in the future, we can just add more simple directives as appropriate (e.g. `needs-asm-nop`).
Replace rustfmt code of conduct with link
In rust-lang/rust#65141 we replaced the CoC file and linked the "authoritative source" on the website. I noticed that the rustfmt directory still has the CoC original file.
I *think* for consistency it makes sense to have all of them linked but I'd like to hear from @calebcartwright first :-)
r? @Mark-Simulacrum
The `needs-asm-mnemonic` directive was very general, but in practice was only
being used for `ret`. There are very few other mnemonics that it could
plausibly be useful for (e.g. `nop`), because any instruction that requires
arguments is probably going to be non-portable.
This PR replaces `needs-asm-mnemonic` with a simpler `needs-asm-ret` directive
that uses the same machinery as other simple needs directives.
If we happend to need more mnemonics in the future, we can just add more simple
directives as appropriate (e.g. `needs-asm-nop`).
compiletest: Prepare all simple `//@ needs-*` conditions in advance
This PR makes compiletest check almost all `//@ needs-*` conditions in advance, separate from individual tests or directives. The results of these checks are stored in a prepared hashmap that can then be inspected by individual tests when encountering a needs-* directive.
This is *similar* to how `ignore-*`/`only-*` directives work (as of https://github.com/rust-lang/rust/pull/149470), though currently the two mechanisms don't share code, as they have subtly different requirements.
r? jieyouxu
Updates the description in the `tests/fail/tree_borrows/implicit_writes/as_mut_ptr.rs` test. The referenced file no longer exists.
Co-authored-by: Ralf Jung <post@ralfj.de>
Fix jump to def link generation on primitive type associated methods
Fixesrust-lang/rust#156707.
Interestingly enough, the inference fails on primitive type, so instead I go around a bit by generating a `PrimitiveType` and then tweak a bit the `href` generation.
r? @fmease