about summary refs log tree commit diff
path: root/src/librustc_resolve/lib.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-3328/+0
2020-08-30resolve: Don't speculatively load crates if this is a speculative resolutionJoshua Nelson-3/+7
This avoids a rare rustdoc bug where loading `core` twice caused a 'cannot find a built-in macro' error: 1. `x.py build --stage 1` builds the standard library and creates a sysroot 2. `cargo doc` does something like `cargo check` to create `rmeta`s for all the crates (unrelated to what was built above) 3. the `cargo check`-like `libcore-*.rmeta` is loaded as a transitive dependency *and claims ownership* of builtin macros 4. `rustdoc` later tries to resolve some path in a doc link 5. suggestion logic fires and loads "extern prelude" crates by name 6. the sysroot `libcore-*.rlib` is loaded and *fails to claim ownership* of builtin macros This fixes step 5. by not running suggestion logic if this is a speculative resolution. Additionally, it marks `resolve_ast_path` as a speculative resolution.
2020-08-23resolve: Add comments to `traits_in_scope`Joshua Nelson-0/+3
2020-08-22resolve: Add public entrypoint `traits_in_module`Joshua Nelson-0/+25
- Consider the implicit prelude as well
2020-08-22resolve: Split `ensure_traits` into a separate functionJoshua Nelson-16/+25
2020-08-22resolve: Move `get_traits_in_module_containing_item` to ResolverJoshua Nelson-1/+78
2020-08-17Auto merge of #75120 - JulianKnodt:rm_reps, r=oli-obkbors-3/+3
rust_ast::ast => rustc_ast Rework of #71199 which is a rework #70621 Still working on this but just made the PR to track progress r? @Dylan-DPC
2020-08-17rust_ast::ast => rustc_astUjjwal Sharma-3/+3
2020-08-16hir: introduce `QPath::LangItem`David Wood-31/+0
This commit introduces `QPath::LangItem` to the HIR and uses it in AST lowering instead of constructing a `hir::Path` from a slice of symbols. This might be better for performance, but is also much cleaner as the previous approach is fragile. In addition, it resolves a bug (#61019) where an extern crate imported as "std" would result in the paths created during AST lowering being resolved incorrectly (or not at all). Co-authored-by: Matthew Jasper <mjjasper1@gmail.com> Signed-off-by: David Wood <david@davidtw.co>
2020-08-15replaced log with tracingGurpreet Singh-1/+1
2020-08-08Auto merge of #74932 - nnethercote:rm-ast-session-globals, r=petrochenkovbors-4/+3
Remove `librustc_ast` session globals By moving the data onto `Session`. r? @petrochenkov
2020-08-08Eliminate the `SessionGlobals` from `librustc_ast`.Nicholas Nethercote-4/+3
By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This means they are accessed via the `Session`, rather than via TLS. A few `Attr` methods and `librustc_ast` functions are now methods of `Session`. All of this required passing a `Session` to lots of functions that didn't already have one. Some of these functions also had arguments removed, because those arguments could be accessed directly via the `Session` argument. `contains_feature_attr()` was dead, and is removed. Some functions were moved from `librustc_ast` elsewhere because they now need to access `Session`, which isn't available in that crate. - `entry_point_type()` --> `librustc_builtin_macros` - `global_allocator_spans()` --> `librustc_metadata` - `is_proc_macro_attr()` --> `Session`
2020-08-05forbid generic params in complex constsBastian Kauschke-3/+29
2020-07-27forbid generic params inside of anon consts in ty defaultsBastian Kauschke-6/+53
2020-07-27name `ParamInTyOfConstArg`Bastian Kauschke-4/+4
2020-07-26Hygiene serialization implementationAaron Hill-3/+33
2020-07-18rustc_metadata: Make crate loading fully speculativeVadim Petrochenkov-1/+1
2020-07-16Use the scope of the imported variable for resolution, not the current scopeJoshua Nelson-2/+2
- Accept DefId in resolve_str_path_error This will probably break lots of internal invariants.
2020-07-16Use get_module instead of `module_map` for `resolve_str_path_error`Joshua Nelson-1/+1
2020-07-16update help messageBastian Kauschke-4/+10
2020-07-16forbid generic params in the type of const paramsBastian Kauschke-1/+27
2020-07-15Remove lots of `Symbol::as_str()` calls.Nicholas Nethercote-5/+5
In various ways, such as changing functions to take a `Symbol` instead of a `&str`.
2020-07-09Rollup merge of #74150 - tamird:blocklist, r=nikomatsakisManish Goregaokar-2/+2
Avoid "blacklist" Other terms are more inclusive and precise. Clippy still has a lint named "blacklisted-name", but renaming it would be a breaking change, so is left for future work. The target configuration option "abi-blacklist" has been depreciated and renamed to "unsupported-abis". The old name continues to work.
2020-07-08Avoid "blacklist"Tamir Duberstein-2/+2
Other terms are more inclusive and precise. Clippy still has a lint named "blacklisted-name", but renaming it would be a breaking change, so is left for future work. The target configuration option "abi-blacklist" has been depreciated and renamed to "unsupported-abis". The old name continues to work.
2020-07-05Use for<'tcx> fn pointers in Providers, instead of having Providers<'tcx>.Eduard-Mihai Burtescu-1/+1
2020-07-02resolve: disallow label use through closure/asyncDavid Wood-2/+6
This commit modifies resolve to disallow `break`/`continue` to labels through closures or async blocks. This doesn't make sense and should have been prohibited anyway. Signed-off-by: David Wood <david@davidtw.co>
2020-06-27Rename two `Resolver` traitsVadim Petrochenkov-1/+1
2020-06-24Rollup merge of #73652 - da-x:add-reexported-to-use-suggestions, r=petrochenkovDylan DPC-0/+7
Add re-exports to use suggestions In the following example, an inaccessible path is suggested via `use foo::bar::X;` whereas an accessible public exported path can be suggested instead. ```rust mod foo { mod bar { pub struct X; } pub use self::bar::X; } fn main() { X; } ``` This fixes the issue.
2020-06-23Add re-exports to use suggestionsDan Aloni-0/+7
In the following example, an inaccessible path is suggested via `use foo::bar::X;` whereas an accessible public exported path can be suggested instead. ``` mod foo { mod bar { pub struct X; } pub use self::bar::X; } fn main() { X; } ``` This fixes the issue.
2020-06-21Move `next_disambiguator` to `Resolver`marmeladema-1/+13
2020-06-21Always create a root definition when creating a new `Definitions` object.marmeladema-5/+5
2020-06-21Move remaining `NodeId` APIs from `Definitions` to `Resolver`marmeladema-24/+93
2020-06-20Move `trait_map` into `hir::Crate`marmeladema-11/+4
2020-06-19Rollup merge of #73357 - petrochenkov:tmap, r=davidtwcoManish Goregaokar-21/+4
Use `LocalDefId` for import IDs in trait map cc https://github.com/rust-lang/rust/pull/73291#discussion_r439734867
2020-06-18Rollup merge of #73320 - estebank:type-param-sugg-more, r=davidtwcoManish Goregaokar-6/+8
Make new type param suggestion more targetted Do not suggest new type param when encountering a missing type in an ADT field with generic parameters. Fix #72640.
2020-06-17review commentsEsteban Küber-4/+4
2020-06-15Use `LocalDefId` for import IDs in trait mapVadim Petrochenkov-21/+4
2020-06-13Make new type param suggestion more targettedEsteban Küber-6/+8
Do not suggest new type param when encountering a missing type in an ADT field with generic parameters. Fix #72640.
2020-06-10Rollup merge of #72789 - petrochenkov:impcand, r=davidtwcoDylan DPC-1/+2
resolve: Do not suggest imports from the same module in which we are resolving Based on the idea from https://github.com/rust-lang/rust/pull/72623.
2020-06-07Use `LocalDefId` directly in `Resolver::export_map` and `module_exports` querymarmeladema-25/+3
This is to avoid the final conversion from `NodeId` to `HirId` during call to `Resolver::(clone|into)_outputs`.
2020-06-06Auto merge of #72927 - petrochenkov:rustc, r=Mark-Simulacrumbors-6/+7
Rename all remaining compiler crates to use the `rustc_foo` pattern libarena -> librustc_arena libfmt_macros -> librustc_parse_format libgraphviz -> librustc_graphviz libserialize -> librustc_serialize Closes https://github.com/rust-lang/rust/issues/71177 in particular.
2020-06-02Improve E0433, so that it suggests missing importsPatryk Wychowaniec-7/+7
2020-06-02Rename the crates in source codeVadim Petrochenkov-6/+7
2020-05-30resolve: Pass parent scope to the function providing import suggestionsVadim Petrochenkov-1/+2
2020-05-30Use `LocalDefId` instead of `NodeId` in `resolve_str_path_error`marmeladema-5/+2
2020-05-29Remove remaining calls to `as_local_node_id`marmeladema-15/+25
2020-05-27Store `LocalDefId` directly in `rustc_resolve::Resolver` where possiblemarmeladema-47/+16
This commit also include the following changes: * Remove unused `hir::Map::as_local_node_id` method * Remove outdated comment about `hir::Map::local_def_id` method * Remove confusing `GlobMap` type alias * Use `LocalDefId` instead of `DefId` in `extern_crate_map` * Use `LocalDefId` instead of `DefId` in `maybe_unused_extern_crates` * Modify `extern_mod_stmt_cnum` query to accept a `LocalDefId` instead of a `DefId`
2020-05-24Rollup merge of #72402 - marmeladema:resolver-outputs-def-id, r=ecstatic-morseRalf Jung-13/+101
Remove all uses of `NodeId` in `ResolverOutputs` cc #50928 r? @ecstatic-morse
2020-05-22Remove `macro_defs` mapAaron Hill-8/+3
We store store the `DefId` directly in `ExpnData`. This will allow us to serialize `ExpnData` in PR #72121 without needing to manage a side table.
2020-05-21Replace unecessary calls to `.clone()` by argument binding pattern for ↵marmeladema-11/+11
`Copy` types