about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2015-08-04Extend macro machinery to expand macros in typesJared Roesch-0/+58
Reapplied the changes from https://github.com/freebroccolo/rust/commit/7aafe24139abc2d1f302bbb166bcaa006f12cf4d to a clean branch of master
2015-08-04Make parser recognize macro invocations in typesJared Roesch-2/+15
Reapplied the changes from https://github.com/freebroccolo/rust/commit/8b07abaa6e8ab42d37656dfad89de0eb5810c3b3 to a clean branch of master
2015-08-04Add a macro invocation to the type ASTJared Roesch-0/+11
Reapplied the changes from https://github.com/freebroccolo/rust/commit/dc64b731d7f66c2b43d5e5e8c721be7bd3b59540 to a clean branch of master
2015-08-04syntax: Don't assume `std` exists for testsAlex Crichton-14/+9
This commit removes the injection of `std::env::args()` from `--test` expanded code, relying on the test runner itself to call this funciton. This is more hygienic because we can't assume that `std` exists at the top layer all the time, and it meaks the injected test module entirely self contained.
2015-08-03syntax: Implement #![no_core]Alex Crichton-206/+107
This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The `#![no_std]` attribute now injects `extern crate core` at the top of the crate as well as the libcore prelude into all modules (in the same manner as the standard library's prelude). The `#![no_core]` attribute disables both std and core injection. [rfc]: https://github.com/rust-lang/rfcs/pull/1184
2015-08-03Auto merge of #27134 - fhartwig:derive, r=huonwbors-0/+11
Fixes #25022 This adapts the deriving mechanism to not repeat bounds for the same type parameter. To give an example: for the following code: ```rust #[derive(Clone)] pub struct FlatMap<I, U: IntoIterator, F> { iter: I, f: F, frontiter: Option<U::IntoIter>, backiter: Option<U::IntoIter>, } ``` the latest nightly generates the following impl signature: ```rust impl <I: ::std::clone::Clone, U: ::std::clone::Clone + IntoIterator, F: ::std::clone::Clone> ::std::clone::Clone for FlatMap<I, U, F> where I: ::std::clone::Clone, F: ::std::clone::Clone, U::IntoIter: ::std::clone::Clone, U::IntoIter: ::std::clone::Clone ``` With these changes, the signature changes to this: ```rust impl <I, U: IntoIterator, F> ::std::clone::Clone for FlatMap<I, U, F> where I: ::std::clone::Clone, F: ::std::clone::Clone, U::IntoIter: ::std::clone::Clone ``` (Nothing in the body of the impl changes) Note that the second impl is more permissive, as it doesn't have a `Clone` bound on `U` at all. There was a compile-fail test that failed due to this. I don't understand why we would want the old behaviour (and nobody on IRC could tell me either), so please tell me if there is a good reason that I missed.
2015-08-01Auto merge of #27447 - eefriedman:parser-cleanup, r=alexcrichtonbors-31/+0
2015-07-31Auto merge of #27432 - sanxiyn:impl-dotdot, r=sfacklerbors-1/+1
Fix #27255.
2015-07-31Fix `impl A .. {}`Seo Sanghyeon-1/+1
2015-07-30Remove unused code in parser.Eli Friedman-31/+0
2015-07-29Feature gate associated type defaultsBrian Anderson-1/+8
There are multiple issues with them as designed and implemented. cc #27364
2015-07-29FormattingBrian Anderson-1/+2
2015-07-29Rollup merge of #27313 - nagisa:illegal-to-invalid, r=pnkfelixSteve Klabnik-17/+17
Improves diagnostics in various locations, namely: * A few error messages that orignally were a mix of an error message and suggestion how to fix it have been split up into two messages: an error and help/hint. * Never report “illegal”. Fixes https://github.com/rust-lang/rust/issues/27288
2015-07-29Auto merge of #26846 - P1start:print-maybe-styled-macro, r=pnkfelixbors-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. It’s also rebased on #26838’s branch because otherwise pretty much all of the changes in this PR would conflict with the other PR’s changes.
2015-07-29Replace illegal with invalid in most diagnosticsSimonas Kazlauskas-17/+17
2015-07-28Auto merge of #27234 - oli-obk:move_get_name_get_ident_to_impl, r=eddybbors-192/+164
this has quite some fallout. but also made lots of stuff more readable imo [breaking-change] for plugin authors
2015-07-28remove `get_ident` and `get_name`, make `as_str` soundOliver Schneider-192/+164
2015-07-27Turn on `box(PLACE) expr` deprecation warning post-snapshot.Eduard Burtescu-11/+7
2015-07-26Auto merge of #27297 - mitaa:cleanup_E0005, r=alexcrichtonbors-18/+3
This does two things: * removes ast::LocalSource, where only one variant was used because for-loop expansion has changed. One reason that this slipped into here is because the code in `check_local` which checks for `LocalSource::LocalFor` would report the same error as in `check_exhaustive` while using the wrong error code (E0005 instead of E0297). * silences the warning about already used diagnostic code E0005 (fixes #27279) passes `make check` locally.
2015-07-26Remove `ast::LocalSource` with only one used variantmitaa-18/+3
`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-07-25Add omitted trailing commaJared Roesch-1/+1
2015-07-25Add feature gateJared Roesch-2/+7
2015-07-25Auto merge of #26630 - eefriedman:recursive-static, r=pnkfelixbors-0/+6
***Edit: Fixed now.*** I'm pretty sure the way I'm using LLVMReplaceAllUsesWith here is unsafe... but before I figure out how to fix that, I'd like a reality-check: is this actually useful?
2015-07-25Auto merge of #27253 - bossmc:unbalanced-delimiters-cause-ice, r=nikomatsakisbors-2/+2
This introduces a test for #23389 and improves the error behaviour to treat the malformed LHS as an error, not a compiler bug. The parse phase that precedes the call to `check_lhs_nt_follows` could possibly be enhanced to police the format itself (which the old code suggests was the original intention), but I'm not sure that's any nicer than just parsing the matcher as generic rust code and then policing the specific requirements for being a macro matcher afterwards (as this does). Fixes #23389
2015-07-24Add static_recursion feature gate.Eli Friedman-0/+6
2015-07-24Auto merge of #27215 - pnkfelix:fsk-placer-take-5-just-in, r=nikomatsakisbors-12/+371
Macro desugaring of `in PLACE { BLOCK }` into "simpler" expressions following the in-development "Placer" protocol. Includes Placer API that one can override to integrate support for `in` into one's own type. (See [RFC 809].) [RFC 809]: https://github.com/rust-lang/rfcs/blob/master/text/0809-box-and-in-for-stdlib.md Part of #22181 Replaced PR #26180. Turns on the `in PLACE { BLOCK }` syntax, while leaving in support for the old `box (PLACE) EXPR` syntax (since we need to support that at least until we have a snapshot with support for `in PLACE { BLOCK }`. (Note that we are not 100% committed to the `in PLACE { BLOCK }` syntax. In particular I still want to play around with some other alternatives. Still, I want to get the fundamental framework for the protocol landed so we can play with implementing it for non `Box` types.) ---- Also, this PR leaves out support for desugaring-based `box EXPR`. We will hopefully land that in the future, but for the short term there are type-inference issues injected by that change that we want to resolve separately.
2015-07-24Make ICE an error and use a sensible error messageAndy Caldwell-2/+2
2015-07-23review feedback: common-subexpression-elim across functions in pushpop_safe ↵Felix S. Klock II-4/+4
impl.
2015-07-23add `#[allow(unused_qualifications)]` to derived implsAndrew Paseltiner-1/+7
closes #19102
2015-07-23Auto merge of #27203 - marcusklaas:fix-range-span, r=alexcrichtonbors-4/+5
Right trims the span for certain range expressions. Closes https://github.com/rust-lang/rust/issues/27162.
2015-07-22placate `make tidy`.Felix S. Klock II-3/+9
2015-07-22Added support for parsing `in PLACE { BLOCK_CONTENT }`.Felix S. Klock II-8/+33
2015-07-22Instrumentation in effort to understand treatment of `allow_internal_unstable`.Felix S. Klock II-0/+4
It is all `debug!` instrumentation so it should not impose a cost on non-debug builds.
2015-07-22Allow unstable code to be injected by placement-`in` expansion.Felix S. Klock II-3/+23
(Over time the stability checking has gotten more finicky; in particular one must attach the (whole) span of the original `in PLACE BLOCK` expression to the injected references to unstable paths, as noted in the comments.) call `push_compiler_expansion` during the placement-`in` expansion.
2015-07-22Add feature-gates for desugaring-based `box` and placement-`in`.Felix S. Klock II-1/+63
update test/compile-fail/feature-gate-box-expr.rs to reflect new feature gates. Part of what lands with Issue 22181.
2015-07-22Revise placement-in expansion to use `push/pop_unsafe` and `move_val_init`.Felix S. Klock II-24/+37
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