summary refs log tree commit diff
path: root/src/librustc_resolve
AgeCommit message (Collapse)AuthorLines
2017-06-22resolve: fix perf bug.Jeffrey Seyfried-1/+4
2017-06-03Auto merge of #42387 - GuillaumeGomez:error-codes-next, r=Susurrusbors-1/+30
Add E0603 error code Part of #42229. cc @Susurrus
2017-06-03Auto merge of #42334 - est31:master, r=jseyfriedbors-1/+5
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/+30
2017-05-31Fix a test and address review commentest31-1/+1
2017-05-31Extend the unused macro lint to macros 2.0est31-1/+5
2017-05-30Turn public reexporting of private extern crates into a lint againVadim Petrochenkov-2/+10
2017-05-30Turn sufficiently old compatibility lints into hard errorsVadim Petrochenkov-29/+13
2017-05-28Add note regarding parent module containing use statement.Mark Simulacrum-0/+26
2017-05-25Improve `Self`.Jeffrey Seyfried-1/+5
2017-05-25Improve intercrate hygiene.Jeffrey Seyfried-9/+9
2017-05-25Hygienize `librustc_typeck`.Jeffrey Seyfried-4/+12
2017-05-25Hygienize `librustc_resolve`.Jeffrey Seyfried-139/+265
2017-05-25Remove `trait_item_map`, clean up `resolver.with_type_parameter_rib()`.Jeffrey Seyfried-57/+73
2017-05-25Declarative macros 2.0 without hygiene.Jeffrey Seyfried-14/+33
2017-05-16Auto merge of #41907 - est31:macro_unused, r=jseyfriedbors-2/+29
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-13/+11
2017-05-13rustc_resolve: don't deny outer type parameters in embedded constants.Eduard-Mihai Burtescu-36/+32
2017-05-13Support #[allow] etc logic on a per macro levelest31-8/+5
This commit extends the current unused macro linter to support directives like #[allow(unused_macros)] or #[deny(unused_macros)] directly next to the macro definition, or in one of the modules the macro is inside. Before, we only supported such directives at a per crate level, due to the crate's NodeId being passed to session.add_lint. We also had to implement handling of the macro's NodeId in the lint visitor.
2017-05-13Add lint for unused macrosest31-2/+34
2017-05-13Auto merge of #41965 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-107/+163
Rollup of 15 pull requests - Successful merges: #41820, #41860, #41876, #41896, #41912, #41916, #41918, #41921, #41923, #41934, #41935, #41940, #41942, #41943, #41951 - Failed merges:
2017-05-12Don't use a DUMMY_SP for reporting issues with crate importsOliver Schneider-1/+1
2017-05-12Weave the span of an import through the resolve codeOliver Schneider-64/+101
2017-05-11rustc: Remove #![unstable] annotationAlex Crichton-3/+4
These are now no longer necessary with `-Z force-unstable-if-unmarked`
2017-05-10Fix tidy issuesOliver Schneider-5/+15
2017-05-10Example usage of multiple suggestionsOliver Schneider-41/+50
2017-05-08Remove need for &format!(...) or &&"" dances in `span_label` callsOliver Schneider-39/+39
2017-04-28refac Move levenchstein before context dependent checkFreyskeyd-7/+11
Signed-off-by: Freyskeyd <simon.paitrault@gmail.com>
2017-04-15feature gate :vis matcherAlex Burka-2/+6
2017-04-12First attempt at global_asm! macroA.J. Gardner-1/+3
2017-04-08Auto merge of #40775 - estebank:variant-as-type, r=petrochenkovbors-0/+32
Suggest using enum when a variant is used as a type Given a file: ```rust enum Fruit { Apple(i64), Orange(i64), } fn should_return_fruit() -> Apple { Apple(5) } ``` Provide the following output: ```rust error[E0412]: cannot find type `Apple` in this scope --> file.rs:16:29 | 16 | fn should_return_fruit() -> Apple { | ^^^^^ not found in this scope | help: there is an enum variant `Fruit::Apple`, did you mean to use `Fruit`? --> file.rs:12:5 | 12 | Apple(i64), | ^^^^^^^^^^ error[E0425]: cannot find function `Apple` in this scope --> file.rs:17:5 | 17 | Apple(5) | ^^^^^ not found in this scope | = help: possible candidate is found in another module, you can import it into scope: `use Fruit::Apple;` ``` Fix #35675.
2017-04-07ICH: Centrally compute and cache DefPath hashes as part of DefPathTable.Michael Woerister-1/+3
2017-04-03Fix bug parsing `#[derive]` macro invocations.Jeffrey Seyfried-2/+4
2017-04-03Sort enum suggestionsEsteban Küber-6/+8
2017-04-02Suggest using enum when a variant is used as a typeEsteban Küber-0/+30
Given a file: ```rust enum Fruit { Apple(i64), Orange(i64), } fn should_return_fruit() -> Apple { Apple(5) } ``` Provide the following output: ```rust error[E0412]: cannot find type `Apple` in this scope --> file.rs:16:29 | 16 | fn should_return_fruit() -> Apple { | ^^^^^ not found in this scope | help: there is an enum variant `Fruit::Apple`, did you mean to use `Fruit`? --> file.rs:12:5 | 12 | Apple(i64), | ^^^^^^^^^^ error[E0425]: cannot find function `Apple` in this scope --> file.rs:17:5 | 17 | Apple(5) | ^^^^^ not found in this scope | = help: possible candidate is found in another module, you can import it into scope: `use Fruit::Apple;` ```
2017-03-29Move `syntax::ext::hygiene` to `syntax_pos::hygiene`.Jeffrey Seyfried-1/+1
2017-03-27Rollup merge of #40853 - ollie27:error-index, r=steveklabnikAlex Crichton-1/+5
Fix broken Markdown and bad links in the error index This makes sure RFC links point to the RFC text not the pull request. r? @steveklabnik
2017-03-27Fix broken Markdown and bad links in the error indexOliver Middleton-1/+5
This makes sure RFC links point to the RFC text not the pull request.
2017-03-27Ensure that macro resolutions in trait positions get finalized.Jeffrey Seyfried-3/+6
2017-03-26Auto merge of #40501 - jseyfried:shadow_builtin_macros, r=nrcbors-71/+103
Allow `use` macro imports to shadow global macros Terminology: - global scope: builtin macros, macros from the prelude, `#[macro_use]`, or `#![plugin(..)]`. - legacy scope: crate-local `macro_rules!`. - modern scope: `use` macro imports, `macro` (once implemented). Today, the legacy scope can shadow the global scope (modulo RFC 1560 expanded shadowing restrictions). However, the modern scope cannot shadow or be shadowed by either the global or legacy scopes, leading to ambiguity errors. This PR allows the modern scope to shadow the global scope (subject to some restrictions). More specifically, a name in the global scope is as shadowable as a glob import in the module `self`. In other words, we imagine a special, implicit glob import in each module item: ```rust mod foo { #[lexical_only] // Not accessible via `foo::<name>`, like pre-RFC 1560 `use` imports. #[shadowable_by_legacy_scope] // for back-compat use <global_macros>::*; } ``` r? @nrc
2017-03-24Rename `builtin` => `global`.Jeffrey Seyfried-20/+20
2017-03-24Allow declarative macros 2.0 and `use` macro imports to shadow builtin macros.Jeffrey Seyfried-59/+91
2017-03-23Remove internal liblogAlex Crichton-1/+1
This commit deletes the internal liblog in favor of the implementation that lives on crates.io. Similarly it's also setting a convention for adding crates to the compiler. The main restriction right now is that we want compiler implementation details to be unreachable from normal Rust code (e.g. requires a feature), and by default everything in the sysroot is reachable via `extern crate`. The proposal here is to require that crates pulled in have these lines in their `src/lib.rs`: #![cfg_attr(rustbuild, feature(staged_api, rustc_private))] #![cfg_attr(rustbuild, unstable(feature = "rustc_private", issue = "27812"))] This'll mean that by default they're not using these attributes but when compiled as part of the compiler they do a few things: * Mark themselves as entirely unstable via the `staged_api` feature and the `#![unstable]` attribute. * Allow usage of other unstable crates via `feature(rustc_private)` which is required if the crate relies on any other crates to compile (other than std).
2017-03-22Rollup merge of #40509 - jseyfried:duplicate_check_macro_exports, r=nrcCorey Farwell-7/+18
Forbid conflicts between macros 1.0 exports and macros 2.0 exports This PR forbids for conflicts between `#[macro_export]`/`#[macro_reexport]` macro exports and `pub use` macro exports. For example, ```rust // crate A: pub use macros::foo; //^ This is allowed today, will be forbidden by this PR. // crate B: extern crate A; // This triggers a confusing error today. use A::foo; // This could refer to refer to either macro export in crate A. ``` r? @nrc
2017-03-21Fix bug in legacy `#[derive]` processing logic.Jeffrey Seyfried-4/+4
2017-03-21Check for conflicts between macros 1.0 exports (`#[macro_export]`, ↵Jeffrey Seyfried-7/+18
`#[macro_reexport]`) and macros 2.0 exports (`pub use` macro re-exports and `pub macro` (once implemented) at the crate root.
2017-03-19Rollup merge of #40583 - jseyfried:fix_include_macro_regression, r=nrcCorey Farwell-1/+4
macros: fix regression with `include!()` Fixes #40469, a regression when `include!()`ing a `macro_rules!` containing `$crate`. r? @nrc
2017-03-19Auto merge of #40346 - jseyfried:path_and_tokenstream_attr, r=nrcbors-37/+61
`TokenStream`-based attributes, paths in attribute and derive macro invocations This PR - refactors `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`. - supports macro invocation paths for attribute procedural macros. - e.g. `#[::foo::attr_macro] struct S;`, `#[cfg_attr(all(), foo::attr_macro)] struct S;` - supports macro invocation paths for derive procedural macros. - e.g. `#[derive(foo::Bar, super::Baz)] struct S;` - supports arbitrary tokens as arguments to attribute procedural macros. - e.g. `#[foo::attr_macro arbitrary + tokens] struct S;` - supports using arbitrary tokens in "inert attributes" with derive procedural macros. - e.g. `#[derive(Foo)] struct S(#[inert arbitrary + tokens] i32);` where `#[proc_macro_derive(Foo, attributes(inert))]` r? @nrc
2017-03-17Fix regression when `include!()`ing a `macro_rules!` containing a `$crate::` ↵Jeffrey Seyfried-1/+4
path.
2017-03-14Liberalize attributes.Jeffrey Seyfried-16/+40