rust/src/libsyntax
bors 40e4b6ee3d Auto merge of #52841 - petrochenkov:premacro, r=alexcrichton
resolve: Implement prelude search for macro paths, implement tool attributes

When identifier is macro path is resolved in scopes (i.e. the first path segment - `foo` in `foo::mac!()` or `foo!()`), scopes are searched in the same order as for non-macro paths - items in modules, extern prelude, tool prelude (see later), standard library prelude, language prelude, but with some extra shadowing restrictions (names from globs and macro expansions cannot shadow names from outer scopes). See the comment in `fn resolve_lexical_macro_path_segment` for more details.

"Tool prelude" currently contains two "tool modules" `rustfmt` and `clippy`, and is searched immediately after extern prelude.
This makes the [possible long-term solution](https://github.com/rust-lang/rfcs/blob/master/text/2103-tool-attributes.md#long-term-solution) for tool attributes exactly equivalent to the existing extern prelude scheme, except that `--extern=my_crate` making crate names available in scope is replaced with something like `--tool=my_tool` making tool names available in scope.

The `tool_attributes` feature is still unstable and `#![feature(tool_attributes)]` now implicitly enables `#![feature(use_extern_macros)]`. `use_extern_macros` is a prerequisite for `tool_attributes`, so their stabilization will happen in the same order.
If `use_extern_macros` is not enabled, then tool attributes are treated as custom attributes (this is temporary, anyway).

Fixes https://github.com/rust-lang/rust/issues/52576
Fixes https://github.com/rust-lang/rust/issues/52512
Fixes https://github.com/rust-lang/rust/issues/51277
cc https://github.com/rust-lang/rust/issues/52269
2018-08-02 21:39:14 +00:00
..
attr Auto merge of #52841 - petrochenkov:premacro, r=alexcrichton 2018-08-02 21:39:14 +00:00
diagnostics Deny bare trait objects in in src/libsyntax 2018-07-10 21:06:26 +02:00
ext Auto merge of #52841 - petrochenkov:premacro, r=alexcrichton 2018-08-02 21:39:14 +00:00
parse async can begin expressions 2018-08-01 09:50:15 -07:00
print Auto merge of #52767 - ljedrz:avoid_format, r=petrochenkov 2018-07-29 09:33:37 +00:00
util Remove some tests using AST comparisons, fix other tests 2018-07-14 14:57:14 +03:00
ast.rs Switch syntax attribute tracking to BitVector 2018-08-01 06:48:42 -06:00
build.rs rustc: Add some build scripts for librustc crates 2017-07-22 22:04:13 -07:00
Cargo.toml rustc_target: move in syntax::abi and flip dependency. 2018-04-26 17:49:16 +03:00
codemap.rs Rollup merge of #52224 - ljedrz:dyn_libsyntax, r=oli-obk 2018-07-11 12:38:39 -06:00
config.rs Deny #[cfg] and #[cfg_attr] on generic parameters. 2018-06-02 05:11:33 +08:00
diagnostic_list.rs Update error code numbers 2018-06-19 17:33:14 -07:00
early_buffered_lints.rs make it a migration lint 2018-07-23 21:55:51 -05:00
entry.rs Cleanup InternedString. 2016-11-21 09:00:56 +00:00
feature_gate.rs Auto merge of #52841 - petrochenkov:premacro, r=alexcrichton 2018-08-02 21:39:14 +00:00
fold.rs Implement existential types 2018-07-18 10:53:08 +02:00
json.rs Deny bare trait objects in in src/libsyntax 2018-07-10 21:06:26 +02:00
lib.rs Split out growth functionality into BitVector type 2018-08-01 06:50:40 -06:00
ptr.rs Remove most of PartialEq impls from AST and HIR structures 2018-07-14 14:56:57 +03:00
README.md Replace many of the last references to readmes 2018-03-16 12:43:22 -05:00
show_span.rs use field init shorthand EVERYWHERE 2017-08-15 15:29:17 -07:00
std_inject.rs Implement #[macro_export(local_inner_macros)] 2018-06-27 13:10:16 +03:00
str.rs Inline char_at() and record_width. 2018-05-13 17:16:02 +10:00
test.rs Address comments 2018-07-14 14:57:15 +03:00
test_snippet.rs Remove the now redundant CodeMap::new_filemap_with_lines() method. 2018-06-27 14:00:34 +02:00
tokenstream.rs rustc: Implement tokenization of nested items 2018-07-22 08:57:31 -07:00
visit.rs Implement existential types 2018-07-18 10:53:08 +02:00

The syntax crate contains those things concerned purely with syntax that is, the AST ("abstract syntax tree"), parser, pretty-printer, lexer, macro expander, and utilities for traversing ASTs.

For more information about how these things work in rustc, see the rustc guide: