enable test_join test in Miri
Miri for quite a while now has a hack to support self-referential generators: non-`Unique` mutable references are exempt from aliasing conditions. So we can run this test now. (It passes.)
Also extend a comment in a Vec test, while I am at it.
Rollup of 8 pull requests
Successful merges:
- #113010 (rust-installer & rls: remove exclusion from rustfmt & tidy )
- #113317 ( -Ztrait-solver=next: stop depending on old solver)
- #113319 (`TypeParameterDefinition` always require a `DefId`)
- #113320 (Add some extra information to opaque type cycle errors)
- #113321 (Move `ty::ConstKind` to `rustc_type_ir`)
- #113337 (Winnow specialized impls during selection in new solver)
- #113355 (Move most coverage code out of `rustc_codegen_ssa`)
- #113356 (Add support for NetBSD/riscv64 aka. riscv64gc-unknown-netbsd.)
r? `@ghost`
`@rustbot` modify labels: rollup
Move most coverage code out of `rustc_codegen_ssa`
*This is one step in my larger coverage refactoring ambitions described at <https://github.com/rust-lang/compiler-team/issues/645>.*
The backend implementation of coverage instrumentation was originally split between SSA and LLVM, perhaps in the hopes that it could be used by other backends.
In practice, this split mostly just makes the coverage implementation harder to navigate and harder to modify. It seems unlikely that any backend will actually implement coverage instrumentation in the foreseeable future, especially since many parts of the existing implementation (outside the LLVM backend) are heavily tied to the specific details of LLVM's coverage instrumentation features.
The current shared implementation of `codegen_coverage` is heavily tied to the details of `StatementKind::Coverage`, which makes those details difficult to change. I have reason to want to change those details as part of future fixes/improvements, so this will reduce the amount of interface churn caused by those later changes.
---
This is intended to be a pure refactoring change, with no changes to actual behaviour. All of the “added” code has really just been moved from other files.
Winnow specialized impls during selection in new solver
We need to be able to winnow impls that are specialized by more specific impls in order for codegen to be able to proceed.
r? ``@lcnr``
Move `ty::ConstKind` to `rustc_type_ir`
Needed this in another PR for custom debug impls, and this will also be required to move the new solver into a separate crate that does not use `TyCtxt` so that r-a and friends can depend on the trait solver.
Rebased on top of #113325, only the second and third commits needs reviewing
Add some extra information to opaque type cycle errors
Plus a bunch of cleanups.
This should help users debug query cycles due to auto trait checking. We'll probably want to fix cycle errors in most (or all?) cases by looking at the current item's hidden types (new solver does this), and by delaying the auto trait checks to after typeck.
`TypeParameterDefinition` always require a `DefId`
the `None` case never actually reaches diagnostics so it feels better for diagnostics to be able to rely on the `DefId` being there, cc #113310
rust-installer & rls: remove exclusion from rustfmt & tidy
<strike>based on #112884</strike>
`rust-installer` and `rls` no longer submodules, but not removed from exclude list for rustfmt and tidy, preventing running fmt and lints on them.
Effects/keyword generics MVP
This adds `feature(effects)`, which adds `const host: bool` to the generics of const functions, const traits and const impls. This will be used to replace the current logic around const traits.
r? `@oli-obk`
Don't require associated types with Self: Sized bounds in `dyn Trait` objects
Trait objects require *all* associated types to be specified, even if the associated type has an explicit `where Self: Sized` bound. The following snippet does not compile on master, but does with this PR.
```rust
fn _assert_is_object_safe(_: &dyn Foo) {}
pub trait Foo {
type Bar where Self: Sized;
}
```
In contrast, if a `Self: Sized` bound is added to a method, the methodjust isn't callable on trait objects, but the trait can be made object safe just fine.
```rust
fn _assert_is_object_safe(_: &dyn Foo) {}
pub trait Foo {
fn foo() where Self: Sized;
}
```
This PR closes this inconsistency (though it still exists for associated constants).
Additionally this PR adds a new lint that informs users they can remove associated type bounds from their trait objects if those associated type bounds have a `where Self: Sized` bound, and are thus useless.
r? `@compiler-errors`
Add simple markdown formatting to `rustc --explain` output
This is a second attempt at #104540, which is #63128 without dependencies.
This PR adds basic markdown formatting to `rustc --explain` output when available. Currently, the output just displays raw markdown: this works of course, but it really doesn't look very elegant. (output is `rustc --explain E0038`)
<img width="583" alt="image" src="https://github.com/rust-lang/rust/assets/13724985/ea418117-47af-455b-83c0-6fc59276efee">
After this patch, sample output from the same file:
<img width="693" alt="image" src="https://github.com/rust-lang/rust/assets/13724985/12f7bf9b-a3fe-4104-b74b-c3e5227f3de9">
This also obeys the `--color always/auto/never` command option. Behavior:
- If pager is available and supports color, print with formatting to the pager
- If pager is not available or fails print with formatting to stdout - otherwise without formatting
- Follow `--color always/never` if suppied
- If everything fails, just print plain text to stdout
r? `@oli-obk`
cc `@estebank`
(since the two of you were involved in the previous discussion)
add `ecx.probe_candidate`
Not yet changing the candidate source to an enum because that would be more involved, but this by itself should already be a significant improvement imo
r? `@BoxyUwU`
Rollup of 5 pull requests
Successful merges:
- #113192 (`assemble_candidates_after_normalizing_self_ty` docs)
- #113251 (Use scoped-tls for SMIR to map between TyCtxt and SMIR datastructures)
- #113282 (Update platform-support.md to improve ARM target descriptions)
- #113296 (add flag for enabling global cache usage for proof trees and printing proof trees on error)
- #113324 (implement `ConstEvaluatable` goals in new solver)
r? `@ghost`
`@rustbot` modify labels: rollup
Replace `mk_const` with `Const::new_x` methods
Part of rust-lang/compiler-team#616. Instead of just havign `Const::new(` and nothing else I did it like this since this is more like how the `mk_x` works for `Ty`, and also another PR of mine will require changing from `Const::new(` to `Const::new_x(` anyway.
r? `@oli-bok`
implement `ConstEvaluatable` goals in new solver
this only supports stable const generics. `feature(generic_const_exprs)` needs to extend that function is non-trivial ways. Leaving this for someone else or some later date.
r? `@BoxyUwU`
add flag for enabling global cache usage for proof trees and printing proof trees on error
This adds a few new things:
- `-Zdump-solver-proof-tree=always/never/on-error`
- `always`/`never` were previosuly specifiable by whether the flag exists or not, th new flag is `on_error` which reruns obligations of fulfillment and selection errors with proof tree generation enabled and prints them out
- `-Zdump-solver-proof-tree-uses-cache`
- allows forcing global cache to be used or unused for all generated proof trees, global cache is enabled by default for `always` so that it accurately represents what happend. This flag currently would affect misc uses of `GenerateProofTree::Yes` which will be added in the future for things like diagnostics logic and rustdoc's auto_trait file. We can fix this when we start using proof tree generation for those use cases if it's desirable.
I also changed the output to go straight to stdout instead of going through `debug!` so that `-Zdump-solver-proof-tree` can be adequately used on `nightly` not just a locally built toolchain.
The idea for `on-error` is that it should hopefully make it easier to quickly figure out "why doesnt this code compile"- you just pass in `-Zdump-solver-proof-tree=on-error` and you'll only get proof trees you care about.
---
r? `@lcnr` `@compiler-errors`
Update platform-support.md to improve ARM target descriptions
Updates the descriptions of the various ARM targets in platform-support.md so they are a little more consistent.
For example, all instances of ARMv7 are changed to ARMv7-A (as opposed to ARMv7-R and ARMv7-M). I also remove the Cortex-Mx CPUs on the thumbv6/7m targets, as most of the other targets refer only to CPU architectures and not specific CPUs (and the list was missing on thumbv8m anyway, so this is more consistent).