summary refs log tree commit diff
path: root/src/librustc_resolve/lib.rs
AgeCommit message (Collapse)AuthorLines
2017-09-21Auto merge of #44215 - oli-obk:import_sugg, r=nrcbors-17/+37
don't suggest placing `use` statements into expanded code r? @nrc fixes #44210 ```rust #[derive(Debug)] struct Foo; type X = Path; ``` will try to place `use std::path::Path;` between `#[derive(Debug)]` and `struct Foo;` I am not sure how to obtain a span before the first attribute, because derive attributes are removed during expansion. It would be trivial to detect this case and place the `use` after the item, but that would be somewhat weird I think.
2017-09-12Remove the `cstore` reference from Session in order to prepare encapsulating ↵Michael Woerister-2/+6
CrateStore access in tcx.
2017-09-11Auto merge of #44435 - alexcrichton:in-scope, r=michaelwoeristerbors-1/+1
rustc: Remove HirId from queries This'll allow us to reconstruct query parameters purely from the `DepNode` they're associated with. Closes #44414
2017-09-11rustc: Remove HirId from queriesAlex Crichton-1/+1
This'll allow us to reconstruct query parameters purely from the `DepNode` they're associated with. Some queries could move straight to `HirId` but others that don't always have a correspondance between `HirId` and `DefId` moved to two-level maps where the query operates over a `DefIndex`, returning a map, which is then keyed off `ItemLocalId`. Closes #44414
2017-09-08Use NodeId/HirId instead of DefId for local variables.Eduard-Mihai Burtescu-6/+5
2017-09-01Prevent suggestions from being emitted if all possible locations are inside ↵Oliver Schneider-15/+23
expansions
2017-08-31WIP: don't suggest placing `use` statements into expanded codeOliver Schneider-2/+14
2017-08-30Make fields of `Span` privateVadim Petrochenkov-11/+7
2017-08-27Address review comments, second turnTatsuyuki Ishi-3/+3
2017-08-27Move unused-extern-crate to late passTatsuyuki Ishi-2/+4
2017-08-25*: remove crate_{name,type} attributesTamir Duberstein-3/+0
Fixes #41701.
2017-08-21Auto merge of #43986 - petrochenkov:pubcrate3, r=pnkfelixbors-28/+1
rustc: Remove some dead code Extracted from https://github.com/rust-lang/rust/pull/43192 r? @eddyb
2017-08-19rustc: Remove some dead codeVadim Petrochenkov-28/+1
2017-08-18Add an additional empty line between the suggested `use` and the next itemOliver Schneider-3/+14
2017-08-17Improve placement of `use` suggestionsOliver Schneider-20/+99
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-16/+16
Like #43008 (f668999), but _much more aggressive_.
2017-08-12Fix some typosBastien Orivel-1/+1
2017-08-09rustc: Rearchitect lints to be emitted more eagerlyAlex Crichton-6/+7
In preparation for incremental compilation this commit refactors the lint handling infrastructure in the compiler to be more "eager" and overall more incremental-friendly. Many passes of the compiler can emit lints at various points but before this commit all lints were buffered in a table to be emitted at the very end of compilation. This commit changes these lints to be emitted immediately during compilation using pre-calculated lint level-related data structures. Linting today is split into two phases, one set of "early" lints run on the `syntax::ast` and a "late" set of lints run on the HIR. This commit moves the "early" lints to running as late as possible in compilation, just before HIR lowering. This notably means that we're catching resolve-related lints just before HIR lowering. The early linting remains a pass very similar to how it was before, maintaining context of the current lint level as it walks the tree. Post-HIR, however, linting is structured as a method on the `TyCtxt` which transitively executes a query to calculate lint levels. Each request to lint on a `TyCtxt` will query the entire crate's 'lint level data structure' and then go from there about whether the lint should be emitted or not. The query depends on the entire HIR crate but should be very quick to calculate (just a quick walk of the HIR) and the red-green system should notice that the lint level data structure rarely changes, and should hopefully preserve incrementality. Overall this resulted in a pretty big change to the test suite now that lints are emitted much earlier in compilation (on-demand vs only at the end). This in turn necessitated the addition of many `#![allow(warnings)]` directives throughout the compile-fail test suite and a number of updates to the UI test suite.
2017-08-01Auto merge of #43552 - petrochenkov:instab, r=jseyfriedbors-3/+17
resolve: Try to fix instability in import suggestions cc https://github.com/rust-lang/rust/pull/42033 `lookup_import_candidates` walks module graph in DFS order and skips modules that were already visited (which is correct because there can be cycles). However it means that if we visited `std::prelude::v1::Result::Ok` first, we will never visit `std::result::Result::Ok` because `Result` will be skipped as already visited (note: enums are also modules here), and otherwise, if we visited `std::result::Result::Ok` first, we will never get to `std::prelude::v1::Result::Ok`. What child module of `std` (`prelude` or `result`) we will visit first, depends on randomized hashing, so we have instability in diagnostics. With this patch modules' children are visited in stable order in `lookup_import_candidates`, this should fix the issue, but let's see what Travis will say. r? @oli-obk
2017-07-30default binding modes: add pat_binding_modesTobias Schottdorf-1/+2
This PR kicks off the implementation of the [default binding modes RFC][1] by introducing the `pat_binding_modes` typeck table mentioned in the [mentoring instructions][2]. `pat_binding_modes` is populated in `librustc_typeck/check/_match.rs` and used wherever the HIR would be scraped prior to this PR. Unfortunately, one blemish, namely a two callers to `contains_explicit_ref_binding`, remains. This will likely have to be removed when the second part of [1], the `pat_adjustments` table, is tackled. Appropriate comments have been added. See #42640. [1]: https://github.com/rust-lang/rfcs/pull/2005 [2]: https://github.com/rust-lang/rust/issues/42640#issuecomment-313535089
2017-07-30resolve: Fix instability in import suggestionsVadim Petrochenkov-3/+17
2017-07-26Rollup merge of #43447 - estebank:import-span, r=nikomatsakisMark Simulacrum-61/+80
Point at path segment on module not found Point at the correct path segment on a import statement where a module doesn't exist. New output: ```rust error[E0432]: unresolved import `std::bar` --> <anon>:1:10 | 1 | use std::bar::{foo1, foo2}; | ^^^ Could not find `bar` in `std` ``` instead of: ```rust error[E0432]: unresolved import `std::bar::foo1` --> <anon>:1:16 | 1 | use std::bar::{foo1, foo2}; | ^^^^ Could not find `bar` in `std` error[E0432]: unresolved import `std::bar::foo2` --> <anon>:1:22 | 1 | use std::bar::{foo1, foo2}; | ^^^^ Could not find `bar` in `std` ``` Fix #43040.
2017-07-25Point at path segment on module not foundEsteban Küber-61/+80
Point at the correct path segment on a import statement where a module doesn't exist. New output: ```rust error[E0432]: unresolved import `std::bar` --> <anon>:1:10 | 1 | use std::bar::{foo1, foo2}; | ^^^ Could not find `bar` in `std` ``` instead of: ```rust error[E0432]: unresolved import `std::bar::foo1` --> <anon>:1:16 | 1 | use std::bar::{foo1, foo2}; | ^^^^ Could not find `bar` in `std` error[E0432]: unresolved import `std::bar::foo2` --> <anon>:1:22 | 1 | use std::bar::{foo1, foo2}; | ^^^^ Could not find `bar` in `std` ```
2017-07-25Bump master to 1.21.0Alex Crichton-2/+0
This commit bumps the master branch's version to 1.21.0 and also updates the bootstrap compiler from the freshly minted beta release.
2017-07-23Auto merge of #43096 - estebank:ascription-help, r=nikomatsakisbors-14/+63
Point at `:` when using it instead of `;` When triggering type ascription in such a way that we can infer a statement end was intended, add a suggestion for the change. Always point out the reason for the expectation of a type is due to type ascription. Fix #42057, #41928.
2017-07-18Handle type ascription cases with a method call instead of a typeEsteban Küber-14/+63
2017-07-17Change some helps to suggestionsOliver Schneider-8/+12
2017-07-10Store all generic arguments for method calls in ASTVadim Petrochenkov-8/+6
2017-07-06remove associated_consts feature gateSean McArthur-1/+2
2017-06-29Make `$crate` a keywordVadim Petrochenkov-2/+3
2017-06-22change span label for E0435 (fix #41871)Alex Burka-1/+1
2017-06-21Auto merge of #42076 - alex-ozdemir:master, r=nrcbors-23/+39
Clearer Error Message for Duplicate Definition Clearer use of the error message and span labels to communicate duplication definitions/imports. fixes #42061
2017-06-19Bump version and stage0 compilerAlex Crichton-4/+0
2017-06-15Clearer Error Message for Duplicate DefinitionAlex Ozdemir-23/+39
Clearer use of the error message and span labels to communicate duplicaiton defitions/imports. New error format: ``` error[E0428]: the name `Foo` is defined twice --> example.rs:2:1 | 1 | trait Foo { } | ------------- previous definition of the trait `Foo` here 2 | struct Foo { } | ^^^^^^^^^^^^^^ `Foo` redefined here = note: `Foo` must be defined only once in the type namespace of this module error: aborting due to previous error ```
2017-06-03Auto merge of #42387 - GuillaumeGomez:error-codes-next, r=Susurrusbors-1/+1
Add E0603 error code Part of #42229. cc @Susurrus
2017-06-03Auto merge of #42334 - est31:master, r=jseyfriedbors-1/+1
Extend the unused macro lint to macros 2.0 Extends the unused macro lint (added in PR #41907) to macros 2.0 (added in PR #40847). r? @jseyfried
2017-06-02Add E0603 error codeGuillaume Gomez-1/+1
2017-05-31Fix a test and address review commentest31-1/+1
2017-05-31Extend the unused macro lint to macros 2.0est31-1/+1
2017-05-30Turn sufficiently old compatibility lints into hard errorsVadim Petrochenkov-12/+5
2017-05-25Improve `Self`.Jeffrey Seyfried-1/+5
2017-05-25Hygienize `librustc_typeck`.Jeffrey Seyfried-1/+1
2017-05-25Hygienize `librustc_resolve`.Jeffrey Seyfried-64/+152
2017-05-25Remove `trait_item_map`, clean up `resolver.with_type_parameter_rib()`.Jeffrey Seyfried-46/+60
2017-05-25Declarative macros 2.0 without hygiene.Jeffrey Seyfried-2/+10
2017-05-16Auto merge of #41907 - est31:macro_unused, r=jseyfriedbors-0/+5
Add lint for unused macros Addresses parts of #34938, to add a lint for unused macros. We now output warnings by default when we encounter a macro that we didn't use for expansion. Issues to be resolved before this PR is ready for merge: - [x] fix the NodeId issue described above - [x] remove all unused macros from rustc and the libraries or set `#[allow(unused_macros)]` next to them if they should be kept for some reason. This is needed for successful boostrap and bors to accept the PR. -> #41934 - [x] ~~implement the full extent of #34938, that means the macro match arm checking as well.~~ *let's not do this for now*
2017-05-15Address review commentsest31-6/+4
2017-05-13rustc_resolve: don't deny outer type parameters in embedded constants.Eduard-Mihai Burtescu-28/+25
2017-05-13Add lint for unused macrosest31-0/+7
2017-05-13Auto merge of #41965 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-61/+77
Rollup of 15 pull requests - Successful merges: #41820, #41860, #41876, #41896, #41912, #41916, #41918, #41921, #41923, #41934, #41935, #41940, #41942, #41943, #41951 - Failed merges: