rust/src/libsyntax
Mazdak Farrokhzad 0d0f753955
Rollup merge of #64698 - Centril:infer-const-with-stash, r=estebank
Recover on `const X = 42;` and infer type + Error Stash API

Here we:

1. Introduce a notion of the "error stash".

   This is a map in the `Handler` to which you can `err.stash(...)` away your diagnostics and then steal them in a later "phase" of the compiler (e.g. stash in parser, steal in typeck) to enrich them with more information that isn't available in the previous "phase".

    I believe I've covered all the bases to make sure these diagnostics are actually emitted eventually even under `#[cfg(FALSE)]` but please check my logic.

2. Recover when parsing `[const | static mut?] $ident = $expr;` which has a missing type.

    Use the "error stash" to stash away the error and later steal the error in typeck where we emit the error as `MachineApplicable` with the actual inferred type. This builds on https://github.com/rust-lang/rust/pull/62804.

cc https://github.com/rust-lang/rfcs/pull/2545

r? @estebank
2019-09-24 23:45:24 +02:00
..
ast libsyntax: Unconfigure tests during normal build 2019-08-02 01:59:01 +03:00
attr Stabilize str::len, [T]::len, is_empty and str::as_bytes as const fn 2019-09-24 12:56:44 +02:00
diagnostics Replace diagnostic plugins with macro_rules 2019-09-05 12:35:15 -04:00
ext Rollup merge of #64698 - Centril:infer-const-with-stash, r=estebank 2019-09-24 23:45:24 +02:00
feature_gate Rollup merge of #64010 - c410-f3r:stabilize-attrs-fn, r=Centril 2019-09-21 16:01:23 +02:00
mut_visit Aggregation of cosmetic changes made during work on REPL PRs: libsyntax 2019-09-07 16:29:04 +01:00
parse Add parser recovery for const $ident = $expr;. 2019-09-23 17:50:07 +02:00
print Print syntax contexts and marks when printing hygiene information 2019-09-17 21:23:33 +01:00
source_map Apply suggestions from code review 2019-09-07 16:29:04 +01:00
tokenstream syntax_pos: NO_EXPANSION/SyntaxContext::empty() -> SyntaxContext::root() 2019-08-15 20:38:12 +03:00
util reduce visibility 2019-09-06 22:04:36 +03:00
ast.rs Print visibility of macro items 2019-09-15 10:22:13 +01: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 Merge Variant and Variant_ 2019-08-14 14:47:01 -03: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 Replace diagnostic plugins with macro_rules 2019-09-05 12:35:15 -04:00
json.rs Replace DiagnosticBuilder with Diagnostic when emitting error 2019-09-17 09:29:46 -04:00
lib.rs Rollup merge of #64689 - matklad:refactor-mbe, r=petrochenkov 2019-09-24 23:45:24 +02:00
mut_visit.rs Resolve attributes in several places 2019-09-09 09:27:15 -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 Fix backticks in documentation 2019-09-18 23:17:36 -06:00
tests.rs Replace DiagnosticBuilder with Diagnostic when emitting error 2019-09-17 09:29:46 -04:00
tokenstream.rs push TokenTree::parse down 2019-09-22 20:38:02 +03:00
visit.rs Apply suggestions from code review 2019-09-07 16:29:04 +01: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: