about summary refs log tree commit diff
path: root/compiler/rustc_resolve
AgeCommit message (Collapse)AuthorLines
2023-01-04Simplify some iterator combinatorsMichael Goulet-5/+4
2022-12-29Rollup merge of #106221 - Nilstrieb:rptr-more-like-ref-actually, ↵Matthias Krüger-4/+4
r=compiler-errors Rename `Rptr` to `Ref` in AST and HIR The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already as well.
2022-12-28Rename `Rptr` to `Ref` in AST and HIRNilstrieb-4/+4
The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already as well.
2022-12-27Make resolve suggestion more genericEsteban Küber-1/+1
2022-12-27review comments: make suggestion more accurateEsteban Küber-2/+10
2022-12-27Fix some totally useless suggestionsMichael Goulet-1/+1
2022-12-27Dont clobber `as ..` rename in import suggestionMichael Goulet-3/+12
2022-12-27Note alternative import candidates in nested use treeMichael Goulet-11/+23
2022-12-27Suppress suggestions for nested use treeMichael Goulet-17/+27
2022-12-26Detect likely `.` -> `..` typo in method callsEsteban Küber-7/+25
Fix #65015.
2022-12-22Rollup merge of #105769 - lyming2007:issue-105177-fix, r=eholkMatthias Krüger-2/+24
add function to tell the identical errors for ambiguity_errors if 2 errors of the kind and ident and span of the ident, b1, b2 and misc1 misc2 are the same we call these 2 ambiguity errors identical prevent identical ambiguity error from pushing into vector of ambiguity_errors this will fix #105177
2022-12-21Change comment to doc commentEric Holk-1/+1
2022-12-19add function to tell if the current ambiguity error matches a previous one ↵Yiming Lei-2/+24
in ambiguity_errors if 2 errors of the kind and ident and span of the ident, b1, b2 and misc1 misc2 are the same then these 2 ambiguity errors matched prevent identical ambiguity error from pushing into vector of ambiguity_errors this will fix #105177
2022-12-18Rollup merge of #105873 - matthiaskrgr:clippy_fmt, r=NilstriebMatthias Krüger-6/+2
use &str / String literals instead of format!()
2022-12-18Rollup merge of #105869 - matthiaskrgr:clone_on_copy, r=compiler-errorsMatthias Krüger-1/+1
don't clone Copy types
2022-12-18don't restuct references just to reborrowMatthias Krüger-1/+1
2022-12-18use &str / String literals instead of format!()Matthias Krüger-6/+2
2022-12-18don't clone Copy typesMatthias Krüger-1/+1
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.