summary refs log tree commit diff
path: root/src/librustc_resolve
AgeCommit message (Collapse)AuthorLines
2016-05-04resolve: improve performanceJeffrey Seyfried-11/+25
2016-05-04Add commentsJeffrey Seyfried-0/+4
2016-05-04Detect duplicate glob imports arising from glob cyclesJeffrey Seyfried-13/+18
2016-04-07Rollup merge of #32789 - jseyfried:fix_duplicate_resolve_errors, r=eddybManish Goregaokar-66/+69
resolve: Avoid emitting redundant path resolution errors This PR avoids emitting redundant path resolution errors in `resolve` (fixes #32760). r? @eddyb
2016-04-07Fix tidy errorsJeffrey Seyfried-2/+4
2016-04-07Make `hir::Visibility` non-copyable and add `ty::Visibility`Jeffrey Seyfried-2/+2
2016-04-07Improve path resolution diagnosticsJeffrey Seyfried-66/+67
2016-04-06Rollup merge of #32724 - sanxiyn:outdated-comment, r=dotdashSteve Klabnik-20/+5
Remove outdated comment The corresponding code was removed in #31824. Also remove code duplication and rename the function.
2016-04-06rustc: move some maps from ty to hir.Eduard Burtescu-4/+4
2016-04-06rustc: move middle::{def,def_id,pat_util} to hir.Eduard Burtescu-7/+7
2016-04-06rustc: dismantle hir::util, mostly moving functions to methods.Eduard Burtescu-2/+1
2016-04-06rustc: move rustc_front to rustc::hir.Eduard Burtescu-33/+31
2016-04-05Rollup merge of #32403 - vlastachu:super_in_path, r=jseyfriedManish Goregaokar-2/+18
Fix issue: Global paths in `use` directives can begin with `super` or `self` #32225 This PR fixes #32225 by warning on `use ::super::...` and `use ::self::...` on `resolve`. Current changes is the most minimal and ad-hoc.
2016-04-05Fixes bug which accepting using `super` in use statemet.vlastachu-2/+18
Issue: #32225
2016-04-04Auto merge of #32328 - jseyfried:coherence, r=nikomatsakisbors-201/+196
resolve: Improve import failure detection and lay groundwork for RFC 1422 This PR improves import failure detection and lays some groundwork for RFC 1422. More specifically, it - Avoids recomputing the resolution of an import directive's module path. - Refactors code in `resolve_imports` that does not scale to the arbitrarily many levels of visibility that will be required by RFC 1422. - Replaces `ModuleS`'s fields `public_glob_count`, `private_glob_count`, and `resolved_globs` with a list of glob import directives `globs`. - Replaces `NameResolution`'s fields `pub_outstanding_references` and `outstanding_references` with a field `single_imports` of a newly defined type `SingleImports`. - Improves import failure detection by detecting cycles that include single imports (currently, only cycles of globs are detected). This fixes #32119. r? @nikomatsakis
2016-04-04Remove outdated commentSeo Sanghyeon-20/+5
2016-03-31librustc_resolve: use bug!(), span_bug!()Benjamin Herr-13/+14
2016-03-31Fix suggestionsJeffrey Seyfried-2/+8
2016-03-30Detect cycles that include renamed importsJeffrey Seyfried-16/+25
2016-03-27Improve import failure detectionJeffrey Seyfried-23/+19
2016-03-27Add `SingleImports` and use it in place of `outstanding_references`Jeffrey Seyfried-104/+114
and `pub_outstanding_references`.
2016-03-27Refactor ModuleS fields `public_glob_count`, `private_glob_count`, andJeffrey Seyfried-57/+25
`resolved_globs` into a single field `globs: RefCell<Vec<ImportDirective>>`.
2016-03-27Avoid recomputing the target module for an import directive.Jeffrey Seyfried-7/+10
2016-03-27Add a field `target_module: Cell<Option<Module>>` to `ImportDirective`Jeffrey Seyfried-0/+3
2016-03-27Add a type parameter to ImportDirectiveJeffrey Seyfried-14/+14
2016-03-27rustc: move cfg, infer, traits and ty from middle to top-level.Eduard Burtescu-3/+3
2016-03-27rustc: move middle::subst into middle::ty.Eduard Burtescu-1/+1
2016-03-26Cleanup trait searchJeffrey Seyfried-10/+7
2016-03-26Remove unnecessary `pub`sJeffrey Seyfried-24/+20
2016-03-26Remove an `if` statement with an condition that is always falseJeffrey Seyfried-1/+0
2016-03-26Remove outdated commentJeffrey Seyfried-3/+0
2016-03-26Improve the error message for paths with too many initial `super`sJeffrey Seyfried-20/+6
2016-03-26Refactor away `resolve_import_for_module`Jeffrey Seyfried-16/+14
2016-03-26Avoid passing around the current module as an argument in `resolve_imports`Jeffrey Seyfried-31/+17
2016-03-26Refactor away `resolve_name_in_lexical_scope` and ↵Jeffrey Seyfried-81/+42
`resolve_identifier_in_local_ribs`.
2016-03-26Refactor out the common functionality ofJeffrey Seyfried-52/+61
`resolve_item_in_lexical_scope` and `resolve_identifier_in_local_ribs` into a new function `resolve_ident_in_lexical_scope`.
2016-03-26Replace uses of `DefLike` with `Def` (only the `DlDef` variant of `DefLike` ↵Jeffrey Seyfried-34/+16
was being used)
2016-03-26Refactor away GraphBuilderJeffrey Seyfried-38/+11
2016-03-26Make populate_module_if_necessary a method of resolverJeffrey Seyfried-20/+16
2016-03-26Avoid repeating parentJeffrey Seyfried-25/+11
2016-03-26Refactor away populate_external_moduleJeffrey Seyfried-25/+4
2016-03-26Refactor away handle_external_defJeffrey Seyfried-67/+36
2016-03-26Rollup merge of #32131 - petrochenkov:prim, r=eddybManish Goregaokar-100/+30
resolve: Minimize hacks in name resolution of primitive types When resolving the first unqualified segment in a path with `n` segments and `n - 1` associated item segments, e.g. (`a` or `a::assoc` or `a::assoc::assoc` etc) try to resolve `a` without considering primitive types first. If the "normal" lookup fails or results in a module, then try to resolve `a` as a primitive type as a fallback. This way backward compatibility is respected, but the restriction from E0317 can be lifted, i.e. primitive names mostly can be shadowed like any other names. Furthermore, if names of primitive types are [put into prelude](https://github.com/petrochenkov/rust/tree/prim2) (now it's possible to do), then most of names will be resolved in conventional way and amount of code relying on this fallback will be greatly reduced. Although, it's not entirely convenient to put them into prelude right now due to temporary conflicts like `use prelude::v1::*; use usize;` in libcore/libstd, I'd better wait for proper glob shadowing before doing it. I wish the `no_prelude` attribute were unstable as intended :( cc @jseyfried @arielb1 r? @eddyb
2016-03-25Add and use `resolve_name_in_lexical_scope` andJeffrey Seyfried-7/+20
exclude the prelude from `resolve_name(.., allow_private_imports = true)`.
2016-03-25Refactor away `NameResolution::result`Jeffrey Seyfried-16/+10
2016-03-25Refactor away DefModifiers::PRELUDEJeffrey Seyfried-17/+12
2016-03-25Refactor how the prelude is handledJeffrey Seyfried-30/+21
2016-03-25Refactor away resolve_imports::Shadowable and rename shadowable -> is_preludeJeffrey Seyfried-23/+10
2016-03-25Auto merge of #31908 - jseyfried:disallow_shadowed_traits, r=nikomatsakisbors-3/+3
Disallow methods from traits that are not in scope This PR only allows a trait method to be used if the trait is in scope (fixes #31379). This is a [breaking-change]. For example, the following would break: ```rust mod foo { pub trait T { fn f(&self) {} } impl T for () {} } mod bar { pub use foo::T; } fn main() { pub use bar::*; struct T; // This shadows the trait `T`, ().f() // making this an error. } ``` r? @nikomatsakis
2016-03-25CleanupVadim Petrochenkov-30/+18
+ Fix a comment and add a test based on it