summary refs log tree commit diff
path: root/src/librustc_resolve
AgeCommit message (Collapse)AuthorLines
2018-06-03[beta] Fix naming conventions for new lintsVadim Petrochenkov-1/+1
2018-05-04Make extern_absolute_paths only work on the new editionManish Goregaokar-4/+4
2018-05-03Auto merge of #50030 - flip1995:rfc2103, r=petrochenkovbors-3/+3
Implement tool_attributes feature (RFC 2103) cc #44690 This is currently just a rebased and compiling (hopefully) version of #47773. Let's see if travis likes this. I will add the implementation for `tool_lints` this week.
2018-05-02Auto merge of #50355 - petrochenkov:50187, r=oli-obkbors-36/+73
Fix an unresolved import issue with enabled `use_extern_macros` This is a kinda ugly special-purpose solution that will break if we suddenly add a fourth namespace, but I hope to come up with something more general if I get to import resolution refactoring this summer. Fixes https://github.com/rust-lang/rust/issues/50187 thus removing a blocker for stabilization of `use_extern_macros`
2018-05-02make it compile againflip1995-1/+1
2018-05-02Remove Option from the return type of Attribute::name()Seiichi Uchida-3/+3
2018-05-02Allow Path for name of MetaItemSeiichi Uchida-1/+1
2018-05-01Auto merge of #49982 - petrochenkov:noreex, r=alexcrichtonbors-99/+3
Remove unstable `macro_reexport` It's subsumed by `feature(use_extern_macros)` and `pub use` cc https://github.com/rust-lang/rust/issues/35896 closes https://github.com/rust-lang/rust/issues/29638 closes https://github.com/rust-lang/rust/issues/38951
2018-05-01Auto merge of #49789 - petrochenkov:prelext, r=nikomatsakisbors-7/+29
Module experiments: Add one more prelude layer for extern crate names passed with `--extern` Implements one item from https://internals.rust-lang.org/t/the-great-module-adventure-continues/6678/183 When some name is looked up in lexical scope (`name`, i.e. not module-relative scope `some_mod::name` or `::name`), it's searched roughly in the next order: - local variables - items in unnamed blocks - items in the current module - :sparkles: NEW! :sparkles: crate names passed with `--extern` ("extern prelude") - standard library prelude (`Vec`, `drop`) - language prelude (built-in types like `u8`, `str`, etc) The last two layers contain a limited set of names controlled by us and not arbitrary user-defined names like upper layers. We want to be able to add new names into these two layers without breaking user code, so "extern prelude" names have higher priority than std prelude and built-in types. This is a one-time breaking change, that's why it would be nice to run this through crater. Practical impact is expected to be minimal though due to stylistic reasons (there are not many `Uppercase` crates) and due to the way how primitive types are resolved (https://github.com/rust-lang/rust/pull/32131).
2018-05-01Remove `macro_reexport`Vadim Petrochenkov-99/+3
It's subsumed by `feature(use_extern_macros)` and `pub use`
2018-05-01Better support for import resolution in 3 namespacesVadim Petrochenkov-22/+58
2018-05-01resolve (cleanup): Get rid of `Option` in `PerNS`Vadim Petrochenkov-14/+15
2018-04-30Auto merge of #50092 - abonander:issue-49934, r=petrochenkovbors-1/+3
Warn on pointless #[derive] in more places This fixes the regression in #49934 and ensures that unused `#[derive]` invocations on statements, expressions and generic type parameters survive to trip the `unused_attributes` lint. There is a separate warning hardcoded for `#[derive]` on macro invocations since linting (even the early-lint pass) occurs after expansion. This also adds regression tests for some nodes that were already warning properly. closes #49934
2018-04-29Warn on pointless `#[derive]` in more placesAustin Bonander-1/+3
This fixes the regression in #49934 and ensures that unused `#[derive]`s on statements, expressions and generic type parameters survive to trip the `unused_attributes` lint. For `#[derive]` on macro invocations it has a hardcoded warning since linting occurs after expansion. This also adds regression testing for some nodes that were already warning properly. closes #49934
2018-04-27Don't feature gate bang macros on 'proc_macro_path_invoc'.Sergio Benitez-1/+2
2018-04-27Rename InternedString to LocalInternedString and introduce a new thread-safe ↵John Kåre Alsaker-3/+2
InternedString
2018-04-27Add one more prelude layer for extern crate names passed with `--extern`Vadim Petrochenkov-7/+29
2018-04-25Fix crate:: in local pathsManish Goregaokar-4/+5
2018-04-25Auto merge of #50100 - Manishearth:edition-path-lint, r=nikomatsakisbors-13/+49
Edition breakage lint for absolute paths starting with modules We plan to enable `extern_absolute_paths` in the 2018 edition. To allow for that, folks must transition their paths in a previous edition to the new one. This makes paths which import module contents via `use module::` or `::module::` obsolete, and we must edition-lint these. https://internals.rust-lang.org/t/the-great-module-adventure-continues/6678/205?u=manishearth is the current plan for paths. r? @nikomatsakis Fixes #48722
2018-04-20rustc: Tweak custom attribute capabilitiesAlex Crichton-0/+12
This commit starts to lay some groundwork for the stabilization of custom attribute invocations and general procedural macros. It applies a number of changes discussed on [internals] as well as a [recent issue][issue], namely: * The path used to specify a custom attribute must be of length one and cannot be a global path. This'll help future-proof us against any ambiguities and give us more time to settle the precise syntax. In the meantime though a bare identifier can be used and imported to invoke a custom attribute macro. A new feature gate, `proc_macro_path_invoc`, was added to gate multi-segment paths and absolute paths. * The set of items which can be annotated by a custom procedural attribute has been restricted. Statements, expressions, and modules are disallowed behind two new feature gates: `proc_macro_expr` and `proc_macro_mod`. * The input to procedural macro attributes has been restricted and adjusted. Today an invocation like `#[foo(bar)]` will receive `(bar)` as the input token stream, but after this PR it will only receive `bar` (the delimiters were removed). Invocations like `#[foo]` are still allowed and will be invoked in the same way as `#[foo()]`. This is a **breaking change** for all nightly users as the syntax coming in to procedural macros will be tweaked slightly. * Procedural macros (`foo!()` style) can only be expanded to item-like items by default. A separate feature gate, `proc_macro_non_items`, is required to expand to items like expressions, statements, etc. Closes #50038 [internals]: https://internals.rust-lang.org/t/help-stabilize-a-subset-of-macros-2-0/7252 [issue]: https://github.com/rust-lang/rust/issues/50038
2018-04-20mention that extern absolute paths should gate on rust 2018Manish Goregaokar-0/+2
2018-04-20Add suggestion to lintManish Goregaokar-3/+6
2018-04-20Add ABSOLUTE_PATH_STARTING_WITH_MODULE epoch lint for path breakageManish Goregaokar-3/+28
2018-04-19Pass down NodeId to resolve_pathManish Goregaokar-13/+19
2018-04-17Turn some comments into doccommentsMark Mansi-53/+54
2018-04-16Auto merge of #49847 - sinkuu:save_analysis_implicit_extern, r=petrochenkovbors-7/+10
Fix save-analysis generation with extern_in_paths/extern_absolute_paths Fixes #48742.
2018-04-11Rollup merge of #49525 - varkor:sort_by_cached_key-conversion, r=scottmcmkennytm-9/+8
Use sort_by_cached_key where appropriate A follow-up to https://github.com/rust-lang/rust/pull/48639, converting various slice sorting calls to `sort_by_cached_key` when the key functions are more expensive.
2018-04-11Extend `ExternCrate` to cover externs inferred from `use` or pathsShotaro Yamada-7/+10
2018-04-09Convert sort_unstable_by_key to sort_by_cached_keyvarkor-7/+3
2018-04-09Convert sort_by_key to sort_by_cached_keyvarkor-2/+5
2018-04-08Move deny(warnings) into rustbuildMark Simulacrum-1/+0
This permits easier iteration without having to worry about warnings being denied. Fixes #49517
2018-04-06Use `Ident` instead of `Name` in `MetaItem`Vadim Petrochenkov-2/+2
2018-04-06Remove more duplicated spansVadim Petrochenkov-11/+11
2018-04-06Rename `ast::Variant_::name` into `ident` + Fix rebaseVadim Petrochenkov-3/+3
2018-04-06Get rid of `SpannedIdent`Vadim Petrochenkov-100/+93
2018-04-06Rename `PathSegment::identifier` to `ident`Vadim Petrochenkov-18/+14
2018-04-06Use `Span` instead of `SyntaxContext` in `Ident`Vadim Petrochenkov-33/+34
2018-04-05Rollup merge of #49350 - abonander:macros-in-extern, r=petrochenkovAlex Crichton-0/+7
Expand macros in `extern {}` blocks This permits macro and proc-macro and attribute invocations (the latter only with the `proc_macro` feature of course) in `extern {}` blocks, gated behind a new `macros_in_extern` feature. A tracking issue is now open at #49476 closes #48747
2018-04-04Updated codeblocks to specify language where required.David Wood-3/+3
2018-04-03expand macro invocations in `extern {}` blocksAustin Bonander-0/+7
2018-03-26Auto merge of #49101 - mark-i-m:stabilize_i128, r=nagisabors-12/+1
Stabilize 128-bit integers :tada: cc #35118 EDIT: This should be merged only after the following have been merged: - [x] https://github.com/rust-lang-nursery/compiler-builtins/pull/236 - [x] https://github.com/rust-lang/book/pull/1230
2018-03-26remove unneeded importMark Mansi-1/+1
2018-03-26Stabilize i128_typeMark Mansi-11/+0
2018-03-26Rollup merge of #48693 - vorner:doc-name-resolution, r=petrochenkovTim Neumann-3/+58
Some comments and documentation for name resolution crate Hello I'm trying to get a grasp of how the name resolution crate works, as part of helping with https://github.com/rust-lang-nursery/rustc-guide/issues/16. Not that I'd be succeeding much, but as I was reading the code, I started to put some notes into it, to help me understand. I guess I didn't get very far yet, but I'd like to share what I have, in case it might be useful for someone else. I hope these are correct (even if incomplete), but I'll be glad for a fast check in case I put something misleading there.
2018-03-24fixup! Some comments and documentation for name resolution crateMichal 'vorner' Vaner-7/+23
2018-03-23Merge branch 'master' of https://github.com/Lymia/rust into rollupAlex Crichton-4/+4
2018-03-22Rollup merge of #49117 - nivkner:fixme_fixup3, r=estebankkennytm-22/+3
address some FIXME whose associated issues were marked as closed part of #44366
2018-03-18Initial implementation of RFC 2151, Raw IdentifiersLymia Aluysia-4/+4
2018-03-17Rename `Span::empty` to `Span::shrink_to_lo`, add `Span::shrink_to_hi`Vadim Petrochenkov-3/+3
2018-03-17AST: Keep distinction between `path` and `::path` in imports and visibilitiesVadim Petrochenkov-15/+17
Add the root segment for name resolution purposes only