about summary refs log tree commit diff
path: root/src/libsyntax/fold.rs
AgeCommit message (Collapse)AuthorLines
2015-12-22Stop re-exporting PathParameters's variants.Ms2ger-4/+4
2015-12-19Auto merge of #30184 - petrochenkov:ascr, r=nikomatsakisbors-0/+3
This PR is a rebase of the original PR by @eddyb https://github.com/rust-lang/rust/pull/21836 with some unrebasable parts manually reapplied, feature gate added + type equality restriction added as described below. This implementation is partial because the type equality restriction is applied to all type ascription expressions and not only those in lvalue contexts. Thus, all difficulties with detection of these contexts and translation of coercions having effect in runtime are avoided. So, you can't write things with coercions like `let slice = &[1, 2, 3]: &[u8];`. It obviously makes type ascription less useful than it should be, but it's still much more useful than not having type ascription at all. In particular, things like `let v = something.iter().collect(): Vec<_>;` and `let u = t.into(): U;` work as expected and I'm pretty happy with these improvements alone. Part of https://github.com/rust-lang/rust/issues/23416
2015-12-18Deprecate name `OwnedSlice` and don't use itVadim Petrochenkov-10/+9
2015-12-16Implement type ascription.Eduard Burtescu-0/+3
2015-12-16Rollup merge of #30388 - DanielJCampbell:macro-ident-spans, r=nrcManish Goregaokar-1/+2
r? @nrc
2015-12-15Generated code spans now point to callsite parameters (where applicable)Daniel Campbell-1/+2
2015-12-05Use a struct instead of a tuple for inline asm output operandsAmanieu d'Antras-2/+7
2015-12-05Add proper support for indirect output constraints in inline asmAmanieu d'Antras-2/+2
2015-11-26Some TLC for the MoveMap traitMarvin Löbel-35/+13
2015-11-26Fixed macro expander not folding attributes (though I'm not sure if that is ↵Marvin Löbel-1/+5
actually neccessary)
2015-11-26Moved and refactored ThinAttributesMarvin Löbel-3/+4
2015-11-26Add syntax support for attributes on expressions and all syntaxMarvin Löbel-19/+48
nodes in statement position. Extended #[cfg] folder to allow removal of statements, and of expressions in optional positions like expression lists and trailing block expressions. Extended lint checker to recognize lint levels on expressions and locals.
2015-11-16rename `ast::ImplItem_::*ImplItem` to `ast::ImplItemKind::*`Oliver Schneider-6/+6
2015-11-11libsyntax: Add more quasiquoting macrosKyle Mayes-0/+1
2015-11-10Use deref coercionsSeo Sanghyeon-1/+1
2015-11-06remove `Tt` prefix from TokenType variantsOliver Schneider-6/+6
[breaking change]
2015-10-31Remove PatWildMultiVadim Petrochenkov-1/+1
2015-10-25syntax/rustc_front: Simplify VariantData::fieldsVadim Petrochenkov-15/+13
And use VariantData instead of P<VariantData> in Item_ and Variant_
2015-10-13Merge VariantData and VariantData_Vadim Petrochenkov-9/+10
2015-10-13Merge struct fields and struct kindVadim Petrochenkov-3/+10
2015-10-13Dict -> Struct, StructDef -> VariantData, def -> dataVadim Petrochenkov-6/+6
2015-10-13Provide span for visit_struct_def + remove some dead codeVadim Petrochenkov-12/+0
2015-10-13Remove now redundant NodeId from VariantVadim Petrochenkov-2/+1
2015-10-13Decouple structure kinds from NodeIdsVadim Petrochenkov-2/+3
2015-10-13Unify structures and enum variants in ASTVadim Petrochenkov-10/+2
2015-10-09Some cleanup of no longer used AST thingsNick Cameron-3/+2
2015-09-24Remove the deprecated box(PLACE) syntax.Eduard Burtescu-2/+5
2015-09-20Replace `ast::Mac_` enum with structAndrew Paseltiner-4/+4
Closes #28527.
2015-09-17Remove Visibility field from enum variantsSimonas Kazlauskas-2/+1
Followup on #28440
2015-09-03Use proper span for break and continue labelsSimonas Kazlauskas-2/+8
Fixes #28109
2015-08-10Auto merge of #27451 - seanmonstar:use-groups-as, r=alexcrichtonbors-3/+7
An implementation of [RFC 1219](https://github.com/rust-lang/rfcs/pull/1219). The RFC is not merged yet, but once merged, this could be.
2015-08-08rustc: rename multiple imports in a listSean McArthur-3/+7
2015-08-04Add a macro invocation to the type ASTJared Roesch-0/+3
Reapplied the changes from https://github.com/freebroccolo/rust/commit/dc64b731d7f66c2b43d5e5e8c721be7bd3b59540 to a clean branch of master
2015-07-26Remove `ast::LocalSource` with only one used variantmitaa-2/+1
`LocalSource` indicated wether a let binding originated from for-loop desugaring to enable specialized error messages, but for-loop expansion has changed and this is now achieved through `MatchSource::ForLoopDesugar`.
2015-06-10Removed many pointless calls to *iter() and iter_mut()Joshua Landau-1/+1
2015-05-21Make various fixes:Niko Matsakis-2/+1
- add feature gate - add basic tests - adjust parser to eliminate conflict between `const fn` and associated constants - allow `const fn` in traits/trait-impls, but forbid later in type check - correct some merge conflicts
2015-05-21syntax: parse `const fn` for free functions and inherent methods.Eduard Burtescu-1/+4
2015-05-15syntax: Add unquoting ast::{Generics,WhereClause}Erick Tryzelaar-0/+3
2015-04-27Auto merge of #23606 - quantheory:associated_const, r=nikomatsakisbors-0/+11
Closes #17841. The majority of the work should be done, e.g. trait and inherent impls, different forms of UFCS syntax, defaults, and cross-crate usage. It's probably enough to replace the constants in `f32`, `i8`, and so on, or close to good enough. There is still some significant functionality missing from this commit: - ~~Associated consts can't be used in match patterns at all. This is simply because I haven't updated the relevant bits in the parser or `resolve`, but it's *probably* not hard to get working.~~ - Since you can't select an impl for trait-associated consts until partway through type-checking, there are some problems with code that assumes that you can check constants earlier. Associated consts that are not in inherent impls cause ICEs if you try to use them in array sizes or match ranges. For similar reasons, `check_static_recursion` doesn't check them properly, so the stack goes ka-blooey if you use an associated constant that's recursively defined. That's a bit trickier to solve; I'm not entirely sure what the best approach is yet. - Dealing with consts associated with type parameters will raise some new issues (e.g. if you have a `T: Int` type parameter and want to use `<T>::ZERO`). See rust-lang/rfcs#865. - ~~Unused associated consts don't seem to trigger the `dead_code` lint when they should. Probably easy to fix.~~ Also, this is the first time I've been spelunking in rustc to such a large extent, so I've probably done some silly things in a couple of places.
2015-04-25Interpolate AST nodes in quasiquote.Geoffry Song-0/+7
This changes the `ToTokens` implementations for expressions, statements, etc. with almost-trivial ones that produce `Interpolated(*Nt(...))` pseudo-tokens. In this way, quasiquote now works the same way as macros do: already-parsed AST fragments are used as-is, not reparsed. The `ToSource` trait is removed. Quasiquote no longer involves pretty-printing at all, which removes the need for the `encode_with_hygiene` hack. All associated machinery is removed. A new `Nonterminal` is added, NtArm, which the parser now interpolates. This is just for quasiquote, not macros (although it could be in the future). `ToTokens` is no longer implemented for `Arg` (although this could be added again) and `Generics` (which I don't think makes sense). This breaks any compiler extensions that relied on the ability of `ToTokens` to turn AST fragments back into inspectable token trees. For this reason, this closes #16987. As such, this is a [breaking-change]. Fixes #16472. Fixes #15962. Fixes #17397. Fixes #16617.
2015-04-24Change name of unit test sub-module to "tests".Johannes Oertel-1/+1
Changes the style guidelines regarding unit tests to recommend using a sub-module named "tests" instead of "test" for unit tests as "test" might clash with imports of libtest.
2015-04-23Get associated consts working in match patterns.Sean Patrick Santos-0/+4
2015-04-23Structural changes for associated constantsSean Patrick Santos-0/+7
Introduces new variants and types in syntax::ast, middle::ty, and middle::def.
2015-04-21syntax: remove #![feature(box_syntax, box_patterns)]Erick Tryzelaar-3/+3
2015-04-11Propagate macro backtraces more often, improve formatting diagnosticsRyan Prichard-3/+5
* In noop_fold_expr, call new_span in these cases: - ExprMethodCall's identifier - ExprField's identifier - ExprTupField's integer Calling new_span for ExprMethodCall's identifier is necessary to print an acceptable diagnostic for write!(&2, ""). We see this error: <std macros>:2:20: 2:66 error: type `&mut _` does not implement any method in scope named `write_fmt` <std macros>:2 ( & mut * $ dst ) . write_fmt ( format_args ! ( $ ( $ arg ) * ) ) ) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ With this change, we also see a macro expansion backtrace leading to the write!(&2, "") call site. * After fully expanding a macro, we replace the expansion expression's span with the original span. Call fld.new_span to add a backtrace to this span. (Note that I'm call new_span after bt.pop(), so the macro just expanded isn't on the backtrace.) The motivating example for this change is println!("{}"). The format string literal is concat!($fmt, "arg") and is inside the libstd macro. We need to see the backtrace to find the println! call site. * Add a backtrace to the format_args! format expression span. Addresses #23459
2015-03-26Switch drop-flag to `u8` to allow special tags to instrument state.Felix S. Klock II-1/+1
Refactored code so that the drop-flag values for initialized (`DTOR_NEEDED`) versus dropped (`DTOR_DONE`) are given explicit names. Add `mem::dropped()` (which with `DTOR_DONE == 0` is semantically the same as `mem::zeroed`, but the point is that it abstracts away from the particular choice of value for `DTOR_DONE`). Filling-drop needs to use something other than `ptr::read_and_zero`, so I added such a function: `ptr::read_and_drop`. But, libraries should not use it if they can otherwise avoid it. Fixes to tests to accommodate filling-drop.
2015-03-11syntax: move MethMac to MacImplItem and combine {Provided,Required}Method ↵Eduard Burtescu-19/+10
into MethodTraitItem.
2015-03-11syntax: rename TypeMethod to MethodSig and use it in MethDecl.Eduard Burtescu-20/+13
2015-03-11syntax: gather common fields of impl & trait items into their respective types.Eduard Burtescu-118/+47
2015-03-11syntax: move indirection around {Trait,Impl}Item, from within.Eduard Burtescu-26/+23