about summary refs log tree commit diff
path: root/src/libsyntax_ext
AgeCommit message (Collapse)AuthorLines
2018-05-03Auto merge of #50413 - kennytm:rollup, r=kennytmbors-0/+5
Rollup of 12 pull requests Successful merges: - #50302 (Add query search order check) - #50320 (Fix invalid path generation in rustdoc search) - #50349 (Rename "show type declaration" to "show declaration") - #50360 (Clarify wordings of the `unstable_name_collision` lint.) - #50365 (Use two vectors in nearest_common_ancestor.) - #50393 (Allow unaligned reads in constants) - #50401 (Revert "Implement FromStr for PathBuf") - #50406 (Forbid constructing empty identifiers from concat_idents) - #50407 (Always inline simple BytePos and CharPos methods.) - #50416 (check if the token is a lifetime before parsing) - #50417 (Update Cargo) - #50421 (Fix ICE when using a..=b in a closure.) Failed merges:
2018-05-02forbid empty identifiers from concat_identsMichael Lamparski-0/+5
2018-05-02Remove Option from the return type of Attribute::name()Seiichi Uchida-6/+4
2018-04-26rustc_target: move in syntax::abi and flip dependency.Irina Popa-2/+4
2018-04-25Update comments to UFCS stylevarkor-11/+24
2018-04-25Use UFCSvarkor-11/+20
2018-04-25Fix handling of Nonevarkor-11/+11
2018-04-25Ensure derive(PartialOrd) is no longer accidentally exponentialvarkor-70/+83
Previously, two comparison operations would be generated for each field, each of which could delegate to another derived PartialOrd. Now we use ordering and optional chaining to ensure each pair of fields is only compared once.
2018-04-25Auto merge of #49986 - zofrex:better-derived-argument-names, r=Manishearthbors-39/+41
Provide better names for builtin deriving-generated attributes First attempt at fixing #49967 Not in love with any choices here, don't be shy if you aren't happy with anything :) I've tested that this produces nicer names in documentation, and that it no longer has issues conflicting with constants with the same name. (I guess we _could_ make a test for that... unsure if that would be valuable) In all cases I took the names from the methods as declared in the relevant trait. In some cases I had to prepend the names with _ otherwise there were errors about un-used variables. I'm uneasy with the inconsistency... do they all need to be like that? Is there a way to generate an alternate impl or use a different name (`_`?) in the cases where the arguments are not used? Lastly the gensym addition to Ident I implemented largely as suggested, but I want to point out it's a little circuitous (at least, as far as I understand it). `cx.ident_of(name)` is just `Ident::from_str`, so we create an Ident then another Ident from it. `Ident::with_empty_ctxt(Symbol::gensym(string))` may or may not be equivalent, I don't know if it's important to intern it _then_ gensym it. It seems like either we could use that, or if we do want a new method to make this convenient, it could be on Ident instead (`from_str_gensymed`?)
2018-04-24Gensym arguments for format macroJames Sanderson-7/+9
2018-04-19Fix some of the __names in the commentsJames Sanderson-13/+13
2018-04-19Gensym remaining identifiersJames Sanderson-5/+5
2018-04-19Don't prepend deriving-generated attributes with _James Sanderson-3/+3
2018-04-15Provide better names for builtin deriving-generated attributesJames Sanderson-14/+14
2018-04-15Auto merge of #49881 - varkor:partialord-opt, r=Manishearthbors-91/+212
Fix derive(PartialOrd) and optimise final field operation ```rust // Before (`lt` on 2-field struct) self.f1 < other.f1 || (!(other.f1 < self.f1) && (self.f2 < other.f2 || (!(other.f2 < self.f2) && (false) )) ) // After self.f1 < other.f1 || (!(other.f1 < self.f1) && self.f2 < other.f2 ) // Before (`le` on 2-field struct) self.f1 < other.f1 || (!(other.f1 < self.f1) && (self.f2 < other.f2 || (!(other.f2 < self.f2) && (true) )) ) // After self.f1 < other.f1 || (self.f1 == other.f1 && self.f2 <= other.f2 ) ``` (The big diff is mainly because of a past faulty rustfmt application that I corrected 😒) Fixes #49650 and fixes #49505.
2018-04-14Add tests and longer error explanationGuillaume Gomez-1/+24
2018-04-14Add error codes for libsyntax_extGuillaume Gomez-2/+41
2018-04-12Abstract cs_eq for partial_eqvarkor-50/+27
2018-04-12Improve the comment for cs_fold1varkor-2/+9
2018-04-12Update partial_ord codegen summaryvarkor-3/+10
2018-04-11Remove redundant operation in derive[PartialEq]varkor-28/+58
2018-04-11Optimise the last field operations in derive[PartialOrd]varkor-51/+72
2018-04-11Add cs_fold1 for better derivesvarkor-17/+92
2018-04-11Fix derive(PartialOrd) implementationvarkor-6/+10
2018-04-11Implementation of `#[repr(packed(n))]` RFC 1399.Cameron Hart-3/+7
2018-04-08Move deny(warnings) into rustbuildMark Simulacrum-1/+0
This permits easier iteration without having to worry about warnings being denied. Fixes #49517
2018-04-06Remove more duplicated spansVadim Petrochenkov-3/+4
2018-04-06Rename `ast::Variant_::name` into `ident` + Fix rebaseVadim Petrochenkov-7/+5
2018-04-06Use `Span::apply_mark` where possibleVadim Petrochenkov-9/+9
2018-04-06Get rid of `SpannedIdent`Vadim Petrochenkov-30/+13
2018-04-06Rename `PathSegment::identifier` to `ident`Vadim Petrochenkov-2/+2
2018-04-06Use `Span` instead of `SyntaxContext` in `Ident`Vadim Petrochenkov-10/+6
2018-04-03expand macro invocations in `extern {}` blocksAustin Bonander-0/+1
2018-04-02Expand attribute macros on statements and expressions.Austin Bonander-1/+3
Retains the `stmt_expr_attributes` feature requirement for attributes on expressions. closes #41475 cc #38356
2018-03-31Auto merge of #49201 - Phlosioneer:add-trivial-size-hints, r=SimonSapinbors-0/+9
Implement some trivial size_hints for various iterators This also implements ExactSizeIterator where applicable. Addresses most of the Iterator traits mentioned in #23708. I intend to do more, but I don't want to make the PR too large.
2018-03-27Auto merge of #49279 - varkor:generated-closure-return-type, r=alexcrichtonbors-6/+6
Fix implicit closure return type generation for libsyntax The `lambda` function for constructing closures in libsyntax was explicitly setting the return type to `_`, which resulted in incorrect corresponding syntax (as `|| -> _ x` is not valid, without the enclosing brackets). This meant the generated code, when printed, was invalid. I also took the opportunity to slightly improve the generated code for the `RustcEncodable::encode` method for unit structs. Fixes #42213.
2018-03-22Optimise decode return expression for unit structsvarkor-5/+5
2018-03-22Use FunctionRetTy::Default rather than an explicit TyKind::Infer for ↵varkor-1/+1
lambda-building This prevents explicit `-> _` return type annotations for closures generated by `lambda`.
2018-03-20Implement some trivial size_hints for various iteratorsPhlosioneer-0/+9
This also implements ExactSizeIterator where applicable. Addresses most of the Iterator traits mentioned in #23708.
2018-03-18Initial implementation of RFC 2151, Raw IdentifiersLymia Aluysia-2/+3
2018-03-18Auto merge of #48917 - petrochenkov:import, r=oli-obkbors-3/+3
syntax: Make imports in AST closer to the source and cleanup their parsing This is a continuation of https://github.com/rust-lang/rust/pull/45846 in some sense.
2018-03-17Rename `Span::empty` to `Span::shrink_to_lo`, add `Span::shrink_to_hi`Vadim Petrochenkov-3/+3
2018-03-17syntax: Make `_` an identifierVadim Petrochenkov-3/+3
2018-03-16Auto merge of #48813 - sinkuu:build_in_assert_macro, r=alexcrichtonbors-0/+125
Make `assert` a built-in procedural macro Makes `assert` macro a built-in one without touching its functionality. This is a prerequisite for RFC 2011 (#44838).
2018-03-16Auto merge of #48524 - abonander:check-macro-stability, r=petrochenkovbors-0/+2
check stability of macro invocations I haven't implemented tests yet but this should be a pretty solid prototype. I think as-implemented it will also stability-check macro invocations in the same crate, dunno if we want that or not. I don't know if we want this to go through `rustc::middle::stability` or not, considering the information there wouldn't be available at the time of macro expansion (even for external crates, right?). r? @nrc closes #34079 cc @petrochenkov @durka @jseyfried #38356
2018-03-14Escape stringified expressionShotaro Yamada-5/+64
Payload of `Literal` token must be escaped. Also print printable non-ASCII characters.
2018-03-13Rollup merge of #48934 - Phlosioneer:42453-debug-hygene, r=petrochenkovkennytm-1/+1
Fix hygene issue when deriving Debug The code for several of the core traits doesn't use hygenic macros. This isn't a problem, except for the Debug trait, which is the only one that uses a variable, named "builder". Variables can't share names with unit structs, so attempting to [derive(Debug)] on any type while a unit struct with the name "builder" was in scope would result in an error. This commit just changes the name of the variable to "__debug_trait_builder", because I couldn't figure out how to get a list of all unit structs in-scope from within the derive expansion function. If someone wants to have a unit struct with the exact name "__debug_trait_builder", they'll just have to do it without a [derive(Debug)]. I also checked the implementations of the other built-in derives to ensure they didn't declare any variables.
2018-03-11Fix hygene issue when deriving DebugPhlosioneer-1/+1
The code for several of the core traits doesn't use hygenic macros. This isn't a problem, except for the Debug trait, which is the only one that uses a variable, named "builder". Variables can't share names with unit structs, so attempting to [derive(Debug)] on any type while a unit struct with the name "builder" was in scope would result in an error. This commit just changes the name of the variable to "__debug_trait_builder", because I couldn't figure out how to get a list of all unit structs in-scope from within the derive expansion function. If someone wants to have a unit struct with the exact name "__debug_trait_builder", they'll just have to do it without a [derive(Debug)].
2018-03-07check stability of macro invocationsAustin Bonander-0/+2
2018-03-07Make `assert` macro a built-in procedural macroShotaro Yamada-0/+66