summary refs log tree commit diff
path: root/src/librustc_resolve/lib.rs
AgeCommit message (Collapse)AuthorLines
2016-05-04resolve: improve performanceJeffrey Seyfried-11/+25
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-07Improve path resolution diagnosticsJeffrey Seyfried-66/+67
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-4/+4
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-20/+19
2016-04-04Auto merge of #32328 - jseyfried:coherence, r=nikomatsakisbors-26/+14
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-03-31librustc_resolve: use bug!(), span_bug!()Benjamin Herr-12/+13
2016-03-30Detect cycles that include renamed importsJeffrey Seyfried-2/+7
2016-03-27Refactor ModuleS fields `public_glob_count`, `private_glob_count`, andJeffrey Seyfried-20/+2
`resolved_globs` into a single field `globs: RefCell<Vec<ImportDirective>>`.
2016-03-27Add a type parameter to ImportDirectiveJeffrey Seyfried-5/+6
2016-03-27rustc: move cfg, infer, traits and ty from middle to top-level.Eduard Burtescu-2/+2
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-18/+14
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_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-1/+1
2016-03-26Make populate_module_if_necessary a method of resolverJeffrey Seyfried-2/+2
2016-03-26Rollup merge of #32131 - petrochenkov:prim, r=eddybManish Goregaokar-55/+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-5/+10
exclude the prelude from `resolve_name(.., allow_private_imports = true)`.
2016-03-25Refactor away DefModifiers::PRELUDEJeffrey Seyfried-2/+1
2016-03-25Refactor how the prelude is handledJeffrey Seyfried-18/+10
2016-03-25CleanupVadim Petrochenkov-30/+18
+ Fix a comment and add a test based on it
2016-03-25Lift the restriction on reusing names of primitive typesVadim Petrochenkov-39/+1
2016-03-25Introduce name resolution fallback for primitive typesVadim Petrochenkov-12/+37
2016-03-21Expose attached attributes to `FnKind` abstraction so that I can look at ↵Felix S. Klock II-3/+3
them in borrowck.
2016-03-20Alter E0412 help message wordingtiehuis-1/+1
The initial wording does not make sense due to an extra 'to'. There are two potential candidates we can change this to: - 'you can import it into scope' - 'to import it into scope' In keeping the changes minimal, we choose the first, as this is more in line with the grammar of the extended candidates help message.
2016-03-16Improve diagnostics for duplicate namesJeffrey Seyfried-11/+55
2016-03-12Auto merge of #32141 - jseyfried:fix_resolution_in_lexical_scopes, ↵bors-109/+51
r=nikomatsakis Fix name resolution in lexical scopes Currently, `resolve_item_in_lexical_scope` does not check the "ribs" (type parameters and local variables). This can allow items that should be shadowed by type parameters to be named. For example, ```rust struct T { i: i32 } fn f<T>() { let t = T { i: 0 }; // This use of `T` resolves to the struct, not the type parameter } mod Foo { pub fn f() {} } fn g<Foo>() { Foo::f(); // This use of `Foo` resolves to the module, not the type parameter } ``` This PR changes `resolve_item_in_lexical_scope` so that it fails when the item is shadowed by a rib (fixes #32120). This is a [breaking-change], but it looks unlikely to cause breakage in practice. r? @nikomatsakis
2016-03-11Comment `resolve_item_in_lexical_scope`Jeffrey Seyfried-1/+8
2016-03-08Refactor away check_ribsJeffrey Seyfried-40/+18
2016-03-08Include the crate root in the ribsJeffrey Seyfried-6/+3
2016-03-08Fix name resolution in lexical scopesJeffrey Seyfried-65/+25
2016-03-06Refactor away `ExternalExports`Jeffrey Seyfried-6/+1
2016-03-04Finish encapsulating the details of import resolution in resolve_importsJeffrey Seyfried-42/+9
2016-03-04Start importing bindings from globs as soon as the glob path is known.Jeffrey Seyfried-43/+6
2016-03-04Add a field in Module for the ResolverArenasJeffrey Seyfried-13/+28
2016-03-04Add an arena for import directivesJeffrey Seyfried-1/+9
2016-03-03Auto merge of #31824 - jseyfried:privacy_in_resolve, r=nikomatsakisbors-109/+95
This PR privacy checks paths as they are resolved instead of in `librustc_privacy` (fixes #12334 and fixes #31779). This removes the need for the `LastPrivate` system introduced in PR #9735, the limitations of which cause #31779. This PR also reports privacy violations in paths to intra- and inter-crate items the same way -- it always reports the first inaccessible segment of the path. Since it fixes #31779, this is a [breaking-change]. For example, the following code would break: ```rust mod foo { pub use foo::bar::S; mod bar { // `bar` should be private to `foo` pub struct S; } } impl foo::S { fn f() {} } fn main() { foo::bar::S::f(); // This is now a privacy error } ``` r? @alexcrichton
2016-03-02Add a span note on type definition spotvegai-1/+4
2016-03-01span_note => fileline_notevegai-1/+1
2016-02-26Auto merge of #31857 - jseyfried:fix_scoping, r=nikomatsakisbors-19/+27
This fixes a bug (#31845) introduced in #31105 in which lexical scopes contain items from all anonymous module ancestors, even if the path to the anonymous module includes a normal module: ```rust fn f() { fn g() {} mod foo { fn h() { g(); // This erroneously resolves on nightly } } } ``` This is a [breaking-change] on nightly but not on stable or beta. r? @nikomatsakis
2016-02-26Privacy check paths in resolve and typeckJeffrey Seyfried-4/+62
2016-02-26Refactor Module's field extern_crate_did: Option<DefId> to extern_crate_id: ↵Jeffrey Seyfried-7/+7
Option<NodeId>