about summary refs log tree commit diff
path: root/src/librustc_resolve
AgeCommit message (Collapse)AuthorLines
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-25Fix error code descriptionvarkor-2/+5
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/+52
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-23Rollup merge of #59823 - davidtwco:issue-54716, r=cramertjMazdak Farrokhzad-10/+26
[wg-async-await] Drop `async fn` arguments in async block Fixes #54716. This PR modifies the HIR lowering (and some other places to make this work) so that unused arguments to a async function are always dropped inside the async move block and not at the end of the function body. ``` async fn foo(<pattern>: <type>) { async move { } } // <-- dropped as you "exit" the fn // ...becomes... fn foo(__arg0: <ty>) { async move { let <pattern>: <ty> = __arg0; } // <-- dropped as you "exit" the async block } ``` However, the exact ordering of drops is not the same as a regular function, [as visible in this playground example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2015&gist=be39af1a58e5d430be1eb3c722cb1ec3) - I believe this to be an unrelated issue. There is a [Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/187312-t-compiler.2Fwg-async-await/topic/.2354716.20drop.20order) for this. r? @cramertj cc @nikomatsakis
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-21Remove mutability from `Def::Static`Vadim Petrochenkov-6/+5
2019-04-19remove duplicated code and simplify logicEsteban Küber-59/+34
2019-04-19Identify missing ambiguous case with best effort suggestionEsteban Küber-47/+81
2019-04-19Rollup merge of #60061 - estebank:field-sugg, r=davidtwcoMazdak Farrokhzad-10/+12
Change suggestion of field when not in self context Fix #60057.
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-18review comments: change wordingEsteban Küber-1/+1
2019-04-18Change suggestion of field when not in self contextEsteban Küber-10/+12
2019-04-18Auto merge of #60025 - JohnTitor:rename-files, r=petrochenkovbors-2495/+2495
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-17Rename error_reporting to diagnosticsYuki OKUSHI-0/+0
2019-04-17Rename diagnostics to error_codesYuki OKUSHI-0/+0
2019-04-17Deny `internal` in stage0Mateusz Mikuła-1/+1
2019-04-15Preallocate BUILTIN_ATTRIBUTES symbols and use a hash map instead of loopingJohn Kåre Alsaker-3/+2
2019-04-14Rollup merge of #59896 - estebank:dedup-spans, r=davidtwcoMazdak Farrokhzad-4/+4
Remove duplicated redundant spans Fix #59895.
2019-04-14HirIdify hir::Defljedrz-14/+35
2019-04-14Rollup merge of #59784 - davidtwco:issue-59764, r=estebankMazdak Farrokhzad-114/+356
Suggest importing macros from the crate root Fixes #59764. r? @estebank cc @varkor
2019-04-12Add test and fix dedupEsteban Küber-0/+1
2019-04-12Switch to multipart suggestions.David Wood-41/+39
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-12Improve robustness of nested check.David Wood-24/+25
This commit removes the assumption that the start of a use statement will always be on one line with a single space - which was silly in the first place.
2019-04-12Handle edge cases.David Wood-68/+239
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-12Handle renamed imports.David Wood-18/+19
This commit extends the suggestion to handle imports that are aliased to another name.
2019-04-12Suggest macro import from crate root.David Wood-38/+109
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-11Remove duplicated redundant spansEsteban Küber-4/+3
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-19/+42
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-26/+38
2019-03-30Handle glob import in redundancy checkFabian Drinck-1/+4
2019-03-30Replace REDUNDANT_IMPORT with UNUSED_IMPORTSFabian Drinck-2/+2
2019-03-30Distinguish between imported and defined itemsFabian Drinck-1/+2
2019-03-30Improve warningFabian Drinck-10/+5
2019-03-30Edit commentsFabian Drinck-1/+3
2019-03-30Remove redundant importsFabian Drinck-1/+0
2019-03-30Add lint for redundant importsFabian Drinck-1/+92
Co-authored-by: Stephan Schauerte <stephan.schauerte@gmail.com>
2019-03-30Rollup merge of #59376 - davidtwco:finally-rfc-2008-variants, ↵Mazdak Farrokhzad-1/+9
r=petrochenkov,QuietMisdreavus RFC 2008: Enum Variants Part of #44109. See [Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/rfc-2008/near/132663140) for previous discussion. r? @petrochenkov cc @nikomatsakis
2019-03-29Fix error in Rust 2018 + no_core environmentTaiki Endo-1/+6
2019-03-28Implement `#[non_exhaustive]` on variants.David Wood-1/+9
This commit removes the check that disallows the `#[non_exhaustive]` attribute from being placed on enum variants and removes the associated tests. Further, this commit lowers the visibility of enum variant constructors when the variant is marked as non-exhaustive.
2019-03-26Rollup merge of #59267 - estebank:assoc-const-as-field, r=davidtwcoMazdak Farrokhzad-54/+41
Provide suggestion when using field access instead of path When trying to access an associated constant as if it were a field of an instance, provide a suggestion for the correct syntax. Fix #57316.
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.