summary refs log tree commit diff
path: root/src/librustc_resolve/lib.rs
AgeCommit message (Collapse)AuthorLines
2019-05-17Avoid unnecessary interning in `Ident::from_str()` calls.Nicholas Nethercote-4/+4
A lot of these static symbols are pre-interned.
2019-05-13Remove the equality operation between `Symbol` and strings.Nicholas Nethercote-3/+3
And also the equality between `Path` and strings, because `Path` is made up of `Symbol`s.
2019-05-13Pass a `Symbol` to `check_name`, `emit_feature_err`, and related functions.Nicholas Nethercote-4/+4
2019-05-09cleanup: Remove `DefIndexAddressSpace`Vadim Petrochenkov-1/+1
2019-05-05rustc: rename all occurences of "freevar" to "upvar".Eduard-Mihai Burtescu-8/+8
2019-05-05Auto merge of #60544 - petrochenkov:parder, r=eddybbors-106/+91
Rename `PathResolution` to `PartialRes` Don't use `PartialRes` when `Res` is enough. Rename `Res::kind_name` to `Res::descr` for consistency. Remove `Res::Label`, paths can never resolve to labels. Some further cleanup after https://github.com/rust-lang/rust/pull/60462 r? @eddyb
2019-05-04Removed unneccesary reference for trait nameJesper Steen Møller-4/+4
2019-05-04Reuse 'kind' parameter.Jesper Steen Møller-1/+1
2019-05-04Revert the introduced typedefsJesper Steen Møller-4/+4
2019-05-04Fix #45268 by saving all NodeId's for resolved traits.Jesper Steen Møller-21/+20
2019-05-04Remove `Res::Label`Vadim Petrochenkov-16/+19
Paths can never resolve to labels
2019-05-04Rename `Res::kind_name` to `Res::descr` for consistencyVadim Petrochenkov-4/+4
2019-05-04Rename `PathResolution` to `PartialRes`Vadim Petrochenkov-87/+69
Don't use `PartialRes` when `Res` is enough
2019-05-03rustc: rename hir::def::Def to Res (short for "resolution").Eduard-Mihai Burtescu-278/+278
2019-05-03rustc: use DefKind instead of Def, where possible.Eduard-Mihai Burtescu-26/+30
2019-05-03rustc: factor most DefId-containing variants out of Def and into DefKind.Eduard-Mihai Burtescu-61/+100
2019-05-01Ensure that users cannot use generated arguments.David Wood-10/+13
This commit gensyms the generated ident for replacement arguments so that users cannot refer to them. It also ensures that levenshtein distance suggestions do not suggest gensymed identifiers.
2019-05-01Ensure that drop order of `async fn` matches `fn`.David Wood-3/+12
This commit modifies the lowering of `async fn` arguments so that the drop order matches the equivalent `fn`. Previously, async function arguments were lowered as shown below: async fn foo(<pattern>: <ty>) { async move { } } // <-- dropped as you "exit" the fn // ...becomes... fn foo(__arg0: <ty>) { async move { let <pattern> = __arg0; } // <-- dropped as you "exit" the async block } After this PR, async function arguments will be lowered as: async fn foo(<pattern>: <ty>, <pattern>: <ty>, <pattern>: <ty>) { async move { } } // <-- dropped as you "exit" the fn // ...becomes... fn foo(__arg0: <ty>, __arg1: <ty>, __arg2: <ty>) { async move { let __arg2 = __arg2; let <pattern> = __arg2; let __arg1 = __arg1; let <pattern> = __arg1; let __arg0 = __arg0; let <pattern> = __arg0; } // <-- dropped as you "exit" the async block } If `<pattern>` is a simple ident, then it is lowered to a single `let <pattern> = <pattern>;` statement as an optimization.
2019-04-26Auto merge of #60167 - varkor:tidy-filelength, r=matthewjasperbors-0/+2
Add a tidy check for files with over 3,000 lines Files with a large number of lines can cause issues in GitHub (e.g. https://github.com/rust-lang/rust/issues/60015) and also tend to be indicative of opportunities to refactor into less monolithic structures. This adds a new check to tidy to warn against files that have more than 3,000 lines, as suggested in https://github.com/rust-lang/rust/issues/60015#issuecomment-483868594. (This number was chosen fairly arbitrarily as a reasonable indicator of size.) This check can be ignored with `// ignore-tidy-filelength`. Existing files with greater than 3,000 lines currently ignore the check, but this helps us spot when files are getting too large. (We might try to split up all files larger than this in the future, as in https://github.com/rust-lang/rust/issues/60015).
2019-04-25ignore-tidy-filelength on all files with greater than 3000 linesvarkor-0/+2
2019-04-25Prevent const parameters having type parameters as typesvarkor-2/+42
2019-04-25Rollup merge of #59697 - euclio:label-fixes, r=zackmdavisMazdak Farrokhzad-2/+13
tweak unresolved label suggestion Only suggest label names in the same hygiene context, and use a structured suggestion. Question for reviewer: Is this the right way to check for label hygiene?
2019-04-21Move `async fn` arguments into closure.David Wood-4/+22
This commit takes advantage of `AsyncArgument` type that was added in a previous commit to replace the arguments of the `async fn` in the HIR and add statements to move the bindings from the new arguments to the pattern from the old argument. For example, the async function `foo` below: async fn foo((x, _y): (T, V)) { async move { } } becomes: async fn foo(__arg0: (T, V)) { async move { let (x, _y) = __arg0; } }
2019-04-21Add `AsyncArgument` to AST.David Wood-6/+4
This commit adds an `AsyncArgument` struct to the AST that contains the generated argument and statement that will be used in HIR lowering, name resolution and def collection.
2019-04-18Suggest appropriate path when calling associated item on bare typesEsteban Küber-19/+40
When looking at the documentation for `std::f32` or `std::str`, for example, it is easy to get confused and assume `std::f32` and `f32` are the same thing. Because of this, it is not uncommon to attempt writing `f32::consts::PI` instead of the correct `std::f32::consts::PI`. When encountering the former, which results in an access error due to it being an inexistent path, try to access the same path under `std`. If this succeeds, this information is stored for later tweaking of the final E0599 to provide an appropriate suggestion. This suggestion applies to both E0233 and E0599 and is only checked when the first ident of a path corresponds to a primitive type.
2019-04-18Auto merge of #60025 - JohnTitor:rename-files, r=petrochenkovbors-2/+2
Rename files about error codes fixes #60017 This PR will be failed in tidy. <details> <summary>The log is here:</summary> ``` tidy check tidy error: duplicate error code: 411 tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:83: __diagnostic_used!(E0411); tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:84: err.code(DiagnosticId::Error("E0411".to_owned())); tidy error: duplicate error code: 424 tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:90: debug!("smart_resolve_path_fragment: E0424, source={:?}", source); tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:92: __diagnostic_used!(E0424); tidy error: Documents\GitHub\rust\src\librustc_resolve\diagnostics.rs:93: err.code(DiagnosticId::Error("E0424".to_owned())); some tidy checks failed ``` </details> I'd like to fix this but I don't know what to do. I will work on later. Please let me know if you have any solutions. r? @petrochenkov
2019-04-17Resolve inconsistency in error messages between "parameter" and "variable".Eduard-Mihai Burtescu-2/+2
2019-04-17Rename modulesYuki OKUSHI-2/+2
2019-04-17Deny `internal` in stage0Mateusz Mikuła-1/+1
2019-04-14HirIdify hir::Defljedrz-5/+12
2019-04-14Rollup merge of #59784 - davidtwco:issue-59764, r=estebankMazdak Farrokhzad-69/+29
Suggest importing macros from the crate root Fixes #59764. r? @estebank cc @varkor
2019-04-12Switch to multipart suggestions.David Wood-6/+5
This commit changes the suggestion so that it is split into multiple parts in an effort to reduce the impact the applied suggestion could have on formatting.
2019-04-12Handle edge cases.David Wood-63/+14
This commit introduces more dirty span manipulation into the compiler in order to handle the various edge cases in moving/renaming the macro import so it is at the root of the import.
2019-04-12Suggest macro import from crate root.David Wood-0/+10
This commit suggests importing a macro from the root of a crate as the intent may have been to import a macro from the definition location that was annotated with `#[macro_export]`.
2019-04-10clarify what the item is in "not a module" errorAndy Russell-1/+8
2019-04-04tweak unresolved label suggestionAndy Russell-2/+13
Only suggest label names in the same hygiene context, and use a structured suggestion.
2019-04-03Deny internal lints on non conflicting cratesflip1995-0/+1
- libarena - librustc_allocator - librustc_borrowck - librustc_codegen_ssa - librustc_codegen_utils - librustc_driver - librustc_errors - librustc_incremental - librustc_metadata - librustc_passes - librustc_privacy - librustc_resolve - librustc_save_analysis - librustc_target - librustc_traits - libsyntax - libsyntax_ext - libsyntax_pos
2019-04-02Rollup merge of #59166 - seanmonstar:trait-alias-import, r=alexregMazdak Farrokhzad-18/+41
resolve: collect trait aliases along with traits It seems trait aliases weren't being collected as `TraitCandidates` in resolve, this should change that. (I can't compile the full compiler locally, so relying on CI...) Fixes https://github.com/rust-lang/rust/issues/56485 r? @alexreg
2019-04-01resolve all in scope trait aliases, then elaborate their boundsSean McArthur-25/+37
2019-03-30Remove redundant importsFabian Drinck-1/+0
2019-03-29Fix error in Rust 2018 + no_core environmentTaiki Endo-1/+6
2019-03-26Rollup merge of #59150 - estebank:type-ascription, r=varkorMazdak Farrokhzad-7/+57
Expand suggestions for type ascription parse errors Fix #51222. CC #48016, #47666, #54516, #34255.
2019-03-25Auto merge of #59258 - euclio:suggestions-filter-crate, r=oli-obkbors-6/+20
filter suggestions from extern prelude Fixes #59027. Modifies the candidate gathering code to call `filter_fn` on extern crates, which causes them to be filtered out when looking for a type.
2019-03-24Auto merge of #59382 - davidtwco:rfc-2008-refactoring, r=petrochenkovbors-14/+7
Separate `DefId`s for variants and their constructors Part of #44109. Split off from #59376. See [Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/rfc-2008/near/132663140) for previous discussion. r? @petrochenkov
2019-03-24Re-order fields in `Def::Ctor`.David Wood-2/+2
This commit moves the `DefId` field of `Def::Ctor` to be the first field.
2019-03-24Move `CtorOf` into `hir::def`.David Wood-1/+1
This commit moves the definition of `CtorOf` from `rustc::hir` to `rustc::hir::def` and adds imports wherever it is used.
2019-03-24Rollup merge of #59355 - varkor:const-param-struct-ice, r=petrochenkovkennytm-9/+16
Fix ICE with const generic param in struct Fixes https://github.com/rust-lang/rust/issues/59340. r? @petrochenkov
2019-03-24Separate variant id and variant constructor id.David Wood-14/+7
This commit makes two changes - separating the `NodeId` that identifies an enum variant from the `NodeId` that identifies the variant's constructor; and no longer creating a `NodeId` for `Struct`-style enum variants and structs. Separation of the variant id and variant constructor id will allow the rest of RFC 2008 to be implemented by lowering the visibility of the variant's constructor without lowering the visbility of the variant itself. No longer creating a `NodeId` for `Struct`-style enum variants and structs mostly simplifies logic as previously this `NodeId` wasn't used. There were various cases where the `NodeId` wouldn't be used unless there was an unit or tuple struct or enum variant but not all uses of this `NodeId` had that condition, by removing this `NodeId`, this must be explicitly dealt with. This change mostly applied cleanly, but there were one or two cases in name resolution and one case in type check where the existing logic required a id for `Struct`-style enum variants and structs.
2019-03-23Mark duplicate import removal suggestion tool onlyEsteban Küber-1/+1
2019-03-23Hide obvious suggestion from cli outputEsteban Küber-1/+1