about summary refs log tree commit diff
path: root/src/libsyntax/ast.rs
AgeCommit message (Collapse)AuthorLines
2017-06-29Make `$crate` a keywordVadim Petrochenkov-3/+2
2017-06-26Implement `quote!` and other `proc_macro` API.Jeffrey Seyfried-4/+4
2017-06-23Removed as many "```ignore" as possible.kennytm-4/+4
Replaced by adding extra imports, adding hidden code (`# ...`), modifying examples to be runnable (sorry Homura), specifying non-Rust code, and converting to should_panic, no_run, or compile_fail. Remaining "```ignore"s received an explanation why they are being ignored.
2017-05-25Hygienize lifetimes.Jeffrey Seyfried-1/+1
2017-05-25Declarative macros 2.0 without hygiene.Jeffrey Seyfried-0/+1
2017-05-25Refactor out `ast::MacroDef`.Jeffrey Seyfried-1/+12
2017-05-12Fix some clippy warnings in libsyntaxAndre Bogus-9/+9
This is mostly removing stray ampersands, needless returns and lifetimes.
2017-04-24support `default impl` for specializationGianni Ciccarelli-0/+1
this commit implements the first step of the `default impl` feature: all items in a `default impl` are (implicitly) `default` and hence specializable. In order to test this feature I've copied all the tests provided for the `default` method implementation (in run-pass/specialization and compile-fail/specialization directories) and moved the `default` keyword from the item to the impl. See referenced issue for further info
2017-04-12First attempt at global_asm! macroA.J. Gardner-0/+12
2017-04-02Introduce `TyErr` independent from `TyInfer`Esteban Küber-0/+2
Add a `TyErr` type to represent unknown types in places where parse errors have happened, while still able to build the AST. Initially only used to represent incorrectly written fn arguments and avoid "expected X parameters, found Y" errors when called with the appropriate amount of parameters. We cannot use `TyInfer` for this as `_` is not allowed as a valid argument type. Example output: ```rust error: expected one of `:` or `@`, found `,` --> file.rs:12:9 | 12 | fn bar(x, y: usize) {} | ^ error[E0061]: this function takes 2 parameters but 3 parameters were supplied --> file.rs:19:9 | 12 | fn bar(x, y) {} | --------------- defined here ... 19 | bar(1, 2, 3); | ^^^^^^^ expected 2 parameters ```
2017-03-29Refactor how spans are combined in the parser.Jeffrey Seyfried-5/+5
2017-03-29Merge `ExpnId` and `SyntaxContext`.Jeffrey Seyfried-53/+4
2017-03-29Move `syntax::ext::hygiene` to `syntax_pos::hygiene`.Jeffrey Seyfried-1/+9
2017-03-22Implement indexed_vec::Idx for ast::NodeIdMichael Woerister-0/+11
2017-03-21Refactor parsing of trait object typesVadim Petrochenkov-1/+11
2017-03-19Auto merge of #40346 - jseyfried:path_and_tokenstream_attr, r=nrcbors-1/+8
`TokenStream`-based attributes, paths in attribute and derive macro invocations This PR - refactors `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`. - supports macro invocation paths for attribute procedural macros. - e.g. `#[::foo::attr_macro] struct S;`, `#[cfg_attr(all(), foo::attr_macro)] struct S;` - supports macro invocation paths for derive procedural macros. - e.g. `#[derive(foo::Bar, super::Baz)] struct S;` - supports arbitrary tokens as arguments to attribute procedural macros. - e.g. `#[foo::attr_macro arbitrary + tokens] struct S;` - supports using arbitrary tokens in "inert attributes" with derive procedural macros. - e.g. `#[derive(Foo)] struct S(#[inert arbitrary + tokens] i32);` where `#[proc_macro_derive(Foo, attributes(inert))]` r? @nrc
2017-03-14Auto merge of #39921 - cramertj:add-catch-to-ast, r=nikomatsakisbors-0/+2
Add catch {} to AST Part of #39849. Builds on #39864.
2017-03-14Refactor `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`.Jeffrey Seyfried-1/+8
2017-03-12Rollup merge of #40369 - petrochenkov:segspan, r=eddybCorey Farwell-7/+7
Give spans to individual path segments in AST And use these spans in path resolution diagnostics. The spans are spans of identifiers in segments, not whole segments. I'm not sure what spans are more useful in general, but identifier spans are a better fit for resolve errors. HIR still doesn't have spans. Fixes https://github.com/rust-lang/rust/pull/38927#discussion_r95336667 https://github.com/rust-lang/rust/pull/38890#issuecomment-271731008 r? @nrc @eddyb
2017-03-11Add catch expr to AST and disallow catch as a struct nameTaylor Cramer-0/+2
2017-03-10Give spans to individual path segments in ASTVadim Petrochenkov-7/+7
2017-03-10Avoid using `Mark` and `Invocation` for macro defs.Jeffrey Seyfried-2/+2
2017-03-10Refactor out `ast::ItemKind::MacroDef`.Jeffrey Seyfried-21/+6
2017-03-03Integrate `TokenStream`.Jeffrey Seyfried-3/+15
2017-02-03Bump version, upgrade bootstrapAlex Crichton-2/+0
This commit updates the version number to 1.17.0 as we're not on that version of the nightly compiler, and at the same time this updates src/stage0.txt to bootstrap from freshly minted beta compiler and beta Cargo.
2017-01-19add exclusive range patterns under a feature gateOliver Schneider-2/+8
2017-01-17Auto merge of #39110 - petrochenkov:sum, r=eddybbors-12/+12
Merge ObjectSum and PolyTraitRef in AST/HIR + some other refactoring `ObjectSum` and `PolyTraitRef` are the same thing (list of bounds), they exist separately only due to parser quirks. The second commit merges them. The first commit replaces `Path` with `Ty` in (not yet supported) equality predicates. They are parsed as types anyway and arbitrary types can always be disguised as paths using aliases, so this doesn't add any new functionality. The third commit uses `Vec` instead of `P<[T]>` in AST. AST is not immutable like HIR and `Vec`s are more convenient for it, unnecessary conversions are also avoided. The last commit renames `parse_ty_sum` (which is used for parsing types in general) into `parse_ty`, and renames `parse_ty` (which is used restricted contexts where `+` is not permitted due to operator priorities or other reasons) into `parse_ty_no_plus`. This is the first part of https://github.com/rust-lang/rust/issues/39085#issuecomment-272743755 and https://github.com/rust-lang/rust/issues/39080 focused on data changes and mechanical renaming, I'll submit a PR with parser changes a bit later. r? @eddyb
2017-01-17Rename ObjectSum into TraitObject in AST/HIRVadim Petrochenkov-1/+1
2017-01-17Use resizable Vec instead of P<[T]> in ASTVadim Petrochenkov-5/+5
2017-01-17AST/HIR: Merge ObjectSum and PolyTraitRefVadim Petrochenkov-5/+5
2017-01-16AST/HIR: Replace Path with Type in WhereEqPredicateVadim Petrochenkov-2/+2
2017-01-16Rename ExprKind::Vec to Array in HIR and HAIR.Scott Olson-1/+1
This is a clearer name since they represent [a, b, c] array literals.
2017-01-11syntax: struct field attributes and cfgBenjamin Saunders-0/+2
2016-12-30Fix LEB128 to work with the stage1Simonas Kazlauskas-2/+2
Stage 1 can’t really handle negative 128-bit literals, but an equivalent bit-not is fine
2016-12-30Cleanup FIXMEsSimonas Kazlauskas-22/+0
2016-12-30Such large. Very 128. Much bits.Simonas Kazlauskas-8/+20
This commit introduces 128-bit integers. Stage 2 builds and produces a working compiler which understands and supports 128-bit integers throughout. The general strategy used is to have rustc_i128 module which provides aliases for iu128, equal to iu64 in stage9 and iu128 later. Since nowhere in rustc we rely on large numbers being supported, this strategy is good enough to get past the first bootstrap stages to end up with a fully working 128-bit capable compiler. In order for this strategy to work, number of locations had to be changed to use associated max_value/min_value instead of MAX/MIN constants as well as the min_value (or was it max_value?) had to be changed to use xor instead of shift so both 64-bit and 128-bit based consteval works (former not necessarily producing the right results in stage1). This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-28hir: lower `ImplicitSelf` to resolved `Self` TyQPath's.Eduard-Mihai Burtescu-8/+7
2016-12-23Auto merge of #38232 - jseyfried:refactor_global_paths, r=nrcbors-4/+23
Refactor global paths This PR removes the field `global: bool` from `ast::Path` and `hir::Path`, instead representing a global path `::foo::bar` as `{{root}}::foo::bar`, where `{{root}}` is a virtual keyword `keywords::CrateRoot`. Also, fixes #38016. r? @nrc
2016-12-22Remove outdated FIXME commentEsteban Küber-4/+0
Removed FIXME comment referencing #3300.
2016-12-22Refactor how global paths are represented (for both ast and hir).Jeffrey Seyfried-4/+23
2016-12-19Optimize `ast::PathSegment`.Jeffrey Seyfried-82/+15
2016-12-18Remove `MacroDef`'s fields `imported_from` and `allow_internal_unstable`,Jeffrey Seyfried-2/+0
remove `export` argument of `resolver.add_macro()`.
2016-12-18Add `ident.unhygienize()` and use `Ident` more instead of `Name` in `resolve`.Jeffrey Seyfried-4/+8
2016-11-21Implement the `loop_break_value` feature.Geoffry Song-2/+2
This implements RFC 1624, tracking issue #37339. - `FnCtxt` (in typeck) gets a stack of `LoopCtxt`s, which store the currently deduced type of that loop, the desired type, and a list of break expressions currently seen. `loop` loops get a fresh type variable as their initial type (this logic is stolen from that for arrays). `while` loops get `()`. - `break {expr}` looks up the broken loop, and unifies the type of `expr` with the type of the loop. - `break` with no expr unifies the loop's type with `()`. - When building MIR, `loop` loops no longer construct a `()` value at termination of the loop; rather, the `break` expression assigns the result of the loop. `while` loops are unchanged. - `break` respects contexts in which expressions may not end with braced blocks. That is, `while break { break-value } { while-body }` is illegal; this preserves backwards compatibility. - The RFC did not make it clear, but I chose to make `break ()` inside of a `while` loop illegal, just in case we wanted to do anything with that design space in the future. This is my first time dealing with this part of rustc so I'm sure there's plenty of problems to pick on here ^_^
2016-11-21Cleanup `InternedString`.Jeffrey Seyfried-1/+1
2016-11-21Use `Symbol` instead of `InternedString` in the AST, HIR, and various other ↵Jeffrey Seyfried-9/+9
places.
2016-11-20Move `syntax::util::interner` -> `syntax::symbol`, cleanup.Jeffrey Seyfried-43/+8
2016-11-20Refactor `P<ast::MetaItem>` -> `ast::MetaItem`.Jeffrey Seyfried-2/+2
2016-11-20Move `MetaItemKind`'s `Name` to a field of `MetaItem`.Jeffrey Seyfried-4/+9
2016-11-20Refactor `CrateConfig`.Jeffrey Seyfried-30/+3