Michael Goulet
a2b6744af0
Use &mut Diagnostic instead of &mut DiagnosticBuilder unless needed
2022-08-10 03:45:42 +00:00
Camille GILLOT
6733bc3066
Remove guess_head_span.
2022-07-28 23:14:04 +02:00
Guillaume Gomez
c37ee1a7e0
Rollup merge of #99728 - cjgillot:ast-lifetimes-anon-clean, r=petrochenkov
...
Clean up HIR-based lifetime resolution
Based on https://github.com/rust-lang/rust/pull/97313 .
Fixes #98932 .
r? `@petrochenkov`
2022-07-27 17:55:07 +02:00
Camille GILLOT
4b2f06b8a9
Pacify tidy.
2022-07-26 19:00:31 +02:00
Camille GILLOT
556b02704f
Stop creating anonymous late lifetimes.
2022-07-26 19:00:31 +02:00
Camille GILLOT
ad1b1819eb
Remove resolve_elided_lifetimes.
2022-07-26 19:00:31 +02:00
Camille GILLOT
30565e5871
Stop resolving lifetime elision on HIR.
2022-07-26 19:00:31 +02:00
Camille GILLOT
10be0dd8df
Replace LifetimeRes::Anonymous by LifetimeRes::Infer.
2022-07-26 19:00:31 +02:00
Camille GILLOT
ab63591f00
Remove the distinction between LifetimeName::Implicit and LifetimeName::Underscore.
2022-07-26 19:00:31 +02:00
Matthias Krüger
ddb6a46316
Rollup merge of #99729 - cjgillot:rm-unused-tuple, r=michaelwoerister
...
Remove unused tuple fields
Found by https://github.com/rust-lang/rust/pull/95977
2022-07-26 16:57:50 +02:00
Camille GILLOT
9450f822fb
Unused tuple fields in rustc_resolve.
2022-07-25 19:45:26 +02:00
Camille GILLOT
3148ea31eb
Update file description.
2022-07-25 19:19:23 +02:00
Camille GILLOT
3c5048d2ec
Report elision failures on the AST.
2022-07-25 19:19:23 +02:00
Matthias Krüger
4815f94c51
Rollup merge of #99401 - TaKO8Ki:avoid-symbol-to-&str-conversions, r=nnethercote
...
Avoid `Symbol` to `&str` conversions
`Symbol::as_str` is a slowish operation, so this patch removes some usages of it.
2022-07-19 13:30:46 +02:00
Takayuki Maeda
a22934bea1
avoid Symbol
to &str
conversions
2022-07-18 14:25:34 +09:00
Dylan DPC
e5a86d7358
Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillot
...
Implement `for<>` lifetime binder for closures
This PR implements RFC 3216 ([TI](https://github.com/rust-lang/rust/issues/97362 )) and allows code like the following:
```rust
let _f = for<'a, 'b> |a: &'a A, b: &'b B| -> &'b C { b.c(a) };
// ^^^^^^^^^^^--- new!
```
cc ``@Aaron1011`` ``@cjgillot``
2022-07-14 14:14:21 +05:30
Camille GILLOT
5a20834884
Add feature gate.
2022-07-13 14:17:09 +02:00
Maybe Waffle
df4fee9841
Add an indirection for closures in hir::ExprKind
...
This helps bring `hir::Expr` size down, `Closure` was the biggest
variant, especially after `for<>` additions.
2022-07-12 21:00:13 +04:00
Maybe Waffle
0c284843ba
make for<> in closures a possible place to suggest adding named lifetime
2022-07-12 21:00:13 +04:00
Maybe Waffle
c2dbd62c7c
Lower closure binders to hir & properly check them
2022-07-12 21:00:03 +04:00
Takayuki Maeda
bda83e6543
avoid some &str
to String
conversions
2022-07-10 03:18:56 +09:00
Camille GILLOT
2a7abed87f
Return a FxIndexSet in is_late_bound query.
...
This return value is iterated upon by borrowck, hence the need to preserve
a deterministic iteration order.
2022-07-05 21:54:40 +02:00
Matthias Krüger
6ee667374e
Rollup merge of #98677 - lyming2007:issue-98492-fix, r=lcnr
...
For diagnostic information of Boolean, remind it as use the type: 'bool'
Fixes #98492 .
It helps programmers coming from other languages
modified: compiler/rustc_resolve/src/late/diagnostics.rs
2022-06-30 19:55:53 +02:00
Yiming Lei
15d3ea504a
For diagnostic information of Boolean, remind it as use the type: 'bool'
...
It helps programmers coming from other languages
modified: compiler/rustc_resolve/src/late/diagnostics.rs
modified: src/test/ui/lint/recommend-literal.rs
modified: src/test/ui/lint/recommend-literal.stderr
modified: compiler/rustc_resolve/src/late/diagnostics.rs
modified: src/test/ui/lint/recommend-literal.rs
modified: src/test/ui/lint/recommend-literal.stderr
modified: compiler/rustc_resolve/src/late/diagnostics.rs
modified: src/test/ui/lint/recommend-literal.rs
modified: src/test/ui/lint/recommend-literal.stderr
2022-06-30 08:34:10 -07:00
Takayuki Maeda
6212e6b339
avoid many &str
to String
conversions with MultiSpan::push_span_label
2022-06-29 21:16:43 +09:00
bors
10f4ce324b
Auto merge of #98279 - cjgillot:all-fresh-nofn, r=petrochenkov
...
Create elided lifetime parameters for function-like types
Split from https://github.com/rust-lang/rust/pull/97720
This PR refactor lifetime generic parameters in bare function types and parenthesized traits to introduce the additional required lifetimes as fresh parameters in a `for<>` bound.
This PR does the same to lifetimes appearing in closure signatures, and as-if introducing `for<>` bounds on closures (without the associated change in semantics).
r? `@petrochenkov`
2022-06-22 10:48:58 +00:00
Camille GILLOT
7437136f0e
Use CreateParameter mode for closures too.
2022-06-21 21:13:43 +02:00
Camille GILLOT
32af719b07
Always create parameters for functions-like types.
2022-06-21 21:13:41 +02:00
Santiago Pastorino
5ed1495041
This comment is out dated and misleading
...
Arms are about TAIT and RPIT, as the variants clearly show.
2022-06-21 12:43:58 -03:00
Matthias Krüger
3e5800b8d3
Rollup merge of #98267 - compiler-errors:suggest-wildcard-arm, r=oli-obk
...
Don't omit comma when suggesting wildcard arm after macro expr
* Also adds `Span::eq_ctxt` to consolidate the various usages of `span.ctxt() == other.ctxt()`
* Also fixes an unhygenic usage of spans which caused the suggestion to render weirdly when we had one arm match in a macro
* Also always suggests a comma (i.e. even after a block) if we're rendering a wildcard arm in a single-line match (looks prettier 🌹 )
Fixes #94866
2022-06-20 20:13:10 +02:00
Michael Goulet
047de83e02
Don't suggest adding Self as a type parameter
2022-06-19 19:44:00 -07:00
Michael Goulet
018c319b21
Mention what item is using an invalid Self
type
2022-06-19 19:43:40 -07:00
Michael Goulet
52c9906c4b
Use Span::eq_ctxt
method instead of .ctxt() == .ctxt()
2022-06-19 16:46:59 -07:00
bors
3a8b0144c8
Auto merge of #98106 - cjgillot:split-definitions, r=michaelwoerister
...
Split up `Definitions` and `ResolverAstLowering`.
Split off https://github.com/rust-lang/rust/pull/95573
r? `@michaelwoerister`
2022-06-17 10:00:11 +00:00
Yuki Okushi
0ee15040d5
Rollup merge of #97822 - compiler-errors:hesitate-to-suggest-intrinsics, r=oli-obk
...
Filter out intrinsics if we have other import candidates to suggest
Fixes #97618
Also open to just sorting these candidates to be last. Pretty easy to modify the code to do that, too.
2022-06-15 12:02:01 +09:00
Camille GILLOT
603746a35e
Make ResolverAstLowering a struct.
2022-06-14 22:44:27 +02:00
Takayuki Maeda
77d6176e69
remove unnecessary to_string
and String::new
2022-06-13 15:48:40 +09:00
Dylan DPC
640019ba6e
Rollup merge of #97812 - TaKO8Ki:suggest-to-swap-struct-and-trait, r=estebank
...
Suggest to swap a struct and a trait in trait impls
closes #89590
2022-06-11 07:42:14 +02:00
Takayuki Maeda
5639e52ae1
move suggestions to its own method
2022-06-09 17:52:10 +09:00
Michael Goulet
2ae1ec9119
Don't suggest adding let in certain if conditions
2022-06-07 21:02:58 -07:00
Michael Goulet
ab0938d0df
Filter out intrinsics if we have other import candidates to suggest
2022-06-07 01:08:52 -07:00
Takayuki Maeda
9db03b9bc8
suggest swapping a struct and a trait
...
fmt
2022-06-07 09:52:52 +09:00
Dylan DPC
a736acc804
Rollup merge of #97312 - cjgillot:no-path-in-scope, r=compiler-errors
...
Compute lifetimes in scope at diagnostic time
The set of available lifetimes is currently computed during lifetime resolution on HIR. It is only used for one diagnostic.
In this PR, HIR lifetime resolution just reports whether elided lifetimes are well-defined at the place of use. The diagnostic code is responsible for building a list of lifetime names if elision is not allowed.
This will allow to remove lifetime resolution on HIR eventually.
2022-06-06 14:34:55 +02:00
Camille GILLOT
af8739b96e
Completely remove LifetimeScopeForPath.
2022-06-04 15:33:27 +02:00
Camille GILLOT
a07290047e
Compute lifetimes in scope at diagnostic time.
2022-06-04 15:28:15 +02:00
Camille GILLOT
bacd8adeda
Fail gracefully when encountering an HRTB in APIT.
2022-06-03 22:50:14 +02:00
Camille GILLOT
ba40fe99c3
Compute is_late_bound
in a separate query.
...
The computation is actually much simpler, and can be done by directly
fetching the HIR for the `FnDecl` and its generics.
2022-06-03 12:05:04 +02:00
Camille GILLOT
b1294e86bb
Manipulate lifetimes by LocalDefId for region resolution.
2022-06-03 12:03:20 +02:00
Camille GILLOT
2aa9c703ce
Use the same message as type & const generics.
2022-06-03 08:26:10 +02:00
Camille GILLOT
86bd99060c
Reuse resolve_label to check lifetime shadowing.
2022-06-03 08:26:10 +02:00