about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2015-07-18Define and use a `print_maybe_styled!` macro in libsyntax/diagnostic.rsP1start-20/+38
`EmitterWriter::print_maybe_styled` was basically always used with `format!`, so this macro makes some code cleaner. It should also remove some unnecessary allocations (most `print_maybe_styled` invocations allocated a `String` previously, whereas the new macro uses `write_fmt` to write the formatted string directly to the terminal). This probably could have been part of #26838, but it’s too late now.
2015-07-18Rollup merge of #27067 - GuillaumeGomez:patch-1, r=cmrManish Goregaokar-0/+6
Now the macro argument list can be finished by a comma (not sure this is correct english...). cc @tamird r? @bluss
2015-07-18Rollup merge of #26777 - barosl:macro-doc-escapes, r=pnkfelixManish Goregaokar-1/+1
Escape sequences in documentation comments must not be parsed as a normal string when expanding a macro, otherwise some innocent but invalid-escape-sequence-looking comments will trigger an ICE. Although this commit replaces normal string literals with raw string literals in macro expansion, this shouldn't be much a problem considering documentation comments are converted into attributes before being passed to a macro anyways. Fixes #25929. Fixes #25943.
2015-07-17Improve register_long_diagnostics macroGuillaume Gomez-0/+3
2015-07-16Improve register_diagnostics macroGuillaume Gomez-0/+3
2015-07-16Rollup merge of #26838 - P1start:refactor-diagnostic, r=alexcrichtonManish Goregaokar-396/+392
2015-07-13Auto merge of #27000 - alexcrichton:semi-after-type, r=cmrbors-1/+1
This commit expands the follow set of the `ty` and `path` macro fragments to include the semicolon token as well. A semicolon is already allowed after these tokens, so it's currently a little too restrictive to not have a semicolon allowed. For example: extern { fn foo() -> i32; // semicolon after type } fn main() { struct Foo; Foo; // semicolon after path }
2015-07-13Auto merge of #26947 - nagisa:unicode-escape-error, r=nrcbors-17/+27
Inspired by the now-mysteriously-closed https://github.com/rust-lang/rust/pull/26782. This PR introduces better error messages when unicode escapes have invalid format (e.g. `\uFFFF`). It also makes rustc always tell the user that escape may not be used in byte-strings and bytes and fixes some spans to not include unecessary characters and include escape backslash in some others.
2015-07-13Auto merge of #26750 - nrc:refactor-submod, r=sfacklerbors-68/+108
This makes the functionality usable from outside the parser
2015-07-13Tell unicode escapes can’t be used as bytes earlier/moreSimonas Kazlauskas-16/+14
2015-07-12syntax: Allow semi tokens after macro ty/pathAlex Crichton-1/+1
This commit expands the follow set of the `ty` and `path` macro fragments to include the semicolon token as well. A semicolon is already allowed after these tokens, so it's currently a little too restrictive to not have a semicolon allowed. For example: extern { fn foo() -> i32; // semicolon after type } fn main() { struct Foo; Foo; // semicolon after path }
2015-07-10Change some instances of .connect() to .join()Wesley Wiser-5/+5
2015-07-10Improve some of the string escape diagnostic spansSimonas Kazlauskas-6/+4
2015-07-10Improve incomplete unicode escape reportingSimonas Kazlauskas-5/+19
This improves diagnostic messages when \u escape is used incorrectly and { is missing. Instead of saying “unknown character escape: u”, it will now report that unicode escape sequence is incomplete and suggest what the correct syntax is.
2015-07-10Auto merge of #26907 - nrc:save-fns, r=brsonbors-7/+6
r? @huonw
2015-07-10Preserve escape sequences in documentation comments on macro expansionBarosl Lee-1/+1
Escape sequences in documentation comments must not be parsed as a normal string when expanding a macro, otherwise some innocent but invalid-escape-sequence-looking comments will trigger an ICE. Although this commit replaces normal string literals with raw string literals in macro expansion, this shouldn't be much a problem considering documentation comments are converted into attributes before being passed to a macro anyways. Fixes #25929. Fixes #25943.
2015-07-09Auto merge of #26904 - bluss:no-repeat, r=alexcrichtonbors-6/+4
In a followup to PR #26849, improve one more location for I/O where we can use `Vec::resize` to ensure better performance when zeroing buffers. Use the `vec![elt; n]` macro everywhere we can in the tree. It replaces `repeat(elt).take(n).collect()` which is more verbose, requires type hints, and right now produces worse code. `vec![]` is preferable for vector initialization. The `vec![]` replacement touches upon one I/O path too, Stdin::read for windows, and that should be a small improvement. r? @alexcrichton
2015-07-09Use vec![elt; n] where possibleUlrik Sverdrup-6/+4
The common pattern `iter::repeat(elt).take(n).collect::<Vec<_>>()` is exactly equivalent to `vec![elt; n]`, do this replacement in the whole tree. (Actually, vec![] is smart enough to only call clone n - 1 times, while the former solution would call clone n times, and this fact is virtually irrelevant in practice.)
2015-07-09Auto merge of #26515 - quantheory:check_enum_recursion, r=nrcbors-1/+6
Fixes #23302. Note that there's an odd situation regarding the following, most likely due to some inadequacy in `const_eval`: ```rust enum Y { A = 1usize, B, } ``` In this case, `Y::B as usize` might be considered a constant expression in some cases, but not others. (See #23513, for a related problem where there is only one variant, with no discriminant, and it doesn't behave nicely as a constant expression either.) Most of the complexity in this PR is basically future-proofing, to ensure that when `Y::B as usize` is fully made to be a constant expression, it can't be used to set `Y::A`, and thus indirectly itself.
2015-07-09Fix a span bug for qualified pathsNick Cameron-4/+2
2015-07-09save-analysis: API-ify pathsNick Cameron-1/+1
2015-07-09Fix a bug where macros in expression position don't have expansion inidices ↵Nick Cameron-3/+4
in their spans
2015-07-08Change some free functions into methods in libsyntax/diagnostic.rsP1start-396/+392
2015-07-07Auto merge of #26747 - huonw:stability-issue, r=alexcrichtonbors-23/+45
This takes an issue number and points people to it in the printed error message. This commit does not make it an error to have no `issue` field.
2015-07-06rustc: implement `unstable(issue = "nnn")`.Huon Wilson-23/+45
This takes an issue number and points people to it in the printed error message. This commit does not make it an error to have no `issue` field.
2015-07-05Feature-gate #[prelude_import].Eduard Burtescu-17/+41
2015-07-03Auto merge of #26378 - arielb1:unused-mut, r=pnkfelixbors-1/+1
This makes it somewhat more aggressive, so this is kind-of a [breaking-change] for these compiling with `#[deny(unused_mut)]`. r? @pnkfelix
2015-07-03Refactor how the parser looks for sub-modulesNick Cameron-68/+108
This makes the functionality usable from outside the parser
2015-07-01Add netbsd amd64 supportAlex Newman-0/+2
2015-07-01Auto merge of #26034 - Gankro:deprecate-bits, r=alexcrichtonbors-0/+3
I've mirrored them out to crates (bit-vec and bit-set) that build on stable. (not sure if this actually correctly deprecates them in std)
2015-07-01fallout of bitvec/bitset deprecationAlexis Beingessner-0/+3
2015-07-01Auto merge of #26540 - oli-obk:issue11715, r=nrcbors-2/+73
closes #25037 closes #11715 r? @nrc
2015-07-01Make the unused_mut lint smarter with respect to locals.Ariel Ben-Yehuda-1/+1
Fixes #26332
2015-06-24Added unit test for code indent of multi-line errorsOliver Schneider-1/+66
2015-06-24Indent code past the widest line numberTheo Belaire-2/+8
Fixes #11715
2015-06-23Auto merge of #26061 - Gankro:inherit-dep, r=brsonbors-3/+3
Uncertain if this is the desired effect/strategy/testing. r? @aturon
2015-06-22Fix issue #23302, ICE on recursively defined enum variant discriminant.Sean Patrick Santos-1/+6
2015-06-22fix minor indentation issuesYongqian Li-13/+13
2015-06-20Rollup merge of #26452 - michaelsproul:the-second-coming, r=pnkfelixManish Goregaokar-87/+45
As per #26009 this PR implements a new collation system for extended-error metadata. I've tried to keep it as simple as possible for now, so there's no uniqueness checking and minimal modularity. Although using a lint was discussed in #26009 I decided against this because it would require converting the AST output from the plugin back into an internal data-structure. Emitting the metadata from within the plugin prevents this double-handling. We also didn't identify this as the source of the failures last time, although something untoward was definitely happening... With that in mind I would like as much feedback as possible on this before it's merged, I don't want to break the bots again! I've successfully built for my host architecture and I'm building an ARM cross-compiler now to test my assumptions about the various `CFG` variables. Despite the confusing name of `CFG_COMPILER_HOST_TRIPLE` it is actually the compile time target triple, as explained in `mk/target.mk`. ``` # This is the compile-time target-triple for the compiler. For the compiler at # runtime, this should be considered the host-triple. More explanation for why # this exists can be found on issue #2400 export CFG_COMPILER_HOST_TRIPLE ``` CC @pnkfelix @brson @nrc @alexcrichton Closes #25705, closes #26009.
2015-06-20Auto merge of #26417 - brson:feature-err, r=steveklabnikbors-13/+38
It now says '#[feature] may not be used on the stable release channel'. I had to convert this error from a lint to a normal compiler error. I left the lint previously-used for this in place since removing it is a breaking change. It will just go unused until the end of time. Fixes #24125
2015-06-20diagnostics: Resurrect the Compiler Error Index.Michael Sproul-87/+45
2015-06-18Make a better error message for using #[feature] on stable rustBrian Anderson-1/+38
It now says '#[feature] may not be used on the stable release channel'. I had to convert this error from a lint to a normal compiler error. I left the lint previously-used for this in place since removing it is a breaking change. It will just go unused until the end of time. Fixes #24125
2015-06-19Move AST Repr impls to Debug impls in libsyntax.Eduard Burtescu-11/+83
2015-06-18Auto merge of #26192 - alexcrichton:features-clean, r=aturonbors-3/+6
This commit shards the all-encompassing `core`, `std_misc`, `collections`, and `alloc` features into finer-grained components that are much more easily opted into and tracked. This reflects the effort to push forward current unstable APIs to either stabilization or removal. Keeping track of unstable features on a much more fine-grained basis will enable the library subteam to quickly analyze a feature and help prioritize internally about what APIs should be stabilized. A few assorted APIs were deprecated along the way, but otherwise this change is just changing the feature name associated with each API. Soon we will have a dashboard for keeping track of all the unstable APIs in the standard library, and I'll also start making issues for each unstable API after performing a first-pass for stabilization.
2015-06-18Auto merge of #26347 - nagisa:macro-exp, r=nrcbors-72/+70
r? @nrc, because breakage was caused by https://github.com/rust-lang/rust/pull/25318
2015-06-17Remove unused emit_feature_warn functionBrian Anderson-12/+0
2015-06-17collections: Split the `collections` featureAlex Crichton-2/+4
This commit also deprecates the `as_string` and `as_slice` free functions in the `string` and `vec` modules.
2015-06-17core: Split apart the global `core` featureAlex Crichton-1/+2
This commit shards the broad `core` feature of the libcore library into finer grained features. This split groups together similar APIs and enables tracking each API separately, giving a better sense of where each feature is within the stabilization process. A few minor APIs were deprecated along the way: * Iterator::reverse_in_place * marker::NoCopy
2015-06-16Auto merge of #26280 - Marwes:deriving_discriminant, r=pcwaltonbors-42/+90
PR for #26128. Improves codegen in deriving by utilizing the discriminant_value intrinsic. I have a more detailed comment on the changes in a comment on the issue [here](https://github.com/rust-lang/rust/issues/26128#issuecomment-111509863) ### Old ``` running 7 tests test large_c_like ... bench: 2,694,129 ns/iter (+/- 5,170) test large_c_like_ord ... bench: 2,723,521 ns/iter (+/- 9,098) test test1_partial_eq ... bench: 2,439,317 ns/iter (+/- 2,135) test test1_partial_ord ... bench: 2,499,114 ns/iter (+/- 55,766) test test2_partial_eq ... bench: 3,562,815 ns/iter (+/- 45,590) test test2_partial_ord ... bench: 3,398,306 ns/iter (+/- 22,180) test test_match_success ... bench: 1,509,267 ns/iter (+/- 1,982) ``` ### New ``` running 7 tests test large_c_like ... bench: 286,509 ns/iter (+/- 474) test large_c_like_ord ... bench: 286,666 ns/iter (+/- 8,756) test test1_partial_eq ... bench: 286,584 ns/iter (+/- 2,789) test test1_partial_ord ... bench: 286,470 ns/iter (+/- 516) test test2_partial_eq ... bench: 2,228,997 ns/iter (+/- 34,191) test test2_partial_ord ... bench: 1,731,699 ns/iter (+/- 21,756) test test_match_success ... bench: 1,509,630 ns/iter (+[- 3,765) ``` [Benchmark](https://gist.github.com/Marwes/7c0b3468d0cae972a2b4)
2015-06-16Remove superfluous variableSimonas Kazlauskas-2/+0