rust/src/libsyntax
bors 09e3989758 Auto merge of #62086 - petrochenkov:builtout, r=eddyb
Define built-in macros through libcore

This PR defines built-in macros through libcore using a scheme similar to lang items (attribute `#[rustc_builtin_macro]`).
All the macro properties (stability, visibility, etc.) are taken from the source code in libcore, with exception of the expander function transforming input tokens/AST into output tokens/AST, which is still provided by the compiler.

The macros are made available to user code through the standard library prelude (`{core,std}::prelude::v1`), so they are still always in scope.
As a result **built-in macros now have stable absolute addresses in the library**, like `core::prelude::v1::line!()`, this is an insta-stable change.

Right now `prelude::v1` is the only publicly available absolute address for these macros, but eventually they can be moved into more appropriate locations with library team approval (e.g. `Clone` derive -> `core::clone::Clone`).

Now when built-in macros have canonical definitions they can be imported or reexported without issues (https://github.com/rust-lang/rust/issues/61687).

Other changes:
- You can now define a derive macro with a name matching one of the built-in derives (https://github.com/rust-lang/rust/issues/52269). This was an artificial restriction that could be worked around with import renaming anyway.

Known regressions:
- Empty library crate with a crate-level `#![test]` attribute no longer compiles without `--test`. Previously it didn't compile *with* `--test` or with the bin crate type.

Fixes https://github.com/rust-lang/rust/issues/61687
Fixes https://github.com/rust-lang/rust/issues/61804
r? @eddyb
2019-07-26 23:29:02 +00:00
..
attr Rollup merge of #62735 - petrochenkov:galloc, r=alexcrichton 2019-07-25 23:21:00 +02:00
diagnostics Make register_[long_]diagnostics hygienic 2019-07-13 10:25:57 +01:00
ext Auto merge of #62086 - petrochenkov:builtout, r=eddyb 2019-07-26 23:29:02 +00:00
parse Rollup merge of #62963 - estebank:homoglyph-recovery, r=petrochenkov 2019-07-26 18:56:53 +02:00
print pprust: Support macro macros 2019-07-15 12:42:07 +03:00
util Make path::resolve a method on ExtCtxt 2019-07-23 17:17:31 +02:00
ast.rs cleanup: Remove extern crate serialize as rustc_serializes 2019-07-23 19:20:16 +03:00
build.rs Remove licenses 2018-12-25 21:08:33 -07:00
Cargo.toml cleanup: Remove extern crate serialize as rustc_serializes 2019-07-23 19:20:16 +03:00
config.rs Lint on 'cfg_attr(,).' 2019-06-22 12:11:01 +02:00
early_buffered_lints.rs Implement checks for meta-variables in macros 2019-07-19 19:59:12 +02:00
entry.rs Remove the equality operation between Symbol and strings. 2019-05-13 09:31:30 +10:00
error_codes.rs Normalize use of backticks in compiler messages for libsyntax/* 2019-07-23 20:03:20 +02:00
feature_gate.rs syntax_ext: Reuse built-in attribute template checking for macro attributes 2019-07-24 12:29:45 +03:00
json.rs syntax: Make def-site span mandatory in ExpnInfo/MacroBacktrace/DiagnosticSpanMacroExpansion 2019-07-11 00:12:07 +03:00
lib.rs Rollup merge of #62735 - petrochenkov:galloc, r=alexcrichton 2019-07-25 23:21:00 +02:00
mut_visit.rs pprust: Fix formatting regressions from the previous commits 2019-07-15 12:42:07 +03:00
ptr.rs cleanup: Remove extern crate serialize as rustc_serializes 2019-07-23 19:20:16 +03:00
README.md rustc-guide has moved 2018-11-26 15:03:13 -06:00
show_span.rs Rename rustc_errors dependency in rust 2018 crates 2019-02-13 00:28:52 +09:00
source_map.rs Rename some things in syntax_pos/hygiene 2019-07-11 00:12:07 +03:00
std_inject.rs libsyntax: Remove Mark into ExpnId 2019-07-19 12:01:48 +03:00
test.rs Normalize use of backticks in compiler messages for libsyntax/* 2019-07-23 20:03:20 +02:00
test_snippet.rs Move edition outside the hygiene lock and avoid accessing it 2019-05-21 18:17:05 +02:00
tokenstream.rs cleanup: Remove extern crate serialize as rustc_serializes 2019-07-23 19:20:16 +03:00
visit.rs Auto merge of #62075 - Centril:guardless-match-arms, r=petrochenkov 2019-06-24 05:00:10 +00: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: