about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
AgeCommit message (Collapse)AuthorLines
2022-12-18higher-ranked lifetime messageMichael Goulet-6/+21
2022-12-13Rollup merge of #104864 - chenyukang:yukang/fix-104700-binding, r=estebankMatthias Krüger-1/+23
Account for item-local in inner scope for E0425 Fixes #104700
2022-12-09Fold `Definitions` into the untracked dataOli Scherer-25/+26
2022-12-09Move the untracked cstore and source_span into a structOli Scherer-26/+22
2022-12-09Generate crate loaders on the flyOli Scherer-25/+36
2022-12-09ResolverTree does not require access to the crate loader, only the storeOli Scherer-6/+6
2022-12-07Use `Symbol` for the crate name instead of `String`/`str`Oli Scherer-1/+1
2022-12-06Rollup merge of #105289 - Rageking8:fix-dupe-word-typos, r=cjgillotYuki Okushi-1/+1
Fix dupe word typos
2022-12-05Rollup merge of #105230 - cjgillot:issue-104312, r=petrochenkovMatthias Krüger-1/+1
Skip recording resolution for duplicated generic params. Turns out the fix was simpler than I thought. Fixes https://github.com/rust-lang/rust/issues/104312
2022-12-05fix dupe word typosRageking8-1/+1
2022-12-04Rollup merge of #101975 - chenyukang:fix-101749, r=compiler-errorsMatthias Krüger-12/+27
Suggest to use . instead of :: when accessing a method of an object Fixes #101749 Fixes #101542
2022-12-03Skip recording resolution for duplicated generic params.Camille GILLOT-1/+1
2022-12-03fix #101749, use . instead of :: when accessing a method of an objectyukang-12/+27
2022-12-03fix #105069, Add AmbiguityError for inconsistent resolution for an importyukang-5/+16
2022-12-01rustc_ast_lowering: Stop lowering imports into multiple itemsVadim Petrochenkov-49/+8
Lower them into a single item with multiple resolutions instead. This also allows to remove additional `NodId`s and `DefId`s related to those additional items.
2022-11-29clean up pr 104954Rageking8-1/+1
2022-11-28Rollup merge of #104954 - vincenzopalazzo:macros/prinf, r=estebankMatthias Krüger-0/+8
make simple check of prinf function Fixes https://github.com/rust-lang/rust/issues/92898 With this commit we start to make some simple check when the name resolution fails, and we generate some helper messages in case the name is a C name like in the case of the `printf` and suggest the correct rust method. `@rustbot` r? `@pnkfelix` Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-11-28Rename `NestedMetaItem::[Ll]iteral` as `NestedMetaItem::[Ll]it`.Nicholas Nethercote-1/+1
We already use a mix of `Literal` and `Lit`. The latter is better because it is shorter without causing any ambiguity.
2022-11-27Rollup merge of #104976 - WaffleLapkin:move_comments, r=cjgillotMatthias Krüger-4/+4
Prefer doc comments over `//`-comments in compiler Doc comments are generally nicer: they show up in the documentation, they are shown in IDEs when you hover other mentions of items, etc. Thus it makes sense to use them instead of `//`-comments.
2022-11-27Auto merge of #104048 - cjgillot:split-lifetime, r=compiler-errorsbors-0/+6
Separate lifetime ident from lifetime resolution in HIR Drive-by: change how suggested generic args are computed. Fixes https://github.com/rust-lang/rust/issues/103815 I recommend reviewing commit-by-commit.
2022-11-27Prefer doc comments over `//`-comments in compilerMaybe Waffle-4/+4
2022-11-27make simple check of prinf function.Vincenzo Palazzo-0/+8
With this commit we start to make some simple check when the name resolution fails, and we generate some helper message in case the name is a C name like in the case of the `printf` and suggest the correct rust method. Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-11-26Auto merge of #104730 - petrochenkov:modchild5, r=cjgillotbors-2/+4
rustc_metadata: Switch module children decoding to an iterator Previously https://github.com/rust-lang/rust/pull/103578, https://github.com/rust-lang/rust/pull/103524 and previous PRs simplified it as much as possible. A couple of cleanup commits is also added. r? `@cjgillot`
2022-11-25fix the crossing function issueyukang-1/+3
2022-11-25Auto merge of #104602 - petrochenkov:effvisperf5, r=oli-obkbors-45/+71
privacy: Fix more (potential) issues with effective visibilities Continuation of https://github.com/rust-lang/rust/pull/103965. See individual commits for more detailed description of the changes. The shortcuts removed in https://github.com/rust-lang/rust/pull/104602/commits/4eb63f618e601efee657d24cd4e8833fb03fac4c and https://github.com/rust-lang/rust/pull/104602/commits/c7c7d1672739e38c8d39ae861b284486aefd5b48 could actually be correct (or correct after some tweaks), but they used global reasoning like "we can skip this update because if the code compiles then some other update should do the same thing eventually". I have some expertise in this area, but I still have doubt whether such global reasoning was correct or not, especially in presence of all possible exotic cases with imports. After this PR all table changes should be "locally correct" after every update, even if it may be overcautious. If similar optimizations are introduced again they will need detailed comments explaining why it's legal to do what they do and providing proofs. Fixes https://github.com/rust-lang/rust/issues/104249. Fixes https://github.com/rust-lang/rust/issues/104539.
2022-11-25fix #104700, account for item-local in inner scope for E0425yukang-1/+21
2022-11-24Rollup merge of #104747 - petrochenkov:ctorfields, r=cjgillotMatthias Krüger-20/+15
resolve: Don't use constructor def ids in the map for field names Also do some minor cleanup to insertion of those field names. Addresses a FIXME left in https://github.com/rust-lang/rust/pull/103578.
2022-11-24Record in HIR whether lifetime elision was succesful.Camille GILLOT-0/+6
2022-11-24Auto merge of #104321 - Swatinem:async-gen, r=oli-obkbors-1/+1
Avoid `GenFuture` shim when compiling async constructs Previously, async constructs would be lowered to "normal" generators, with an additional `from_generator` / `GenFuture` shim in between to convert from `Generator` to `Future`. The compiler will now special-case these generators internally so that async constructs will *directly* implement `Future` without the need to go through the `from_generator` / `GenFuture` shim. The primary motivation for this change was hiding this implementation detail in stack traces and debuginfo, but it can in theory also help the optimizer as there is less abstractions to see through. --- Given this demo code: ```rust pub async fn a(arg: u32) -> Backtrace { let bt = b().await; let _arg = arg; bt } pub async fn b() -> Backtrace { Backtrace::force_capture() } ``` I would get the following with the latest stable compiler (on Windows): ``` 4: async_codegen::b::async_fn$0 at .\src\lib.rs:10 5: core::future::from_generator::impl$1::poll<enum2$<async_codegen::b::async_fn_env$0> > at /rustc/897e37553bba8b42751c67658967889d11ecd120\library\core\src\future\mod.rs:91 6: async_codegen::a::async_fn$0 at .\src\lib.rs:4 7: core::future::from_generator::impl$1::poll<enum2$<async_codegen::a::async_fn_env$0> > at /rustc/897e37553bba8b42751c67658967889d11ecd120\library\core\src\future\mod.rs:91 ``` whereas now I get a much cleaner stack trace: ``` 3: async_codegen::b::async_fn$0 at .\src\lib.rs:10 4: async_codegen::a::async_fn$0 at .\src\lib.rs:4 ```
2022-11-24Avoid `GenFuture` shim when compiling async constructsArpad Borsos-1/+1
Previously, async constructs would be lowered to "normal" generators, with an additional `from_generator` / `GenFuture` shim in between to convert from `Generator` to `Future`. The compiler will now special-case these generators internally so that async constructs will *directly* implement `Future` without the need to go through the `from_generator` / `GenFuture` shim. The primary motivation for this change was hiding this implementation detail in stack traces and debuginfo, but it can in theory also help the optimizer as there is less abstractions to see through.
2022-11-24effective visibility: Stop recalculating current private visibilityVadim Petrochenkov-2/+16
It becomes relatively expensive if done often and shows up during perf profiling.
2022-11-24effective visibility: Always add table entries for nodes used as parentsVadim Petrochenkov-7/+14
Previously if the parent was not in the table, and there was nothing to inherit from, the child's private visibility was used, but that's not correct - the parent may have a larger visibility so we should set it to at least the parent's private visibility. That parent's private visibility is also inserted into the table for caching, so it's not recalculated later if used again.
2022-11-24effective visibility: Fix private visibility calculation for modulesVadim Petrochenkov-4/+6
Optimizations removed in the previous commit required this function to behave incorrectly, but now those optimizations are gone so we can fix the bug. Fixes https://github.com/rust-lang/rust/issues/104249
2022-11-24effective visibility: Remove questionable optimizationsVadim Petrochenkov-30/+20
First, they require eagerly calculating private visibility (current normal module), which is somewhat expensive. Private visibilities are also lost once calculated, instead of being cached in the table. Second, I cannot prove that the optimizations are correct. Maybe they can be partially reinstated in the future in cases when it's cheap and provably correct to do them. They will also probably be merged into `fn update` in that case. Partially fixes https://github.com/rust-lang/rust/issues/104249 Fixes https://github.com/rust-lang/rust/issues/104539
2022-11-24effective visibility: Satisfy borrow checker to use resolver lazily from a ↵Vadim Petrochenkov-13/+26
closure
2022-11-23Suggest `.clone()` or `ref binding` on E0382Esteban Küber-1/+3
2022-11-23resolve: Don't use constructor def ids in the map for field namesVadim Petrochenkov-20/+15
Also do some minor cleanup to insertion of those field names
2022-11-22rustc_metadata: Switch module children decoding to an iteratorVadim Petrochenkov-2/+4
2022-11-22Auto merge of #104711 - Dylan-DPC:rollup-gkw1qr8, r=Dylan-DPCbors-7/+2
Rollup of 6 pull requests Successful merges: - #104295 (Check generics parity before collecting return-position `impl Trait`s in trait) - #104464 (Reduce exceptions overallocation on non Windows x86_64) - #104615 (Create def_id for async fns during lowering) - #104669 (Only declare bindings for if-let guards once per arm) - #104701 (Remove a lifetime resolution hack from `compare_predicate_entailment`) - #104710 (disable strict-provenance-violating doctests in Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-22Rollup merge of #104615 - spastorino:create-async-def-id-in-lowering, ↵Dylan DPC-7/+2
r=compiler-errors Create def_id for async fns during lowering r? `@compiler-errors`
2022-11-21Unreserve braced enum variants in value namespaceVadim Petrochenkov-33/+22
2022-11-19Create def_id for async fns during loweringSantiago Pastorino-7/+2
2022-11-18Auto merge of #104573 - matthiaskrgr:rollup-k36ybtp, r=matthiaskrgrbors-363/+665
Rollup of 8 pull requests Successful merges: - #101162 (Migrate rustc_resolve to use SessionDiagnostic, part # 1) - #103386 (Don't allow `CoerceUnsized` into `dyn*` (except for trait upcasting)) - #103405 (Detect incorrect chaining of if and if let conditions and recover) - #103594 (Fix non-associativity of `Instant` math on `aarch64-apple-darwin` targets) - #104006 (Add variant_name function to `LangItem`) - #104494 (Migrate GUI test to use functions) - #104516 (rustdoc: clean up sidebar width CSS) - #104550 (fix a typo) Failed merges: - #104554 (Use `ErrorGuaranteed::unchecked_claim_error_was_emitted` less) r? `@ghost` `@rustbot` modify labels: rollup
2022-11-18Rollup merge of #101162 - rajputrajat:master, r=davidtwcoMatthias Krüger-363/+665
Migrate rustc_resolve to use SessionDiagnostic, part # 1 crate a somewhat on larger size, so plz allow some time to get it finished.
2022-11-17Use `ThinVec` in `ast::Path`.Nicholas Nethercote-3/+6
2022-11-17Box `ExprKind::{Closure,MethodCall}`, and `QSelf` in expressions, types, and ↵Nicholas Nethercote-40/+41
patterns.
2022-11-14Rollup merge of #104364 - petrochenkov:docice2, r=GuillaumeGomezMatthias Krüger-0/+5
rustdoc: Resolve doc links in external traits having local impls For external impls it was done in https://github.com/rust-lang/rust/pull/103192 right away, but the local impl case was forgotten. Fixes https://github.com/rust-lang/rust/issues/104145.
2022-11-14Rollup merge of #104349 - rustaceanclub:master, r=oli-obkMatthias Krüger-1/+1
fix some typos in comments
2022-11-13Rollup merge of #104315 - SparkyPotato:fix-104276, r=cjgillotMatthias Krüger-1/+3
Improve spans with `use crate::{self}` Fixes #104276. The error becomes: ``` error: crate root imports need to be explicitly named: `use crate as name;` --> src/lib.rs.rs:1:13 | 1 | use crate::{self}; | ^^^^ warning: unused import: `self` --> src/lib.rs:1:13 | 1 | use crate::{self}; | ^^^^ | = note: `#[warn(unused_imports)]` on by default ```
2022-11-13rustdoc: Resolve doc links in external traits having local implsVadim Petrochenkov-0/+5