about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2016-08-13Minor fixups based on feedbackAndrew Cann-1/+1
2016-08-13Minor fixup.Andrew Cann-2/+1
2016-08-13Rename empty/bang to neverAndrew Cann-10/+10
Split Ty::is_empty method into is_never and is_uninhabited
2016-08-13Control usage of `!` through a feature gate.Andrew Cann-3/+24
Adds the `bang_type` feature gate. `!` in a non-return-type position now relies on that feature.
2016-08-13Remove obsolete divergence related stuffAndrew Cann-11/+0
Replace FnOutput with Ty Replace FnConverging(ty) with ty Purge FnDiverging, FunctionRetTy::NoReturn and FunctionRetTy::None
2016-08-13Switch on TyEmptyAndrew Cann-5/+1
Parse -> ! as FnConverging(!) Add AdjustEmptyToAny coercion to all ! expressions Some fixes
2016-08-13Parse `!` as TyEmpty (except in fn return type)Andrew Cann-0/+2
2016-08-13Start implementation of RFC 1216 (make ! a type)Andrew Cann-0/+8
Add `TyKind::Empty` and fix resulting build errors.
2016-08-13Parse numeric fields in struct expressions and patternsVadim Petrochenkov-2/+11
2016-08-13Remove restrictions from tuple structs/variantsVadim Petrochenkov-4/+20
Hard errors are turned into feature gates
2016-08-12Auto merge of #35091 - eddyb:impl-trait, r=nikomatsakisbors-2/+39
Implement `impl Trait` in return type position by anonymization. This is the first step towards implementing `impl Trait` (cc #34511). `impl Trait` types are only allowed in function and inherent method return types, and capture all named lifetime and type parameters, being invariant over them. No lifetimes that are not explicitly named lifetime parameters are allowed to escape from the function body. The exposed traits are only those listed explicitly, i.e. `Foo` and `Clone` in `impl Foo + Clone`, with the exception of "auto traits" (like `Send` or `Sync`) which "leak" the actual contents. The implementation strategy is anonymization, i.e.: ```rust fn foo<T>(xs: Vec<T>) -> impl Iterator<Item=impl FnOnce() -> T> { xs.into_iter().map(|x| || x) } // is represented as: type A</*invariant over*/ T> where A<T>: Iterator<Item=B<T>>; type B</*invariant over*/ T> where B<T>: FnOnce() -> T; fn foo<T>(xs: Vec<T>) -> A<T> { xs.into_iter().map(|x| || x): $0 where $0: Iterator<Item=$1>, $1: FnOnce() -> T } ``` `$0` and `$1` are resolved (to `iter::Map<vec::Iter<T>, closure>` and the closure, respectively) and assigned to `A` and `B`, after checking the body of `foo`. `A` and `B` are *never* resolved for user-facing type equality (typeck), but always for the low-level representation and specialization (trans). The "auto traits" exception is implemented by collecting bounds like `impl Trait: Send` that have failed for the obscure `impl Trait` type (i.e. `A` or `B` above), pretending they succeeded within the function and trying them again after type-checking the whole crate, by replacing `impl Trait` with the real type. While passing around values which have explicit lifetime parameters (of the function with `-> impl Trait`) in their type *should* work, regionck appears to assign inference variables in *way* too many cases, and never properly resolving them to either explicit lifetime parameters, or `'static`. We might not be able to handle lifetime parameters in `impl Trait` without changes to lifetime inference, but type parameters can have arbitrary lifetimes in them from the caller, so most type-generic usecases (or not generic at all) should not run into this problem. cc @rust-lang/lang
2016-08-11Auto merge of #34811 - DanielJCampbell:Expander, r=jseyfriedbors-42/+80
Extended expand.rs to support alternate expansion behaviours (eg. stepwise expansion) r? nrc
2016-08-12syntax: add anonymized type syntax, i.e. impl TraitA+TraitB.Eduard Burtescu-2/+39
2016-08-10Extended expand.rs to support alternate expansion behavioursDaniel Campbell-42/+80
Added single_step & keep_macs flags and functionality to expander
2016-08-07Fix old call in lexer testsJonathan Turner-3/+1
2016-08-07Turn on new errors, json mode. Remove duplicate unicode testJonathan Turner-1/+0
2016-08-01Auto merge of #35018 - cgswords:rope_tstream, r=nrcbors-610/+374
Reimplement TokenStreams using ropes Title says it all; a reimplementation of TokenStreams as ropes. r? @nrc
2016-08-01Reimplemented tokenstreams as ropes and reduced the exposed TokenStream API.cgswords-610/+374
2016-07-30Auto merge of #34904 - petrochenkov:rustcall, r=nikomatsakisbors-32/+41
Properly feature gate all unstable ABIs Fixes https://github.com/rust-lang/rust/issues/34900 [breaking-change] r? @pnkfelix --- Function-visiting machinery for AST/HIR is surprisingly error-prone, it's *very* easy to miss some cases or visit something twice while writing a visitor. This is the true problem behind https://github.com/rust-lang/rust/issues/34900. I'll try to restructure these visitors a bit and send one more PR later.
2016-07-29Auto merge of #34842 - cgswords:attr_enc, r=nrcbors-42/+94
Better attribute and metaitem encapsulation throughout the compiler This PR refactors most (hopefully all?) of the `MetaItem` interactions outside of `libsyntax` (and a few inside) to interact with MetaItems through the provided traits instead of directly creating / destruct / matching against them. This is a necessary first step to eventually converting `MetaItem`s to internally use `TokenStream` representations (which will make `MetaItem` interactions much nicer for macro writers once the new macro system is in place). r? @nrc
2016-07-28Auto merge of #34956 - nikomatsakis:incr-comp-o-files, r=mwbors-0/+10
Enable reuse of `.o` files if nothing has changed This PR completes a first "spike" for incremental compilation by enabling us to reuse `.o` files when nothing has changed. When in incr. mode, we will save `.o` files into the temporary directory, then copy them back out again if they are still valid. The code is still a bit rough but it does seem to work. =) r? @michaelwoerister Fixes #34036 Fixes #34037 Fixes #34038
2016-07-28Add a testing mechanism and a simple spike testNiko Matsakis-0/+10
2016-07-28Rollup merge of #34969 - jseyfried:fix_cfg_feature, r=nrcManish Goregaokar-1/+1
Avoid processing `feature`s on unconfigured crates Fixes #34932, a regression caused by #34272. r? @nrc
2016-07-25Adressed PR comments.cgswords-11/+10
2016-07-25General MetaItem encapsulation rewrites.cgswords-42/+95
2016-07-23macros: Improve `tt` fragmentsJeffrey Seyfried-3/+17
2016-07-23Auto merge of #34925 - jseyfried:nested_macros, r=eddybbors-1/+5
Support nested `macro_rules!` Fixes #6994. r? @eddyb
2016-07-21Avoid processing `feature`s on unconfigured crates.Jeffrey Seyfried-1/+1
2016-07-19Introduced `NoDelim` and modified the compiler to support it.cgswords-3/+10
2016-07-19Support nested `macro_rules!`.Jeffrey Seyfried-1/+5
2016-07-18Properly feature gate all unstable ABIsVadim Petrochenkov-32/+41
2016-07-18Auto merge of #34886 - jseyfried:improve_stmt_matchers, r=eddybbors-49/+31
macros: fix bug in `stmt` matchers Today, `stmt` matchers stop too early when parsing expression statements that begin with non-braced macro invocations. For example, ```rust fn main() { macro_rules! m { ($s:stmt;) => { $s } } id!(vec![].push(0);); //^ Before this PR, the `stmt` matcher only consumes "vec![]", so this is an error. //| After this PR, the `stmt` matcher consumes "vec![].push(0)", so this compiles. } ``` This change is backwards compatible due to the follow set for `stmt`. r? @eddyb
2016-07-17Auto merge of #34860 - jseyfried:encapsulate_hygiene, r=nrcbors-208/+135
Clean up and encapsulate `syntax::ext::mtwt`, rename `mtwt` to `hygiene` r? @nrc
2016-07-17Remove some unit tests and that are redundant with `run-pass/hygiene.rs`Jeffrey Seyfried-35/+0
and that would be painful to rewrite.
2016-07-17Rename `mtwt` to `hygiene`Jeffrey Seyfried-4/+4
2016-07-17Clean up and encapsulate `syntax::ext::mtwt`Jeffrey Seyfried-132/+94
2016-07-17macros: Fix bug in statement matchersJeffrey Seyfried-49/+31
2016-07-17Auto merge of #34829 - cgswords:tstream, r=nrcbors-1/+9
Added tokenstream parser procedure A tiny PR that simply adds a procedure for parsing `TokenStream`s to the parser in `src/libsyntax`. This is to ease using `TokenStream`s with the current (old) procedural macro system.
2016-07-17Auto merge of #34789 - jonathandturner:simplify_liberror, r=alexcrichtonbors-809/+9
Simplify librustc_errors This is part 2 of the error crate refactor, starting with #34403. In this refactor, I focused on slimming down the error crate to fewer moving parts. As such, I've removed quite a few parts and replaced the with simpler, straight-line code. Specifically, this PR: * Removes BasicEmitter * Remove emit from emitter, leaving emit_struct * Renames emit_struct to emit * Removes CoreEmitter and focuses on a single Emitter * Implements the latest changes to error format RFC (#1644) * Removes (now-unused) code in emitter.rs and snippet.rs * Moves more tests to the UI tester, removing some duplicate tests in the process There is probably more that could be done with some additional refactoring, but this felt like it was getting to a good state. r? @alexcrichton cc: @Manishearth (as there may be breaking changes in stuff I removed/changed)
2016-07-16Auto merge of #34816 - jseyfried:fix_include_path, r=nrcbors-0/+6
Fix `include!()`s inside `asm!()` invocations Fixes #34812, a regression caused by #33749 that was not fixed in #34450. r? @nrc
2016-07-15Auto merge of #34676 - aravind-pg:inner-attr, r=brsonbors-14/+56
Better error message for inner attribute following doc comment Before it was always just "an inner attribute is not permitted in this context", whereas now we add a special case for when an inner attr follows an outer attr. If the outer attr is a doc comment, then the error is "an inner attr is not permitted following a doc comment", and otherwise it's "an inner attr is not permitted following an outer attribute". In all other cases it's still "an inner attribute is not permitted in this context". Note that the public API and behaviour of `parse_attribute` is unchanged. Also, all new names are very open to bikeshedding -- they're arguably clunky. Fixes #34516. cc @brson
2016-07-15syntax: Better error message for inner attr following doc commentAravind Gollakota-14/+56
2016-07-15Added tokenstream parser procedurecgswords-1/+9
2016-07-15Auto merge of #34570 - jseyfried:no_rename, r=nrcbors-720/+67
Simplify the macro hygiene algorithm This PR removes renaming from the hygiene algorithm and treats differently marked identifiers as unequal. This change makes the scope of identifiers in `macro_rules!` items empty. That is, identifiers in `macro_rules!` definitions do not inherit any semantics from the `macro_rules!`'s scope. Since `macro_rules!` macros are items, the scope of their identifiers "should" be the same as that of other items; in particular, the scope should contain only items. Since all items are unhygienic today, this would mean the scope should be empty. However, the scope of an identifier in a `macro_rules!` statement today is the scope that the identifier would have if it replaced the `macro_rules!` (excluding anything unhygienic, i.e. locals only). To continue to support this, this PR tracks the scope of each `macro_rules!` and uses it in `resolve` to ensure that an identifier expanded from a `macro_rules!` gets a chance to resolve to the locals in the `macro_rules!`'s scope. This PR is a pure refactoring. After this PR, - `syntax::ext::expand` is much simpler. - We can expand macros in any order without causing problems for hygiene (needed for macro modularization). - We can deprecate or remove today's `macro_rules!` scope easily. - Expansion performance improves by 25%, post-expansion memory usage decreases by ~5%. - Expanding a block is no longer quadratic in the number of `let` statements (fixes #10607). r? @nrc
2016-07-14Remove more unused importsJonathan Turner-1/+0
2016-07-14Remove unused importsJonathan Turner-19/+0
2016-07-14Add back in import needed for codemap testsJonathan Turner-0/+1
2016-07-14Add fix for tabs. Move error unit tests->ui testsJonathan Turner-766/+4
2016-07-14Fix up some tidy-unfriendly spacingJonathan Turner-18/+18
2016-07-14DCE and fixing some internal testsJonathan Turner-98/+98