summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
AgeCommit message (Collapse)AuthorLines
2022-08-15Revert let_chains stabilizationNilstrieb-1/+1
This reverts commit 326646074940222d602f3683d0559088690830f4. It was discovered that they are not implemented correctly, which does not make them ready for stabilization.
2022-08-04Add docs to generics_def_id_mapSantiago Pastorino-1/+4
2022-08-04Implement def_id based remappingSantiago Pastorino-0/+5
2022-08-04Auto merge of #99953 - cjgillot:in-path-always, r=petrochenkovbors-23/+20
Always create elided lifetimes, even if inferred. `PathSource` gives the context in which a path is encountered. The same `PathSource` is used for the full path and the `QSelf` part. Therefore, we can only rely on `PathSource` to know whether typechecking will be able to infer the lifetimes, not whether we need to insert them at all. Fixes https://github.com/rust-lang/rust/issues/99949
2022-07-30Always create elided lifetimes, even if inferred.Camille GILLOT-23/+20
2022-07-28Remove guess_head_span.Camille GILLOT-11/+2
2022-07-28change the type of `note` field to `Option<String>`Takayuki Maeda-26/+21
2022-07-27Rollup merge of #99728 - cjgillot:ast-lifetimes-anon-clean, r=petrochenkovGuillaume Gomez-647/+160
Clean up HIR-based lifetime resolution Based on https://github.com/rust-lang/rust/pull/97313. Fixes #98932. r? `@petrochenkov`
2022-07-26Pacify tidy.Camille GILLOT-1/+0
2022-07-26Stop creating anonymous late lifetimes.Camille GILLOT-36/+1
2022-07-26Remove resolve_elided_lifetimes.Camille GILLOT-53/+6
2022-07-26Stop resolving lifetime elision on HIR.Camille GILLOT-425/+52
2022-07-26Move fn parameter ribs outwards.Camille GILLOT-36/+62
2022-07-26Replace LifetimeRes::Anonymous by LifetimeRes::Infer.Camille GILLOT-73/+39
2022-07-26Remove the distinction between LifetimeName::Implicit and ↵Camille GILLOT-42/+16
LifetimeName::Underscore.
2022-07-26Do not produce extra lifetime parameters when not needed.Camille GILLOT-0/+3
2022-07-26Rollup merge of #99729 - cjgillot:rm-unused-tuple, r=michaelwoeristerMatthias Krüger-9/+9
Remove unused tuple fields Found by https://github.com/rust-lang/rust/pull/95977
2022-07-26Rollup merge of #99718 - TaKO8Ki:avoid-&str-symbol-to-string-conversions, ↵Yuki Okushi-2/+1
r=michaelwoerister Avoid `&str`/`Symbol` to `String` conversions follow-up to #99342 and #98668
2022-07-25Auto merge of #97313 - cjgillot:ast-lifetimes-anon, r=petrochenkovbors-924/+823
Resolve function lifetime elision on the AST ~Based on https://github.com/rust-lang/rust/pull/97720~ Lifetime elision for functions is purely syntactic in nature, so can be resolved on the AST. This PR replicates the elision logic and diagnostics on the AST, and replaces HIR-based resolution by a `delay_span_bug`. This refactor allows for more consistent diagnostics, which don't have to guess the original code from HIR. r? `@petrochenkov`
2022-07-25Unused tuple fields in rustc_resolve.Camille GILLOT-9/+9
2022-07-25Update file description.Camille GILLOT-5/+6
2022-07-25Report elision failures on the AST.Camille GILLOT-919/+791
2022-07-25avoid `&str`/`Symbol` to `String` conversionsTakayuki Maeda-2/+1
2022-07-25Auto merge of #98770 - klensy:no-string-dupes-ugly, r=cjgillotbors-1/+1
rmeta: avoid embedding `StabilityLevel::Unstable` reason multiple times into .rmeta\.rlib files Avoids bloating size of some rmeta\rlib files by not placing default string for `StabilityLevel::Unstable` reason multiple times, affects only stdlib\rustc artifacts. For stdlib cuts about 3% (diff of total size for patched\unpatched *.rmeta files of stage1-std) of file size, depending on crates. fixes #88180
2022-07-23Use span_bug in case of unexpected rib kindJordan McQueen-1/+1
Extremely minor QOL change to improve the ICE output in case this default match case is encountered (an unexpected rib kind).
2022-07-21avoid embedding StabilityLevel::Unstable reason string into metadata ↵klensy-1/+1
multiple times
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