summary refs log tree commit diff
path: root/src/librustc_resolve
AgeCommit message (Collapse)AuthorLines
2018-08-25resolve: Continue search in outer scopes after applying derive resolution ↵Vadim Petrochenkov-13/+15
fallback
2018-08-25resolve: Reject some inaccessible candidates sooner during import resolutionVadim Petrochenkov-0/+5
This allows import resolution to progress in cases like #53140
2018-07-30Auto merge of #52830 - matthewjasper:bootstrap-prep, r=matthewjasperbors-1/+1
[NLL] Fix some things for bootstrap Some changes that are required when bootstrapping rustc with NLL enabled. * Remove a bunch of unused `mut`s that aren't needed, but the existing lint doesn't catch. * Rewrite a function call to satisfy NLL borrowck. Note that the borrow is two-phase, but gets activated immediately by an unsizing coercion. cc #51823
2018-07-30Auto merge of #52805 - ljedrz:format_str_literal, r=petrochenkovbors-5/+6
Don't format!() string literals Prefer `to_string()` to `format!()` take 2, this time targetting string literals. In some cases (`&format!("...")` -> `"..."`) also removes allocations. Occurences of `format!("")` are changed to `String::new()`.
2018-07-29Remove unused `mut`sMatthew Jasper-1/+1
2018-07-29Replace push loops with collect() and extend() where possibleljedrz-3/+3
2018-07-29Auto merge of #52764 - sinkuu:cleanup, r=nikomatsakisbors-2/+2
Misc cleanups
2018-07-28Don't format!() string literalsljedrz-5/+6
2018-07-28Rollup merge of #52781 - ljedrz:avoid_vec_arguments, r=nikomatsakiskennytm-1/+1
Use a slice where a vector is not necessary
2018-07-27Use slices where a vector is not necessaryljedrz-1/+1
2018-07-27Remove unnecessary `.collect()`Shotaro Yamada-2/+2
2018-07-25Deny bare_trait_objects globallyTatsuyuki Ishi-2/+0
2018-07-23Auto merge of #52589 - petrochenkov:derlint, r=alexcrichtonbors-17/+33
Attach deprecation lint `proc_macro_derive_resolution_fallback` to a specific node id So it can be `allow`-ed from inside the derive. cc https://github.com/rust-lang/rust/pull/51952
2018-07-23Auto merge of #52568 - oli-obk:span_bug_error, r=varkorbors-0/+2
Fix loop label resolution around constants And make `delay_span_bug` a little more helpful r? @varkor fixes #52442 fixes #52443
2018-07-21Attach deprecation lint `proc_macro_derive_resolution_fallback` to a ↵Vadim Petrochenkov-17/+33
specific node id
2018-07-20Properly scope label resolutionOliver Schneider-0/+2
2018-07-20resolve: Add more comments to in-module resolutionVadim Petrochenkov-22/+26
2018-07-20resolve: Fully prohibit shadowing of in-scope names by globs in macro pathsVadim Petrochenkov-3/+2
2018-07-20data_structures: Add a reference wrapper for pointer-indexed maps/setsVadim Petrochenkov-8/+8
Use `ptr::eq` for comparing pointers
2018-07-20resolve: Add some comments to in-module resolutionVadim Petrochenkov-14/+31
2018-07-20resolve: Remove `SingleImports` in favor of a simple setVadim Petrochenkov-99/+26
2018-07-20resolve: Rename `global_macros` to `macro_prelude`Vadim Petrochenkov-15/+15
Rename `shadows_glob` to `shadowed_glob`
2018-07-20resolve: Remove unused parameter from `resolve_ident_in_module`Vadim Petrochenkov-11/+8
2018-07-19Auto merge of #52024 - oli-obk:existential_parse, r=nikomatsakisbors-1/+20
Implement existential types (not for associated types yet) r? @nikomatsakis cc @Centril @varkor @alexreg
2018-07-18Implement existential typesOliver Schneider-1/+20
2018-07-17rustc: Fix a suggestion for the `proc_macro` featureAlex Crichton-1/+1
This feature is stable, we shouldn't suggest it any more! Instead suggest the real feature, `use_extern_macros`.
2018-07-16rustc: Stabilize much of the `proc_macro` featureAlex Crichton-7/+3
This commit stabilizes some of the `proc_macro` language feature as well as a number of APIs in the `proc_macro` crate as [previously discussed][1]. This means that on stable Rust you can now define custom procedural macros which operate as attributes attached to items or `macro_rules!`-like bang-style invocations. This extends the suite of currently stable procedural macros, custom derives, with custom attributes and custom bang macros. Note though that despite the stabilization in this commit procedural macros are still not usable on stable Rust. To stabilize that we'll need to stabilize at least part of the `use_extern_macros` feature. Currently you can define a procedural macro attribute but you can't import it to call it! A summary of the changes made in this PR (as well as the various consequences) is: * The `proc_macro` language and library features are now stable. * Other APIs not stabilized in the `proc_macro` crate are now named under a different feature, such as `proc_macro_diagnostic` or `proc_macro_span`. * A few checks in resolution for `proc_macro` being enabled have switched over to `use_extern_macros` being enabled. This means that code using `#![feature(proc_macro)]` today will likely need to move to `#![feature(use_extern_macros)]`. It's intended that this PR, once landed, will be followed up with an attempt to stabilize a small slice of `use_extern_macros` just for procedural macros to make this feature 100% usable on stable. [1]: https://internals.rust-lang.org/t/help-stabilize-a-subset-of-macros-2-0/7252
2018-07-15Auto merge of #52383 - petrochenkov:pmns, r=alexcrichtonbors-3/+34
resolve: Functions introducing procedural macros reserve a slot in the macro namespace as well Similarly to https://github.com/rust-lang/rust/pull/52234, this gives us symmetry between internal and external views of a crate, but in this case it's always an error to call a procedural macro in the same crate in which it's defined. Closes https://github.com/rust-lang/rust/issues/52225
2018-07-14Functions introducing procedural macros reserve a slot in the macro ↵Vadim Petrochenkov-3/+34
namespace as well
2018-07-14Remove most of `PartialEq` impls from AST and HIR structuresVadim Petrochenkov-2/+2
2018-07-12rustc: Lint against `#[macro_use]` in 2018 idiomsAlex Crichton-1/+16
This commit adds a lint to the compiler to warn against the `#[macro_use]` directive as part of the `rust_2018_idioms` lint. This lint is turned off by default and is only enabled when the `use_extern_macros` feature is also enabled. The lint here isn't fully fleshed out as it's just a simple warning rather than suggestions of how to actually import the macro, but hopefully it's a good base to start from! cc #52043
2018-07-12Rollup merge of #52287 - ljedrz:dyn_librustc_resolve, r=petrochenkovkennytm-4/+6
Deny bare trait objects in src/librustc_resolve Enforce `#![deny(bare_trait_objects)]` in `src/librustc_resolve`.
2018-07-12Auto merge of #52230 - alexcrichton:attr-and-derive, r=petrochenkovbors-1/+17
rustc: Search all derives for inert attributes This commit fixes an apparent mistake in librustc_resolve where when the `proc_macro` feature is enabled (or `rust_2018_preview`) the resolution of custom attributes for custom derive was tweaked. Previously when an attribute failed to resolve it was attempted to locate if there is a custom derive also in scope which declares the attribute, but only the first custom derive directive was search. Instead this commit fixes the loop to search all custom derive invocations looking for any which register the attribute in question. Closes #52219
2018-07-12Deny bare trait objects in src/librustc_resolveljedrz-4/+6
2018-07-11Rollup merge of #51952 - petrochenkov:transmark, r=alexcrichtonMark Rousskov-38/+64
hygiene: Decouple transparencies from expansion IDs And remove fallback to parent modules during resolution of names in scope. This is a breaking change for users of unstable macros 2.0 (both procedural and declarative), code like this: ```rust #![feature(decl_macro)] macro m($S: ident) { struct $S; mod m { type A = $S; } } fn main() { m!(S); } ``` or equivalent ```rust #![feature(decl_macro)] macro m($S: ident) { mod m { type A = $S; } } fn main() { struct S; m!(S); } ``` stops working due to module boundaries being properly enforced. For proc macro derives this is still reported as a compatibility warning to give `actix_derive`, `diesel_derives` and `palette_derive` time to fix their issues. Fixes https://github.com/rust-lang/rust/issues/50504 in accordance with [this comment](https://github.com/rust-lang/rust/issues/50504#issuecomment-399764767).
2018-07-11Fix typo in E0433 docsFelix Rabe-1/+1
2018-07-10rustc: Search all derives for inert attributesAlex Crichton-1/+17
This commit fixes an apparent mistake in librustc_resolve where when the `proc_macro` feature is enabled (or `rust_2018_preview`) the resolution of custom attributes for custom derive was tweaked. Previously when an attribute failed to resolve it was attempted to locate if there is a custom derive also in scope which declares the attribute, but only the first custom derive directive was search. Instead this commit fixes the loop to search all custom derive invocations looking for any which register the attribute in question. Closes #52219
2018-07-09in which `use` suggestions meet edition 2018Zack M. Davis-1/+12
The intent here is to resolve #52202.
2018-07-08Remove fallback to parent modules from lexical resolutionVadim Petrochenkov-26/+57
2018-07-08hygiene: Decouple transparencies from expansion IDsVadim Petrochenkov-12/+7
2018-07-01absoluate -> absoluteTakanori Ishibashi-1/+1
2018-06-30Auto merge of #51762 - petrochenkov:oh-hi-mark, r=oli-obkbors-31/+59
hygiene: Implement transparent marks and use them for call-site hygiene in proc-macros Fixes https://github.com/rust-lang/rust/issues/50050
2018-06-30Auto merge of #51806 - oli-obk:lowering_cleanups1, r=cramertjbors-4/+5
Lowering cleanups [1/N]
2018-06-30Address commentsVadim Petrochenkov-2/+1
2018-06-30Restore the old behavior of `$crate` in nested `macro_rules`Vadim Petrochenkov-1/+25
`$crate` is not resolved at def-site of a macro, but rather at "transitive def-site"
2018-06-30Fortify dummy span checkingVadim Petrochenkov-6/+6
2018-06-30hygiene: Implement transparent marksVadim Petrochenkov-4/+13
2018-06-30expansion: Give names to some fields of `SyntaxExtension`Vadim Petrochenkov-8/+7
2018-06-30resolve: Cleanup `resolve_crate_root`Vadim Petrochenkov-13/+10
2018-06-28Fix rebaseVadim Petrochenkov-5/+5