| Age | Commit message (Collapse) | Author | Lines |
|
remove the repetitive word
Signed-off-by: cui fliter <imcusg@gmail.com>
|
|
Permit recursive weak type aliases
I saw #63097 and thought "we can do ~~better~~ funnier". So here it is. It's not useful, but it's certainly something. This may actually become feasible with lazy norm (so in 5 years (constant, not reducing over time)).
r? `@estebank`
cc `@GuillaumeGomez`
|
|
Fix bors missing a commit when merging #115355
bors incorrectly merged an outdated version of PR #115355 (via rollup #115370):
- it [recorded r+](https://github.com/rust-lang/rust/pull/115355#issuecomment-1698372365) as approving commit https://github.com/rust-lang/rust/commit/325b585259871c99093b2a2e9463f941b8aa0ceb, and thus merged the original revision https://github.com/rust-lang/rust/commit/7762ac7bb5ac10046a5a9ee838480a78bf150237
- but the branch at the time was at commit https://github.com/rust-lang/rust/commit/eefa07d69baad3207ad520da8590fb44ef989416, so bors missed the `compiler/rustc_trait_selection/src/solve/search_graph/mod.rs` cleanup in commit https://github.com/rust-lang/rust/pull/115355/commits/0e1e964a349681504e7103d4ec70aca5616222fc 😓
Thankfully the change that bors missed was small, and this new PR corrects the situation (as I'd rather avoid having confusing multiple merge commits of PR #115355 in the git history)
r? ``@compiler-errors``
|
|
|
|
|
|
fixes bors snafu where it merged an outdated commit and missed this
change
|
|
|
|
Rollup of 8 pull requests
Successful merges:
- #115164 (MIR validation: reject in-place argument/return for packed fields)
- #115240 (codegen_llvm/llvm_type: avoid matching on the Rust type)
- #115294 (More precisely detect cycle errors from type_of on opaque)
- #115310 (Document panic behavior across editions, and improve xrefs)
- #115311 (Revert "Suggest using `Arc` on `!Send`/`!Sync` types")
- #115317 (Devacationize oli-obk)
- #115319 (don't use SnapshotVec in Graph implementation, as it looks unused; use Vec instead)
- #115322 (Tweak output of `to_pretty_impl_header` involving only anon lifetimes)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Tweak output of `to_pretty_impl_header` involving only anon lifetimes
Do not print `impl<> Foo for &Bar`.
|
|
Revert "Suggest using `Arc` on `!Send`/`!Sync` types"
Closes https://github.com/rust-lang/rust/issues/114687. This is a clean revert of https://github.com/rust-lang/rust/pull/88936 + https://github.com/rust-lang/rust/pull/115210. The suggestion to Arc\<{Self}\> when Self does not implement Send is *always* wrong.
https://github.com/rust-lang/rust/pull/114842 is considering a way to make a more refined suggestion.
|
|
More precisely detect cycle errors from type_of on opaque
Not sure if this still needs work. Just putting it up for initial impressions, since it seems that a few people are frustrated with the increased error verbosity due to #113320.
Essentially we introduce a new sub-query for `type_of` specifically for opaques which returns a value that is able to distinguish "has errors" from "due to cycle recovery".
Fixes #115188
r? `@oli-obk`
|
|
Do not print `impl<> Foo for &Bar`.
|
|
This reverts commit 9de1a472b68ed85f396b2e2cc79c3ef17584d6e1.
|
|
|
|
|
|
Add an (perma-)unstable option to disable vtable vptr
This flag is intended for evaluation of trait upcasting space cost for embedded use cases.
Compared to the approach in #112355, this option provides a way to evaluate end-to-end cost of trait upcasting. Rationale: https://github.com/rust-lang/rust/issues/112355#issuecomment-1658207769
## How this flag should be used (after merge)
Build your project with and without `-Zno-trait-vptr` flag. If you are using cargo, set `RUSTFLAGS="-Zno-trait-vptr"` in the environment variable. You probably also want to use `-Zbuild-std` or the binary built may be broken. Save both binaries somewhere.
### Evaluate the space cost
The option has a direct and indirect impact on vtable space usage. Directly, it gets rid of the trait vptr entry needed to store a pointer to a vtable of a supertrait. (IMO) this is a small saving usually. The larger saving usually comes with the indirect saving by eliminating the vtable of the supertrait (and its parent).
Both impacts only affects vtables (notably the number of functions monomorphized should , however where vtable reside can depend on your relocation model. If the relocation model is static, then vtable is rodata (usually stored in Flash/ROM together with text in embedded scenario). If the binary is relocatable, however, the vtable will live in `.data` (more specifically, `.data.rel.ro`), and this will need to reside in RAM (which may be a more scarce resource in some cases), together with dynamic relocation info living in readonly segment.
For evaluation, you should run `size` on both binaries, with and without the flag. `size` would output three columns, `text`, `data`, `bss` and the sum `dec` (and it's hex version). As explained above, both `text` and `data` may change. `bss` shouldn't usually change. It'll be useful to see:
* Percentage change in text + data (indicating required flash/ROM size)
* Percentage change in data + bss (indicating required RAM size)
|
|
this previously was a off-by-one error.
|
|
This flag is intended for evaluation of trait upcasting
space cost for embedded use cases.
|
|
Speed up compilation of `type-system-chess`
[`type-system-chess`](https://github.com/rust-lang/rustc-perf/pull/1680) is an unusual program that implements a compile-time chess position solver in the trait system(!) This PR is about making it compile faster.
r? `@ghost`
|
|
Point at return type when it influences non-first `match` arm
When encountering code like
```rust
fn foo() -> i32 {
match 0 {
1 => return 0,
2 => "",
_ => 1,
}
}
```
Point at the return type and not at the prior arm, as that arm has type `!` which isn't influencing the arm corresponding to arm `2`.
Fix #78124.
|
|
compiler-errors:next-solver-projection-subst-compat, r=lcnr
Check projection args before substitution in new solver
Don't ICE when an impl has the wrong kind of GAT arguments
r? lcnr
|
|
compiler-errors:next-solver-only-unsize-to-dyn-once, r=lcnr
Separate `consider_unsize_to_dyn_candidate` from other unsize candidates
Move the unsize candidate assembly *just for* `T -> dyn Trait` out of `assemble_candidates_via_self_ty` so that we only consider it once, instead of for every normalization step of the self ty. This makes sure that we don't assemble several candidates that are equal modulo normalization when we really don't care about normalizing the self type of an `T: Unsize<dyn Trait>` goal anyways.
Fixes rust-lang/trait-system-refactor-initiative#57
r? lcnr
|
|
Probe when assembling upcast candidates so they don't step on eachother's toes in new solver
Lack of a probe causes one candidate to disqualify the other due to inference side-effects.
r? lcnr
|
|
r=lcnr
Only consider object candidates for object-safe dyn types in new solver
We apparently allow this per RFC2027 :skull:
r? lcnr
|
|
|
|
|
|
Co-authored-by: lcnr <rust@lcnr.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
When encountering code like
```rust
fn foo() -> i32 {
match 0 {
1 => return 0,
2 => "",
_ => 1,
}
}
```
Point at the return type and not at the prior arm, as that arm has type
`!` which isn't influencing the arm corresponding to arm `2`.
Fix #78124.
|
|
|
|
normalize in `trait_ref_is_knowable` in new solver
fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/51
Alternatively we could avoid normalizing the self type and do this at the end of the `assemble_candidates_via_self_ty` stack by splitting candidates into:
- applicable without normalizing self type
- applicable for aliases, even if they can be normalized
- applicable for stuff which cannot get normalized further
I don't think this would have any significant benefits and it also seems non-trivial to avoid normalizing only the self type in `trait_ref_is_knowable`.
r? `@compiler-errors`
|
|
|
|
|
|
|
|
Fix a couple of bad comments
A couple of nits I saw. Sorry, this really should be folded into some other PR of mine, but I will literally forget if I don't put these up now.
|
|
|
|
|
|
|
|
Migrate a trait selection error to use diagnostic translation
|
|
correctly lower `impl const` to bind to host effect param
r? `@oli-obk`
|
|
|
|
Avoids lots of resizing as the set fills up.
|
|
And rename a closure argument.
|
|
Structurally normalize weak and inherent in new solver
It seems pretty obvious to me that we should be normalizing weak and inherent aliases too, since they can always be normalized. This PR still leaves open the question of what to do with opaques, though 💀
**Also**, we need to structurally resolve the target of a coercion, for the UI test to work.
r? `@lcnr`
|
|
r=oli-obk
Store the laziness of type aliases in their `DefKind`
Previously, we would treat paths referring to type aliases as *lazy* type aliases if the current crate had lazy type aliases enabled independently of whether the crate which the alias was defined in had the feature enabled or not.
With this PR, the laziness of a type alias depends on the crate it is defined in. This generally makes more sense to me especially if / once lazy type aliases become the default in a new edition and we need to think about *edition interoperability*:
Consider the hypothetical case where the dependency crate has an older edition (and thus eager type aliases), it exports a type alias with bounds & a where-clause (which are void but technically valid), the dependent crate has the latest edition (and thus lazy type aliases) and it uses that type alias. Arguably, the bounds should *not* be checked since at any time, the dependency crate should be allowed to change the bounds at will with a *non*-major version bump & without negatively affecting downstream crates.
As for the reverse case (dependency: lazy type aliases, dependent: eager type aliases), I guess it rules out anything from slight confusion to mild annoyance from upstream crate authors that would be caused by the compiler ignoring the bounds of their type aliases in downstream crates with older editions.
---
This fixes #114468 since before, my assumption that the type alias associated with a given weak projection was lazy (and therefore had its variances computed) did not necessarily hold in cross-crate scenarios (which [I kinda had a hunch about](https://github.com/rust-lang/rust/pull/114253#discussion_r1278608099)) as outlined above. Now it does hold.
`@rustbot` label F-lazy_type_alias
r? `@oli-obk`
|