about summary refs log tree commit diff
path: root/src/librustc_resolve
AgeCommit message (Collapse)AuthorLines
2016-05-30Rollup merge of #33793 - GuillaumeGomez:compile_fail, r=GuillaumeGomezManish Goregaokar-1/+1
Fix compile_fail tag Fixes #33780 r? @steveklabnik
2016-05-27Rollup merge of #33644 - petrochenkov:selfast, r=nrcManish Goregaokar-10/+6
The AST part of https://github.com/rust-lang/rust/pull/33505. https://github.com/rust-lang/rust/pull/33505 isn't landed yet, so this PR is based on top of it. r? @nrc plugin-[breaking-change] cc #31645 @Manishearth
2016-05-27Rollup merge of #33639 - petrochenkov:dotdot, r=nmatsakisManish Goregaokar-1/+1
cc https://github.com/rust-lang/rust/issues/33627 r? @nikomatsakis plugin-[breaking-change] cc https://github.com/rust-lang/rust/issues/31645 @Manishearth
2016-05-27Rollup merge of #33351 - birkenfeld:loop-label-spans, r=pnkfelixManish Goregaokar-3/+3
This makes the \"shadowing labels\" warning *not* print the entire loop as a span, but only the lifetime. Also makes #31719 go away, but does not fix its root cause (the span of the expanded loop is still wonky, but not used anymore).
2016-05-27* Fix compile_fail tag (in some cases, it compiled whereas it wasn't ↵Guillaume Gomez-1/+1
expected to and was still considered 'ok') * Fix error explanations tests/tags
2016-05-26Implement `..` in tuple (struct) patternsVadim Petrochenkov-1/+1
2016-05-25Fix rebaseVadim Petrochenkov-8/+4
2016-05-25Remove ExplicitSelf from ASTVadim Petrochenkov-2/+2
2016-05-24Auto merge of #33615 - GuillaumeGomez:field_static_method, r=pnkfelixbors-22/+64
Don't suggest using fields in a static method Fixes #33613. cc @LeoTestard
2016-05-24syntax/hir: give loop labels a spanGeorg Brandl-3/+3
This makes the "shadowing labels" warning *not* print the entire loop as a span, but only the lifetime. Also makes #31719 go away, but does not fix its root cause (the span of the expanded loop is still wonky, but not used anymore).
2016-05-23Don't suggest using fields in a static methodggomez-22/+64
2016-05-18ignore dep-graph in resolve and lower_crateNiko Matsakis-0/+1
This got removed at some point, it seems.
2016-05-16lowering: Rename identifiers only when necessaryVadim Petrochenkov-0/+4
Do not rename invalid identifiers, they stop being invalid after renaming
2016-05-16Remove hir::IdentVadim Petrochenkov-1/+1
2016-05-15Auto merge of #33505 - petrochenkov:self, r=nrcbors-1/+0
Remove ExplicitSelf from HIR `self` argument is already kept in the argument list and can be retrieved from there if necessary, so there's no need for the duplication. The same changes can be applied to AST, I'll make them in the next breaking batch. The first commit also improves parsing of method declarations and fixes https://github.com/rust-lang/rust/issues/33413. r? @eddyb
2016-05-15Auto merge of #33619 - jonathandturner:improve_structured_errors, r=nikomatsakisbors-27/+48
Batch of improvements to errors for new error format This is a batch of improvements to existing errors to help get the most out of the new error format. * Added labels to primary spans (^^^) for a set of errors that didn't currently have them * Highlight the source blue under the secondary notes for better readability * Move some of the "Note:" into secondary spans+labels * Fix span_label to take &mut instead, which makes it work the same as other methods in that set
2016-05-14Remove ExplicitSelf from HIRVadim Petrochenkov-1/+0
2016-05-14Rollup merge of #33572 - nagisa:assoc-const-types, r=eddybManish Goregaokar-3/+1
Support references to outer type params for assoc consts Fixes #28809 r? @eddyb
2016-05-13Address nitJonathan Turner-1/+1
2016-05-13Auto merge of #33596 - nikomatsakis:issue-33586-regr-assoc-type-path, r=eddybbors-0/+2
re-introduce a cache for ast-ty-to-ty It turns out that `ast_ty_to_ty` is supposed to be updating the `def` after it finishes, but at some point in the past it stopped doing so. This was never noticed because of the `ast_ty_to_ty_cache`, but that cache was recently removed. This PR fixes the code to update the def properly, but apparently that is not quite enough to make the operation idempotent, so for now we reintroduce the cache too. Fixes #33586. r? @eddyb
2016-05-12Update errors to use new error formatJonathan Turner-21/+22
2016-05-12Updating a few more errors with labelsJonathan Turner-26/+46
2016-05-12Auto merge of #33282 - alexcrichton:rustbuild-crate-tests, r=brsonbors-0/+1
rustbuild: Add support for crate tests + doctests This commit adds support to rustbuild to run crate unit tests (those defined by `#[test]`) as well as documentation tests. All tests are powered by `cargo test` under the hood. Each step requires the `libtest` library is built for that corresponding stage. Ideally the `test` crate would be a dev-dependency, but for now it's just easier to ensure that we sequence everything in the right order. Currently no filtering is implemented, so there's not actually a method of testing *only* libstd or *only* libcore, but rather entire swaths of crates are tested all at once. A few points of note here are: * The `coretest` and `collectionstest` crates are just listed as `[[test]]` entires for `cargo test` to naturally pick up. This mean that `cargo test -p core` actually runs all the tests for libcore. * Libraries that aren't tested all mention `test = false` in their `Cargo.toml` * Crates aren't currently allowed to have dev-dependencies due to rust-lang/cargo#860, but we can likely alleviate this restriction once workspaces are implemented. cc #31590
2016-05-12re-introduce a cache for ast-ty-to-tyNiko Matsakis-0/+2
It turns out that `ast_ty_to_ty` is supposed to be updating the `def` after it finishes, but at some point in the past it stopped doing so. This was never noticed because of the `ast_ty_to_ty_cache`, but that cache was recently removed. This PR fixes the code to update the def properly, but apparently that is not quite enough to make the operation idempotent, so for now we reintroduce the cache too. Fixes #33425.
2016-05-12rustbuild: Add support for crate tests + doctestsAlex Crichton-0/+1
This commit adds support to rustbuild to run crate unit tests (those defined by `#[test]`) as well as documentation tests. All tests are powered by `cargo test` under the hood. Each step requires the `libtest` library is built for that corresponding stage. Ideally the `test` crate would be a dev-dependency, but for now it's just easier to ensure that we sequence everything in the right order. Currently no filtering is implemented, so there's not actually a method of testing *only* libstd or *only* libcore, but rather entire swaths of crates are tested all at once. A few points of note here are: * The `coretest` and `collectionstest` crates are just listed as `[[test]]` entires for `cargo test` to naturally pick up. This mean that `cargo test -p core` actually runs all the tests for libcore. * Libraries that aren't tested all mention `test = false` in their `Cargo.toml` * Crates aren't currently allowed to have dev-dependencies due to rust-lang/cargo#860, but we can likely alleviate this restriction once workspaces are implemented. cc #31590
2016-05-12Do not use const Rib for associated constantsSimonas Kazlauskas-3/+1
2016-05-11rustc: Remove the unnecessary ast_ty_to_ty_cache.Eduard Burtescu-1/+1
2016-05-10Auto merge of #33471 - birkenfeld:issue-33464, r=jseyfriedbors-4/+1
resolve: do not modify span of non-importable name This span modification is probably leftover from a time when import spans were assigned differently. With this change, error spans for the following are properly reported: ``` use abc::one_el; use abc::{a, bbb, cccccc}; use a_very_long_name::{el, el2}; ``` before (spans only): ``` x.rs:3 use abc::one_el; ^~~ x.rs:4 use abc::{a, bbb, cccccc}; ^~~ x.rs:4 use abc::{a, bbb, cccccc}; ^~~ x.rs:4 use abc::{a, bbb, cccccc}; ^~~ (internal compiler error: unprintable span) (internal compiler error: unprintable span) ``` after: ``` x.rs:3 use abc::one_el; ^~~~~~~~~~~ x.rs:4 use abc::{a, bbb, cccccc}; ^ x.rs:4 use abc::{a, bbb, cccccc}; ^~~ x.rs:4 use abc::{a, bbb, cccccc}; ^~~~~~ x.rs:5 use a_very_long_name::{el, el2}; ^~ x.rs:5 use a_very_long_name::{el, el2}; ^~~ ``` Fixes: #33464
2016-05-10resolve: do not modify span of non-importable nameGeorg Brandl-4/+1
This span modification is probably leftover from a time when import spans were assigned differently. With this change, error spans for the following are properly reported: ``` use abc::one_el; use abc::{a, bbb, cccccc}; use a_very_long_name::{el, el2}; ``` before (spans only): ``` x.rs:3 use abc::one_el; ^~~ x.rs:4 use abc::{a, bbb, cccccc}; ^~~ x.rs:4 use abc::{a, bbb, cccccc}; ^~~ x.rs:4 use abc::{a, bbb, cccccc}; ^~~ (internal compiler error: unprintable span) (internal compiler error: unprintable span) ``` after: ``` x.rs:3 use abc::one_el; ^~~~~~~~~~~ x.rs:4 use abc::{a, bbb, cccccc}; ^ x.rs:4 use abc::{a, bbb, cccccc}; ^~~ x.rs:4 use abc::{a, bbb, cccccc}; ^~~~~~ x.rs:5 use a_very_long_name::{el, el2}; ^~ x.rs:5 use a_very_long_name::{el, el2}; ^~~ ``` Fixes: #33464
2016-05-09Auto merge of #33443 - jseyfried:resolve_ast, r=nrcbors-383/+403
Perform name resolution before and during ast->hir lowering This PR performs name resolution before and during ast->hir lowering instead of in phase 3. r? @nrc
2016-05-09Refactor `hir::lowering::Resolver`Jeffrey Seyfried-4/+5
2016-05-08Merge E0410 into E0408Manish Goregaokar-32/+22
2016-05-09Resolve paths generated in the ast->hir lowererJeffrey Seyfried-18/+51
2016-05-09Refactor the interface that `resolve` exposes to `driver`Jeffrey Seyfried-52/+20
2016-05-09Move resolution to before loweringJeffrey Seyfried-292/+316
2016-05-09Refactor `Resolver` field `def_map` from `RefCell<DefMap>` to `DefMap`Jeffrey Seyfried-13/+12
2016-05-09Remove a use of `ast_map.span_if_local()` in `resolve`Jeffrey Seyfried-39/+34
2016-05-08Add E0408/E0409Manish Goregaokar-4/+87
2016-05-08Rollup merge of #33406 - Manishearth:diag-improve-const-let, r=GuillaumeGomezManish Goregaokar-5/+67
Improve diagnostics for constants being used in irrefutable patterns It's pretty confusing and this error triggers in resolve only when "shadowing" a const, so let's make that clearer. r? @steveklabnik
2016-05-08Auto merge of #33091 - sanxiyn:unused-trait-import-3, r=nrcbors-17/+43
Warn unused trait imports, rebased Rebase of #30021. Fix #25730.
2016-05-05Add long diagnostics for E0414Manish Goregaokar-1/+63
2016-05-04Improve diagnostics for constants being used in irrefutable patternsManish Goregaokar-4/+4
It's pretty confusing and this error triggers in resolve only when "shadowing" a const, so let's make that clearer.
2016-05-03Rollup merge of #33340 - birkenfeld:issue-23716, r=ManishearthManish Goregaokar-11/+25
resolve: print location of static for "static in pattern" error The implementation mirrors the one for "constant defined here" annotation used for constant patterns in the irrefutable-pattern case. Fixes: #23716
2016-05-03Warn unused trait importsSeo Sanghyeon-13/+42
2016-05-03Remove unused trait imports flagged by lintSeo Sanghyeon-4/+1
2016-05-03Rollup merge of #33320 - birkenfeld:issue31573, r=arielb1Manish Goregaokar-4/+7
diagnostics for E0432: imports are relative to crate root This is curiously missing from both the short message and this long diagnostic. Refs #31573 (not sure if it should be considered "fixed" as the short message still only refers to extern crates).
2016-05-02resolve: print location of static for "static in pattern" errorGeorg Brandl-11/+25
The implementation mirrors the one for "constant defined here" annotation used for constant patterns in the irrefutable-pattern case. Fixes: #23716
2016-05-02fix rebase flawsNiko Matsakis-2/+1
2016-05-02replace fileline_{help,note} with {help,note}Niko Matsakis-17/+12
The extra filename and line was mainly there to keep the indentation relative to the main snippet; now that this doesn't include filename/line-number as a prefix, it is distracted.
2016-05-02diagnostics for E0432: imports are relative to crate rootGeorg Brandl-4/+7
This is curiously missing from both the short message and this long diagnostic. Refs #31573 (not sure if it should be considered "fixed" as the short message still only refers to extern crates).