summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2015-07-22prototype Placer protocol for unstable overloaded-box and placement-in.Felix S. Klock II-0/+114
2015-07-22Hack for "unsafety hygiene" -- `push_unsafe!` and `pop_unsafe!`.Felix S. Klock II-2/+117
Even after expansion, the generated expressions still track depth of such pushes (i.e. how often you have "pushed" without a corresponding "pop"), and we add a rule that in a context with a positive `push_unsafe!` depth, it is effectively an `unsafe` block context. (This way, we can inject code that uses `unsafe` features, but still contains within it a sub-expression that should inherit the outer safety checking setting, outside of the injected code.) This is a total hack; it not only needs a feature-gate, but probably should be feature-gated forever (if possible). ignore-pretty in test/run-pass/pushpop-unsafe-okay.rs
2015-07-21Assign proper span to range expressionMarcus Klaas-4/+5
2015-07-21Avoid repeated trait bounds in derived implsFlorian Hartwig-0/+11
2015-07-21Auto merge of #26816 - nrc:zero-codemap, r=@jroeschbors-113/+141
See commits for details
2015-07-21Use a span from the correct file for the inner span of a moduleNick Cameron-13/+25
This basically only affects modules which are empty (or only contain comments). Closes #26755
2015-07-21Provide a filemap ctor with line infoNick Cameron-22/+19
2015-07-21Allow for space between each filemap in the codemapNick Cameron-78/+97
So if a filemap's last byte is at position n in the codemap, then n+1 will not refer to any filemap, and the next filemap will begin an n+2. This is useful for empty files, it means that every file (even empty ones) has a byte in the codemap. Closes #23301, #26504
2015-07-21Auto merge of #27153 - alexcrichton:flaky-tests, r=brsonbors-0/+5
This commit ensures that the rustc thread does not leak a panic message whenever a call to `fatal` happens. This already happens for the main rustc thread as part of the `rustc_driver::monitor` function, but the compiler also spawns threads for other operations like `-C codegen-units`, and sometimes errors are emitted on these threads as well. To ensure that there's a consistent error-handling experience across threads this unifies these two to never print the panic message in the case of a normal and expected fatal error. This should also fix the flaky `asm-src-loc-codegen-units.rs` test as the output is sometimes garbled if diagnostics are printed while the panic message is also being printed.
2015-07-20Auto merge of #27056 - Eljay:doc-comments, r=nikomatsakisbors-3/+15
Fixes #23812 by stripping the decoration when desugaring macro doc comments into #[doc] attributes, and detects whether the attribute should be inner or outer style and outputs the appropriate token tree.
2015-07-20syntax: Suppress panic message on `fatal`Alex Crichton-0/+5
This commit ensures that the rustc thread does not leak a panic message whenever a call to `fatal` happens. This already happens for the main rustc thread as part of the `rustc_driver::monitor` function, but the compiler also spawns threads for other operations like `-C codegen-units`, and sometimes errors are emitted on these threads as well. To ensure that there's a consistent error-handling experience across threads this unifies these two to never print the panic message in the case of a normal and expected fatal error. This should also fix the flaky `asm-src-loc-codegen-units.rs` test as the output is sometimes garbled if diagnostics are printed while the panic message is also being printed.
2015-07-20Auto merge of #27065 - marcusklaas:loop-label, r=nrcbors-19/+23
This closes https://github.com/rust-lang/rust/issues/27042. I'd love to know if there's a way to make a regression test for this!
2015-07-18Fix doc comment parsing in macros.Lee Jeffery-3/+15
2015-07-18Include label in the span of loopsMarcus Klaas-19/+23
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