about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2015-04-25Interpolate AST nodes in quasiquote.Geoffry Song-502/+189
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-25Auto merge of #24547 - bombless:comma, r=pnkfelixbors-1/+40
Closes #20616 It breaks code such as <https://github.com/rust-lang/rust/blob/c64feb63418fd05bd6e5adc6f9ad763aa6a594b1/src/librustc_typeck/check/method/suggest.rs#L367>, so this is a [breaking-change], you have to add missing comma after the last lifetime arguement now.
2015-04-25Auto merge of #24783 - jooert:unittestguidelines, r=alexcrichtonbors-12/+12
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 (see #23870, #24030 and http://users.rust-lang.org/t/guidelines-naming-of-unit-test-module/1078 for previous discussions). r? @alexcrichton
2015-04-25Fix #20616York Xiang-1/+40
2015-04-24Rollup merge of #24749 - lstat:feature-gate-22820, r=nrcSteve Klabnik-2/+2
As part of the audit for #22820 the following feature gate tests have been added: * `negate_unsigned` * `on_unimplemented` * `optin_builtin_traits` * `plugin` * `rustc_attrs` * `rustc_diagnostic_macros` * `slice_patterns` In addition some feature gate error message typos fixed.
2015-04-24Change name of unit test sub-module to "tests".Johannes Oertel-12/+12
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-24Add ')' in `advaced_slice_patterns` error messageLuke Gallagher-1/+1
2015-04-24Add missing '\' for `custom_derive` error messageLuke Gallagher-1/+1
2015-04-24Do not include attributes in trait item spans.Nick Cameron-5/+4
(And other kinds of items).
2015-04-23Auto merge of #24683 - P1start:help-suggestions, r=nrcbors-3/+8
This PR uses the inline error suggestions introduced in #24242 to modify a few existing `help` messages. The new errors look like this: foobar.rs:5:12: 5:25 error: expected a path on the left-hand side of `+`, not `&'static Copy` [E0178] foobar.rs:5 let x: &'static Copy + 'static; ^~~~~~~~~~~~~ foobar.rs:5:12: 5:35 help: try adding parentheses (per RFC 438): foobar.rs: let x: &'static (Copy + 'static); foobar.rs:2:13: 2:23 error: cast to unsized type: `&_` as `core::marker::Copy` foobar.rs:2 let x = &1 as Copy; ^~~~~~~~~~ foobar.rs:2:19: 2:23 help: try casting to a reference instead: foobar.rs: let x = &1 as &Copy; foobar.rs:7:24: 7:25 error: expected expression, found `;` foobar.rs:7 let x = box (1 + 1); ^ foobar.rs:7:13: 7:16 help: try using `box()` instead: foobar.rs: let x = box() (1 + 1); This also modifies compiletest to give the ability to directly test suggestions given by error messages.
2015-04-22Auto merge of #24685 - nrc:span-pred, r=huonwbors-3/+3
2015-04-22Fix spans for predicates in where clausesNick Cameron-3/+3
2015-04-21rollup merge of #24636: alexcrichton/remove-deprecatedAlex Crichton-13/+20
Conflicts: src/libcore/result.rs
2015-04-21std: Remove deprecated/unstable num functionalityAlex Crichton-13/+20
This commit removes all the old casting/generic traits from `std::num` that are no longer in use by the standard library. This additionally removes the old `strconv` module which has not seen much use in quite a long time. All generic functionality has been supplanted with traits in the `num` crate and the `strconv` module is supplanted with the [rust-strconv crate][rust-strconv]. [rust-strconv]: https://github.com/lifthrasiir/rust-strconv This is a breaking change due to the removal of these deprecated crates, and the alternative crates are listed above. [breaking-change]
2015-04-21syntax: Copy unstable str::char_at into libsyntaxErick Tryzelaar-22/+39
2015-04-21syntax: Change ExpnId::{from,to}_llvm_cookie to {from,to}_u32Erick Tryzelaar-6/+4
2015-04-21syntax: Remove #[feature(path_ext)]Erick Tryzelaar-3/+3
Replace Path::exists with stable metadata call.
2015-04-21syntax: replace Vec::push_all with stable Vec::extendErick Tryzelaar-9/+14
2015-04-21syntax: Replace Vec::map_in_place with stable mut iteratorErick Tryzelaar-9/+11
2015-04-21syntax: Replace [].tail with the stable [1..] syntaxErick Tryzelaar-1/+1
2015-04-21syntax: Replace String::from_str with the stable String::fromErick Tryzelaar-9/+9
2015-04-21syntax: remove #[feature(quote, unsafe_destructor)]Erick Tryzelaar-6/+43
2015-04-21syntax: Don't use unstable fn to convert single element to a sliceErick Tryzelaar-1/+4
2015-04-21syntax: Remove use of TraitObject in pretty printerErick Tryzelaar-13/+8
2015-04-21syntax: remove uses of `.into_cow()`Erick Tryzelaar-5/+4
2015-04-21syntax: Remove uses of #[feature(slice_patterns)]Erick Tryzelaar-47/+73
2015-04-21syntax: remove #![feature(box_syntax, box_patterns)]Erick Tryzelaar-46/+44
2015-04-21Model lexer: Fix remaining issuesPiotr Czarnecki-4/+0
2015-04-21Change a few error messages to give code suggestionsP1start-3/+8
PR #24242 added the ability to the compiler to directly give suggestions about how to modify code to fix an error. The new errors look like this: foobar.rs:5:12: 5:25 error: expected a path on the left-hand side of `+`, not `&'static Copy` [E0178] foobar.rs:5 let x: &'static Copy + 'static; ^~~~~~~~~~~~~ foobar.rs:5:12: 5:35 help: try adding parentheses (per RFC 438): foobar.rs: let x: &'static (Copy + 'static); foobar.rs:2:13: 2:23 error: cast to unsized type: `&_` as `core::marker::Copy` foobar.rs:2 let x = &1 as Copy; ^~~~~~~~~~ foobar.rs:2:19: 2:23 help: try casting to a reference instead: foobar.rs: let x = &1 as &Copy; foobar.rs:7:24: 7:25 error: expected expression, found `;` foobar.rs:7 let x = box (1 + 1); ^ foobar.rs:7:13: 7:16 help: try using `box()` instead: foobar.rs: let x = box() (1 + 1); This also modifies compiletest to give the ability to directly test suggestions given by error messages.
2015-04-18Rollup merge of #24542 - michaelsproul:rollup, r=alexcrichtonManish Goregaokar-0/+21
I did a manual merge of all the extended error PRs as we were getting merge conflicts yesterday. I think this is preferable to merging separately as I ended up having to manually merge @nham and @GuillaumeGomez's commits. Rollup of #24458, #24482 and #24488. #24482 and #24488 were already re-approved, and would need to be cancelled if this is merged instead.
2015-04-18Auto merge of #24428 - kwantam:deprecate_unicode_fns, r=alexcrichtonbors-8/+7
This patch 1. renames libunicode to librustc_unicode, 2. deprecates several pieces of libunicode (see below), and 3. removes references to deprecated functions from librustc_driver and libsyntax. This may change pretty-printed output from these modules in cases involving wide or combining characters used in filenames, identifiers, etc. The following functions are marked deprecated: 1. char.width() and str.width(): --> use unicode-width crate 2. str.graphemes() and str.grapheme_indices(): --> use unicode-segmentation crate 3. str.nfd_chars(), str.nfkd_chars(), str.nfc_chars(), str.nfkc_chars(), char.compose(), char.decompose_canonical(), char.decompose_compatible(), char.canonical_combining_class(): --> use unicode-normalization crate
2015-04-18Auto merge of #23985 - erickt:derive-cleanup, r=ericktbors-512/+496
This extracts some of the minor cleanup patches from #23905.
2015-04-17Rollup merge of #24454 - aochagavia:debug, r=alexcrichtonManish Goregaokar-8/+29
Implement `Debug`, `Display` and `Error` for `FatalError` and `ExplicitBug`
2015-04-17Rollup merge of #24430 - laumann:trace-macros-flag, r=pnkfelixManish Goregaokar-4/+4
This is the second attempt at turning the trace_macros macro into a compiler flag. See #22619
2015-04-17Enforce 80 char lines in extended errors.Michael Sproul-3/+12
2015-04-17Validate format of extended error descriptions.Michael Sproul-0/+12
2015-04-16Fix some documentation typosLuke Gallagher-1/+1
2015-04-16Omit 'obsolete' note for warning if -AwarningMathijs van de Nes-1/+2
2015-04-16deprecate Unicode functions that will be moved to crates.iokwantam-8/+7
This patch 1. renames libunicode to librustc_unicode, 2. deprecates several pieces of libunicode (see below), and 3. removes references to deprecated functions from librustc_driver and libsyntax. This may change pretty-printed output from these modules in cases involving wide or combining characters used in filenames, identifiers, etc. The following functions are marked deprecated: 1. char.width() and str.width(): --> use unicode-width crate 2. str.graphemes() and str.grapheme_indices(): --> use unicode-segmentation crate 3. str.nfd_chars(), str.nfkd_chars(), str.nfc_chars(), str.nfkc_chars(), char.compose(), char.decompose_canonical(), char.decompose_compatible(), char.canonical_combining_class(): --> use unicode-normalization crate
2015-04-16Auto merge of #24423 - tbelaire:include_bytes, r=alexcrichtonbors-0/+5
This is a little bit tricky, since with include_str!, we know that we are including utf-8 content, so it's safe to store the source as a String in a FileMap. We don't know that for include_bytes!, but I don't think we actually need to track the contents anyways, so I'm passing "". new_filemap does check for the zero length content, and it should be reasonable, howeven I'm not sure if it would be better to pass None instead of Some(Rc::new("")) as the src component of a FileMap. Fixes bug #24348
2015-04-16Auto merge of #23682 - tamird:DRY-is-empty, r=alexcrichtonbors-44/+44
r? @alexcrichton
2015-04-15syntax: Clean up the indentation for #[derive(Eq)]Erick Tryzelaar-12/+14
2015-04-15syntax: Change deriving methods to take a `&mut FnMut(P<Item>)`Erick Tryzelaar-115/+97
This allows #[derive(...)]` to create more than one impl
2015-04-15syntax: Rename deriving/cmp/* to match their current namesErick Tryzelaar-415/+415
2015-04-16Auto merge of #24485 - brson:is, r=alexcrichtonbors-2/+0
It was an oversight that this was not done in the great int upheaval. [breaking-change]
2015-04-15Forbid is/us suffixes. Fixes #22496Brian Anderson-2/+0
It was an oversight that this was not done in the great int upheaval. [breaking-change]
2015-04-15Rollup merge of #24438 - nrc:tuple-span, r=sfacklerSteve Klabnik-1/+1
2015-04-15Auto merge of #24436 - fhahn:fix-small-typo, r=steveklabnikbors-1/+1
2015-04-15Implement traits for parser error structsAdolfo OchagavĂ­a-8/+29
Implement `Debug`, `Display` and `Error` for `FatalError` and `ExplicitBug`
2015-04-14Negative case of `len()` -> `is_empty()`Tamir Duberstein-30/+30
`s/([^\(\s]+\.)len\(\) [(?:!=)>] 0/!$1is_empty()/g`