about summary refs log tree commit diff
path: root/src/libsyntax/ast.rs
AgeCommit message (Collapse)AuthorLines
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
2016-11-20Refactor `MetaItemKind` to use `Name`s instead of `InternedString`s.Jeffrey Seyfried-3/+9
2016-11-20Refactor away `ast::Attribute_`.Jeffrey Seyfried-3/+3
2016-11-10syntax: don't fake a block around closures' bodies during parsing.Eduard Burtescu-2/+2
2016-11-09Rollup merge of #37428 - estebank:generic-type-error-span, r=sanxiynEduard-Mihai Burtescu-0/+8
Point to type argument span when used as trait Given the following code: ``` rust struct Foo<T: Clone>(T); use std::ops::Add; impl<T: Clone, Add> Add for Foo<T> { type Output = usize; fn add(self, rhs: Self) -> Self::Output { unimplemented!(); } } ``` present the following output: ``` nocode error[E0404]: `Add` is not a trait --> file3.rs:5:21 | 5 | impl<T: Clone, Add> Add for Okok<T> { | --- ^^^ expected trait, found type parameter | | | type parameter defined here ``` Fixes #35987.
2016-11-08Point to type argument span when used as traitEsteban Küber-0/+8
Given the following code: ```rust struct Foo<T: Clone>(T); use std::ops::Add; impl<T: Clone, Add> Add for Foo<T> { type Output = usize; fn add(self, rhs: Self) -> Self::Output { unimplemented!(); } } ``` present the following output: ```nocode error[E0404]: `Add` is not a trait --> file3.rs:5:21 | 5 | impl<T: Clone, Add> Add for Okok<T> { | --- ^^^ expected trait, found type parameter | | | type parameter defined here ```
2016-11-03Make `ast::ExprKind` smaller.Jeffrey Seyfried-1/+1
2016-10-31Changed most vec! invocations to use square bracesiirelu-2/+2
Most of the Rust community agrees that the vec! macro is clearer when called using square brackets [] instead of regular brackets (). Most of these ocurrences are from before macros allowed using different types of brackets. There is one left unchanged in a pretty-print test, as the pretty printer still wants it to have regular brackets.
2016-10-29Move `CrateConfig` from `Crate` to `ParseSess`.Jeffrey Seyfried-1/+0
2016-10-27Implement field shorthands in struct literal expressions.Eduard Burtescu-0/+1
2016-10-24Refactor away fields `MacroDef::{use_locally, export}`.Jeffrey Seyfried-2/+0
2016-10-10Avoid allocations in `Decoder::read_str`.Nicholas Nethercote-1/+1
`opaque::Decoder::read_str` is very hot within `rustc` due to its use in the reading of crate metadata, and it currently returns a `String`. This commit changes it to instead return a `Cow<str>`, which avoids a heap allocation. This change reduces the number of calls to `malloc` by almost 10% in some benchmarks. This is a [breaking-change] to libserialize.
2016-10-01Rollup merge of #34764 - pnkfelix:attrs-on-generic-formals, r=eddybManish Goregaokar-0/+2
First step for #34761
2016-09-28libsyntax: clearer names for some AST partsJonas Schievink-6/+6
This applies the HIR changes from the previous commits to the AST, and is thus a syntax-[breaking-change] Renames `PatKind::Vec` to `PatKind::Slice`, since these are called slice patterns, not vec patterns. Renames `TyKind::Vec`, which represents the type `[T]`, to `TyKind::Slice`. Renames `TyKind::FixedLengthVec` to `TyKind::Array`.
2016-09-23Add attribute support to generic lifetime and type parameters.Felix S. Klock II-0/+2
I am using `ThinAttributes` rather than a vector for attributes attached to generics, since I expect almost all lifetime and types parameters to not carry any attributes.
2016-09-20serialize: allow specifying the default behavior for specializations.Eduard Burtescu-2/+12
2016-09-20rustc_metadata: go only through rustc_serialize in astencode.Eduard Burtescu-5/+33
2016-09-11Documentation of what does for each typeathulappadan-0/+1
2016-09-04Replace `_, _` with `..`Vadim Petrochenkov-1/+1
2016-09-04Replace `_, _, _` with `..`Vadim Petrochenkov-1/+1
2016-09-03Add unions to ASTVadim Petrochenkov-1/+1
2016-08-29Future proof the AST for `union`.Jeffrey Seyfried-0/+5
2016-08-28Rollup merge of #35850 - SergioBenitez:master, r=nrcJeffrey Seyfried-8/+50
Implement RFC#1559: allow all literals in attributes Implemented rust-lang/rfcs#1559, tracked by #34981.
2016-08-28Rollup merge of #35480 - KiChjang:e0379-bonus, r=nikomatsakisJeffrey Seyfried-2/+2
Move E0379 check from typeck to ast validation Part of #35233. Extension of #35338, #35364. Fixes #35404.
2016-08-28Rollup merge of #35618 - jseyfried:ast_view_path_refactor, r=eddybJeffrey Seyfried-34/+6
Refactor `PathListItem`s This refactors away variant `Mod` of `ast::PathListItemKind` and refactors the remaining variant `Ident` to a struct `ast::PathListItem_`.
2016-08-27Change Constness to Spanned<Constness>Keith Yeung-2/+2
2016-08-25Implement RFC#1559: allow all literals in attributes.Sergio Benitez-8/+50
2016-08-21Refactor away variant `ast::PathListItemKind::Mod`Jeffrey Seyfried-34/+6
and refactor `ast::PathListItemKind::Ident` -> `ast::PathListItem_`.
2016-08-18Add Span field for Generics structsGuillaume Gomez-2/+4
2016-08-13Rename empty/bang to neverAndrew Cann-2/+2
Split Ty::is_empty method into is_never and is_uninhabited
2016-08-13Remove obsolete divergence related stuffAndrew Cann-4/+0
Replace FnOutput with Ty Replace FnConverging(ty) with ty Purge FnDiverging, FunctionRetTy::NoReturn and FunctionRetTy::None
2016-08-13Start implementation of RFC 1216 (make ! a type)Andrew Cann-0/+3
Add `TyKind::Empty` and fix resulting build errors.
2016-08-12syntax: add anonymized type syntax, i.e. impl TraitA+TraitB.Eduard Burtescu-0/+2