| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
Point at method definition that causes type to be consumed.
Fix #94056.
|
|
Suggest calling .display() on `PathBuf` too
Fixes #94210
|
|
|
|
|
|
|
|
|
|
|
|
This reverts commit e7cc3bddbe0d0e374d05e7003e662bba1742dbae, reversing
changes made to 734368a200904ef9c21db86c595dc04263c87be0.
|
|
Lazy type-alias-impl-trait
Previously opaque types were processed by
1. replacing all mentions of them with inference variables
2. memorizing these inference variables in a side-table
3. at the end of typeck, resolve the inference variables in the side table and use the resolved type as the hidden type of the opaque type
This worked okayish for `impl Trait` in return position, but required lots of roundabout type inference hacks and processing.
This PR instead stops this process of replacing opaque types with inference variables, and just keeps the opaque types around.
Whenever an opaque type `O` is compared with another type `T`, we make the comparison succeed and record `T` as the hidden type. If `O` is compared to `U` while there is a recorded hidden type for it, we grab the recorded type (`T`) and compare that against `U`. This makes implementing
* https://github.com/rust-lang/rfcs/pull/2515
much simpler (previous attempts on the inference based scheme were very prone to ICEs and general misbehaviour that was not explainable except by random implementation defined oddities).
r? `@nikomatsakis`
fixes #93411
fixes #88236
|
|
Suggest 1-tuple parentheses on exprs without existing parens
A follow-on from #86116, split out from #90677.
This alters the suggestion to add a trailing comma to create a 1-tuple - previously we would only apply this if the relevant expression was parenthesised. We now make the suggestion regardless of parentheses, which reduces the fragility of the check (w.r.t formatting).
e.g.
```rust
let a: Option<(i32,)> = Some(3);
```
gets the below suggestion:
```rust
let a: Option<(i32,)> = Some((3,));
// ^ ^^
```
This change also improves the suggestion in other ways, such as by only making the suggestion if the types would match after the suggestion is applied and making the suggestion a multipart suggestion.
|
|
by using an opaque type obligation to bubble up comparisons between opaque types and other types
Also uses proper obligation causes so that the body id works, because out of some reason nll uses body ids for logic instead of just diagnostics.
|
|
When writing `Vec<A:B>`, suggest `Vec<A::B>`.
|
|
Rollup of 8 pull requests
Successful merges:
- #90277 (Improve terminology around "after typeck")
- #92918 (Allow eliding GATs in expression position)
- #93039 (Don't suggest inaccessible fields)
- #93155 (Switch pretty printer to block-based indentation)
- #93214 (Respect doc(hidden) when suggesting available fields)
- #93347 (Make `char::DecodeUtf16::size_hist` more precise)
- #93392 (Clarify documentation on char::MAX)
- #93444 (Fix some CSS warnings and errors from VS Code)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Improve suggestion for escaping reserved keywords
r? `@davidtwco`
|
|
Don't suggest inaccessible fields
Fixes: https://github.com/rust-lang/rust/issues/92999
|
|
Add Explanation For Error E0772
I've added an error explanation for the error code E0772.
Assists with #61137
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
r=nagisa
Fix suggesting turbofish with lifetime arguments
Now we suggest turbofish correctly given exprs like `foo<'_>`.
Also fix suggestion when we have `let x = foo<bar, baz>;` which was broken.
|
|
|
|
|
|
|
|
Extends #75931 to also detect where the `let` might be missing from `while let` expressions.
|
|
Constify (most) `Option` methods
r? ``@oli-obk``
|
|
Lint bare traits in AstConv.
Removing the lint from lowering allows to:
- make lowering querification easier;
- have the lint implementation in only one place.
r? `@estebank`
|
|
|
|
extend `simplify_type`
might cause a slight perf inprovement and imo more accurately represents what types there are.
considering that I was going to use this in #85048 it seems like we might need this in the future anyways :shrug:
|
|
|
|
|
|
Avoid suggest adding `self` in visibility spec
Fixes #91783
|
|
Stabilise `feature(const_generics_defaults)`
`feature(const_generics_defaults)` is complete implementation wise and has a pretty extensive test suite so I think is ready for stabilisation.
needs stabilisation report and maybe an RFC :sweat_smile:
r? `@lcnr`
cc `@rust-lang/project-const-generics`
|
|
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
|
|
Tweak assoc type obligation spans
* Point at RHS of associated type in obligation span
* Point at `impl` assoc type on projection error
* Reduce verbosity of recursive obligations
* Point at source of binding lifetime obligation
* Tweak "required bound" note
* Tweak "expected... found opaque (return) type" labels
* Point at set type in impl assoc type WF errors
r? `@oli-obk`
This is a(n uncontroversial) subset of #85799.
|
|
* Point at RHS of associated type in obligation span
* Point at `impl` assoc type on projection error
* Reduce verbosity of recursive obligations
* Point at source of binding lifetime obligation
* Tweak "required bound" note
* Tweak "expected... found opaque (return) type" labels
* Point at set type in impl assoc type WF errors
|
|
|
|
|
|
r=estebank
Do not add `;` to expected tokens list when it's wrong
There's a few spots where semicolons are checked for to do error recovery, and should not be suggested (or checked for other stuff).
Fixes #87647
|
|
Recommend fix `count()` -> `len()` on slices
Fixes #87302
|
|
Fixes #87302
|
|
Also add a test case for inserting a semicolon on extern fns.
Without this fix, we got an error like this:
error: expected one of `->`, `where`, or `{`, found `}`
--> chk.rs:3:1
|
2 | fn foo()
| --- - expected one of `->`, `where`, or `{`
| |
| while parsing this `fn`
3 | }
| ^ unexpected token
Since this is inside an extern block, you're required to write function
prototypes with no body. This fixes a regression, and adds a test case
for it.
|
|
|