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
3ebb852956
Add LifetimeBinderKind::Closure
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
Maybe Waffle
40ae7b5b8e
Parse closure binders
...
This is first step in implementing RFC 3216.
- Parse `for<'a>` before closures in ast
- Error in lowering
- Add `closure_lifetime_binder` feature
2022-07-12 16:25:16 +04:00
Deadbeef
2f0ccdfbba
suggest adding a derive for #[default] applied to variants
2022-07-07 04:57:01 +00:00
bors
3dcb616888
Auto merge of #98959 - cjgillot:late-bound-order, r=michaelwoerister
...
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.
Fixes https://github.com/rust-lang/rust/issues/98890
Affects https://github.com/rust-lang/rust/issues/96655
I don't know if this supersedes https://github.com/rust-lang/rust/pull/98924 or fixes an unrelated bug.
r? `@michaelwoerister`
This may deserve a backport.
2022-07-06 17:38:48 +00:00
ClementTsang
503c669927
fix typo in note about multiple inaccessible type aliases
...
Mainly intended as a small typo fix ("aliass" -> "aliases") for
the case where a type cannot be found in scope, and there are
multiple inaccessible type aliases that match the missing type.
In general this change would use the correct plural form in
this scenario for words that end with 's'.
2022-07-05 21:21:12 -04: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
Takayuki Maeda
eb80407d79
suggest #[derive(Default)]
to enums with #[default]
2022-07-04 20:46:59 +09:00
bors
ada8c80bed
Auto merge of #98673 - pietroalbini:pa-bootstrap-update, r=Mark-Simulacrum
...
Bump bootstrap compiler
r? `@Mark-Simulacrum`
2022-07-03 06:55:50 +00:00
bors
5f98537eb7
Auto merge of #98569 - nnethercote:finalize_resolutions_id, r=cjgillot
...
Avoid unnecessary work in `finalize_resolutions_in`.
If `module.opt_def_id()` returns `None`, we can skip most of the work.
r? `@lqd`
2022-07-02 23:38:08 +00:00
Pietro Albini
6b2d3d5f3c
update cfg(bootstrap)s
2022-07-01 15:48:23 +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
Matthias Krüger
d34c4ca9be
Rollup merge of #98668 - TaKO8Ki:avoid-many-&str-to-string-conversions, r=Dylan-DPC
...
Avoid some `&str` to `String` conversions with `MultiSpan::push_span_label`
This patch removes some`&str` to `String` conversions with `MultiSpan::push_span_label`.
2022-06-29 20:35:07 +02:00
Takayuki Maeda
6212e6b339
avoid many &str
to String
conversions with MultiSpan::push_span_label
2022-06-29 21:16:43 +09:00
Nicholas Nethercote
0e475b5d5e
Avoid unnecessary work in finalize_resolutions_in
.
...
If `module.opt_def_id()` returns `None`, we can skip most of the work.
2022-06-29 09:20:32 +10:00
Nicholas Nethercote
7c40661ddb
Update smallvec
to 1.8.1.
...
This pulls in https://github.com/servo/rust-smallvec/pull/282 , which
gives some small wins for rustc.
2022-06-27 08:48:55 +10:00
Yuki Okushi
5e98e55668
Rollup merge of #98419 - WaffleLapkin:remove_excess_rib, r=compiler-errors
...
Remove excess rib while resolving closures
I've mentioned this on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.60ClosureOrAsyncRibKind.60.20weirdness/near/286982959 ), in `rustc_resolve`, while resolving closures we add an excess `ClosureOrAsyncRibKind`. It's excess because we later add another one in `visit_fn`.
I couldn't find a way in which removing this will break anything, all test seem to pass, etc.
r? ``@compiler-errors``
cc ``@davidtwco``
2022-06-24 16:43:49 +09:00
Michael Goulet
3b68700d0c
Rollup merge of #98269 - compiler-errors:provide-more-segment-res, r=petrochenkov
...
Provide a `PathSegment.res` in more cases
I find that in many cases, the `res` associated with a `PathSegment` is `Res::Err` even though the path was fully resolved. A few diagnostics use this `res` and their error messages suffer because of the lack of resolved segment.
This fixes it a bit, but it's obviously not complete and I'm not exactly sure if it's correct.
2022-06-23 14:39:07 -07:00
Maybe Waffle
9730221b9d
Remove excess rib while resolving closures
2022-06-23 12:21:23 +04: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
Michael Goulet
f924e74fb1
Provide a segment res in more cases
2022-06-20 21:27:42 -07: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
Camille GILLOT
bc6a2c11ee
Leave the responsibility to create Fresh
lifetimes to lowering.
2022-06-19 22:32:43 +02:00
Camille GILLOT
dc614b90ca
Make matches exhaustive.
2022-06-19 22:30:30 +02:00
Camille GILLOT
87c841e190
Remove the region
terminology.
2022-06-19 22:28:53 +02:00
Camille GILLOT
bf38ba260d
Separate AnonymousCreateParameter
and ReportElidedInPath
.
2022-06-18 16:59:27 +02:00
Camille GILLOT
237e267b80
Refactor visit_fn.
2022-06-18 16:59:19 +02:00
Camille GILLOT
80c6a1f275
Rustfmt resolve_implementation.
2022-06-18 16:58:18 +02:00
Camille GILLOT
228def7e20
Extract AssocItem handling.
2022-06-18 16:56:30 +02: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
Camille GILLOT
ae5959f4ba
Consume resolutions for lowering separately.
2022-06-15 19:42:43 +02:00
Camille GILLOT
52f22c7d01
Remove unused item_generics_num_lifetimes.
2022-06-15 19:19:53 +02:00
Yuki Okushi
b2d0e7838e
Rollup merge of #98087 - TaKO8Ki:suggest-adding-macro-export, r=oli-obk
...
Suggest adding a `#[macro_export]` to a private macro
fixes #97628
2022-06-15 12:02:05 +09: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
34e4d72929
Separate source_span
and expn_that_defined
from Definitions
.
2022-06-14 22:45:51 +02:00
Camille GILLOT
603746a35e
Make ResolverAstLowering a struct.
2022-06-14 22:44:27 +02:00
Camille GILLOT
47799de35a
Separate Definitions and CrateStore from ResolverOutputs.
2022-06-14 22:44:27 +02:00
Takayuki Maeda
0d24405211
implement MacroData
2022-06-15 00:31:21 +09:00
Takayuki Maeda
801725a77b
suggest adding a #[macro_export]
to a private macro
2022-06-14 14:58:46 +09:00
Takayuki Maeda
fd1290a631
remove unnecessary to_string
and String::new
for tool_only_span_suggestion
2022-06-13 16:01:16 +09:00
Takayuki Maeda
77d6176e69
remove unnecessary to_string
and String::new
2022-06-13 15:48:40 +09:00