about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
AgeCommit message (Collapse)AuthorLines
2022-07-21Rollup merge of #99528 - matthiaskrgr:2022_07_perf, r=estebankMatthias Krüger-1/+1
couple of clippy::perf fixes
2022-07-20Introduce AnonymousLifetimeRib::Elided and use it for implied 'static.Camille GILLOT-2/+28
2022-07-20Rollup merge of #99508 - ↵Matthias Krüger-2/+2
TaKO8Ki:avoid-symbol-to-string-conversion-in-BuiltinLintDiagnostics, r=compiler-errors Avoid `Symbol` to `String` conversions follow-up to #99342
2022-07-20middle: add `implies_by` to `#[unstable]`David Wood-2/+9
If part of a feature is stabilized and a new feature is added for the remaining parts, then the `implied_by` attribute can be used to indicate which now-stable feature previously contained a item. If the now-stable feature is still active (if the user has only just updated rustc, for example) then there will not be an stability error for uses of the item from the implied feature. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-20clippy::perf fixesMatthias Krüger-1/+1
2022-07-20avoid `&str` to String conversionsTakayuki Maeda-2/+2
2022-07-19Rollup merge of #99401 - TaKO8Ki:avoid-symbol-to-&str-conversions, r=nnethercoteMatthias Krüger-11/+16
Avoid `Symbol` to `&str` conversions `Symbol::as_str` is a slowish operation, so this patch removes some usages of it.
2022-07-19Auto merge of #98120 - TaKO8Ki:box-diagnostic-metadata-field, r=estebankbors-2/+2
[Experiment] Box `diagnostic_metadata` field closes #97954 r? `@estebank`
2022-07-18avoid `Symbol` to `&str` conversionsTakayuki Maeda-11/+16
2022-07-16Stabilize `let_chains`Caio-1/+1
2022-07-14Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillotDylan DPC-12/+131
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-14Rollup merge of #97720 - cjgillot:all-fresh, r=petrochenkovDylan DPC-12/+25
Always create elided lifetime parameters for functions Anonymous and elided lifetimes in functions are sometimes (async fns) --and sometimes not (regular fns)-- desugared to implicit generic parameters. This difference of treatment makes it some downstream analyses more complicated to handle. This step is a pre-requisite to perform lifetime elision resolution on AST. There is currently an inconsistency in the treatment of argument-position impl-trait for functions and async fns: ```rust trait Foo<'a> {} fn foo(t: impl Foo<'_>) {} //~ ERROR missing lifetime specifier async fn async_foo(t: impl Foo<'_>) {} //~ OK fn bar(t: impl Iterator<Item = &'_ u8>) {} //~ ERROR missing lifetime specifier async fn async_bar(t: impl Iterator<Item = &'_ u8>) {} //~ OK ``` The current implementation reports "missing lifetime specifier" on `foo`, but **accepts it** in `async_foo`. This PR **proposes to accept** the anonymous lifetime in both cases as an extra generic lifetime parameter. This change would be insta-stable, so let's ping t-lang. Anonymous lifetimes in GAT bindings keep being forbidden: ```rust fn foo(t: impl Foo<Assoc<'_> = Bar<'_>>) {} ^^ ^^ forbidden ok ``` I started a discussion here: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Anonymous.20lifetimes.20in.20universal.20impl-trait/near/284968606 r? ``@petrochenkov``
2022-07-13Add feature gate.Camille GILLOT-1/+16
2022-07-13Always use CreateParameter mode for function definitions.Camille GILLOT-11/+9
2022-07-13avoid `&str` to `String` conversionsTakayuki Maeda-2/+2
2022-07-12Add an indirection for closures in `hir::ExprKind`Maybe Waffle-1/+4
This helps bring `hir::Expr` size down, `Closure` was the biggest variant, especially after `for<>` additions.
2022-07-12Add `LifetimeBinderKind::Closure`Maybe Waffle-1/+3
2022-07-12make for<> in closures a possible place to suggest adding named lifetimeMaybe Waffle-4/+36
2022-07-12Lower closure binders to hir & properly check themMaybe Waffle-8/+90
2022-07-12Parse closure bindersMaybe Waffle-2/+2
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-11Auto merge of #98637 - cjgillot:bare-trait-anon-lt, r=petrochenkovbors-0/+24
Create fresh lifetime parameters for bare fn trait too The current code fails to account for the equivalence between `dyn FnMut(&mut u8)` and bare `FnMut(&mut u8)`, and treated them differently. This PR introduces a special case for `Fn` traits, which are always fully resolved. Fixes #98616 Fixes #98726 This will require a beta-backport, as beta contains that bug. r? `@petrochenkov`
2022-07-11Rollup merge of #99140 - TaKO8Ki:implement-is-accessible-span, r=fee1-deadDylan DPC-1/+1
Implement `SourceMap::is_span_accessible` This patch adds `SourceMap::is_span_accessible` and replaces `span_to_snippet(span).is_ok()` and `span_to_snippet(span).is_err()` with it. This removes a `&str` to `String` conversion.
2022-07-11rename a methodTakayuki Maeda-1/+1
2022-07-11implement `is_accessible_span`Takayuki Maeda-1/+1
2022-07-10Rollup merge of #99103 - TaKO8Ki:avoid-&str-to-string-conversions, r=oli-obkMatthias Krüger-8/+3
Avoid some `&str` to `String` conversions This patch removes some `&str` to `String` conversions.
2022-07-10avoid some `&str` to `String` conversionsTakayuki Maeda-8/+3
2022-07-09Rollup merge of #99008 - obeis:issue-98974, r=compiler-errorsDylan DPC-13/+28
Adding suggestion for E0530 Closes #98974
2022-07-08Update ui test for the new E0530 suggestionObei Sideg-2/+1
2022-07-08Check if E0530 is `rustc_resolve::late::PatternSource::Match` to emit suggestionObei Sideg-11/+14
2022-07-08Check if E0530 is `tuple variant` or `tuple struct` to emit suggestionObei Sideg-11/+17
2022-07-07Adding suggestion for E0530Obei Sideg-0/+7
2022-07-07suggest adding a derive for #[default] applied to variantsDeadbeef-4/+10
2022-07-06Auto merge of #98959 - cjgillot:late-bound-order, r=michaelwoeristerbors-2/+2
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-05fix typo in note about multiple inaccessible type aliasesClementTsang-1/+3
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-05Return a FxIndexSet in is_late_bound query.Camille GILLOT-2/+2
This return value is iterated upon by borrowck, hence the need to preserve a deterministic iteration order.
2022-07-04suggest `#[derive(Default)]` to enums with `#[default]`Takayuki Maeda-0/+9
2022-07-03Auto merge of #98673 - pietroalbini:pa-bootstrap-update, r=Mark-Simulacrumbors-1/+0
Bump bootstrap compiler r? `@Mark-Simulacrum`
2022-07-02Auto merge of #98569 - nnethercote:finalize_resolutions_id, r=cjgillotbors-23/+23
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-02Handle fresh lifetimes on bare trait objects.Camille GILLOT-0/+24
2022-07-01update cfg(bootstrap)sPietro Albini-1/+0
2022-06-30Rollup merge of #98677 - lyming2007:issue-98492-fix, r=lcnrMatthias Krüger-0/+2
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-30For diagnostic information of Boolean, remind it as use the type: 'bool'Yiming Lei-0/+2
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-29avoid many `&str` to `String` conversions with `MultiSpan::push_span_label`Takayuki Maeda-10/+5
2022-06-29Avoid unnecessary work in `finalize_resolutions_in`.Nicholas Nethercote-23/+23
If `module.opt_def_id()` returns `None`, we can skip most of the work.
2022-06-24Rollup merge of #98419 - WaffleLapkin:remove_excess_rib, r=compiler-errorsYuki Okushi-1/+3
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-23Rollup merge of #98269 - compiler-errors:provide-more-segment-res, ↵Michael Goulet-0/+1
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-23Remove excess rib while resolving closuresMaybe Waffle-1/+3
2022-06-22Auto merge of #98279 - cjgillot:all-fresh-nofn, r=petrochenkovbors-414/+551
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-21Use CreateParameter mode for closures too.Camille GILLOT-42/+42
2022-06-21Always create parameters for functions-like types.Camille GILLOT-57/+155