about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2017-09-03implement improved on_unimplemented directivesAriel Ben-Yehuda-7/+18
2017-09-02Better trace-macro and less span_err_fatalbjorn3-2/+5
2017-09-02Dont abort on first macro errorbjorn3-1/+3
2017-09-01rustc: Separately feature gate repr(i128)Alex Crichton-0/+3
Brought up during the discussion of #35118, the support for this is still somewhat buggy and so stabilization likely wants to be considered independently of the type itself.
2017-09-01Fix arm visitorMatt Ickstadt-0/+1
2017-09-01Implement RFC 1925Matt Ickstadt-2/+24
2017-08-31Auto merge of #43425 - matklad:lambda-restrictions, r=eddybbors-1/+4
Lambda expressions honor no struct literal restriction This is a fix for #43412 if we decide that it is indeed a bug :) closes #43412
2017-08-30Make fields of `Span` privateVadim Petrochenkov-164/+135
2017-08-29Auto merge of #44111 - zackmdavis:feature_attr_error_span, r=nikomatsakisbors-23/+23
feature error span on attribute for fn_must_use, SIMD/align reprs, macro reëxport There were several feature-gated attributes for which the feature-not-available error spans would point to the item annotated with the gated attribute, when it would make more sense for the span to point to the attribute itself: if the attribute is removed, the function/struct/_&c._ likely still makes sense and the program will compile. (Note that we decline to make the analogous change for the `main`, `start`, and `plugin_registrar` features, for in those cases it makes sense for the span to implicate the entire function, of which there is little hope of using without the gated attribute.) ![feature_attr_error_span](https://user-images.githubusercontent.com/1076988/29746531-fd700bfe-8a91-11e7-9c5b-6f5324083887.png)
2017-08-28feature error span on attr. for fn_must_use, SIMD/align, macro reëxportZack M. Davis-23/+23
There were several feature-gated attributes for which the feature-not-available error spans would point to the item annotated with the gated attribute, when it would make more sense for the span to point to the attribute itself: if the attribute is removed, the function/struct/&c. likely still makes sense and the program will compile. (Note that we decline to make the analogous change for the `main`, `start`, and `plugin_registrar` features, for in those cases it makes sense for the span to implicate the entire function, of which there is little hope of using without the gated attribute.)
2017-08-28Merge branch 'master' of https://github.com/rust-lang/rust into genJohn Kåre Alsaker-28/+75
2017-08-27Fix errorbjorn3-1/+0
2017-08-26Rollup merge of #43776 - zackmdavis:feature_gate_fn_must_use, r=alexcrichtonCorey Farwell-13/+70
feature-gate #[must_use] for functions as `fn_must_use` @eddyb I [was](https://github.com/rust-lang/rust/pull/43728#issuecomment-320854120) [dithering](https://github.com/rust-lang/rust/pull/43728#issuecomment-320856407) on this, but [your comment](https://github.com/rust-lang/rust/issues/43302#issuecomment-321174989) makes it sound like we do want a feature gate for this? Please advise. r? @eddyb
2017-08-25*: remove crate_{name,type} attributesTamir Duberstein-3/+0
Fixes #41701.
2017-08-25syntax: clarify field nameTamir Duberstein-10/+5
The value of this field is meant to indicate whether or not the crate is rustc's libtest itself - not whether or not it is a test crate generally.
2017-08-25syntax: remove unused fieldTamir Duberstein-2/+0
2017-08-25Fix #43493 (new trace_macros doesn't work if there's an error during expansion)bjorn3-0/+13
2017-08-25Merge remote-tracking branch 'origin/master' into genAlex Crichton-1/+45
2017-08-22fn_must_use soft feature-gate warning on methods too, not only functionsZack M. Davis-1/+11
This continues to be in the matter of #43302.
2017-08-22"soft" (warn instead of error) feature-gate for #[must_use] on functionsZack M. Davis-10/+50
Before `#[must_use]` for functions was implemented, a `#[must_use]` attribute on a function was a no-op. To avoid a breaking change in this behavior, we add an option for "this-and-such feature is experimental" feature-gate messages to be a mere warning rather than a compilation-halting failure (so old code that used to have a useless no-op `#[must_use]` attribute now warns rather than breaking). When we're on stable, we add a help note to clarify that the feature isn't "on." This is in support of #43302.
2017-08-22correct comment re feature-checking toolingZack M. Davis-2/+2
The featureck.py that this comment referred to was removed in 9dd3c54a (March 2016).
2017-08-22hard feature-gate for #[must_use] on functionsZack M. Davis-1/+8
We'll actually want a new "soft" warning-only gate to maintain backwards-compatibility, but it's cleaner to start out with the established, well-understood gate before implementing the alternative warn-only behavior in a later commit. This is in the matter of #43302.
2017-08-22Ensure that generic arguments don't end up in attribute paths.Jeffrey Seyfried-1/+7
2017-08-21Merge remote-tracking branch 'origin/master' into genAlex Crichton-24/+19
2017-08-22Auto merge of #43854 - estebank:missing-cond, r=nikomatsakisbors-0/+38
Point out missing if conditional On a case where an else conditional is missing, point this out instead of the token immediately after the (incorrect) else block: ``` error: missing condition for `if` statemementt push fork -f --> $DIR/issue-13483.rs:16:5 | 13 | } else if { | ^ expected if condition here ``` instead of ``` error: expected `{`, found `else` --> ../../src/test/ui/issue-13483.rs:14:7 | 14 | } else { | ^^^^ ``` Fix #13483.
2017-08-21Auto merge of #43540 - petrochenkov:pathrelax, r=nikomatsakisbors-24/+19
syntax: Relax path grammar TLDR: Accept the disambiguator `::` in "type" paths (`Type::<Args>`), accept the disambiguator `::` before parenthesized generic arguments (`Fn::(Args)`). The "turbofish" disambiguator `::<>` in expression paths is a necessary evil required for path parsing to be both simple and to give reasonable results. Since paths in expressions usually refer to values (but not necessarily, e.g. `Struct::<u8> { field: 0 }` is disambiguated, but refers to a type), people often consider `::<>` to be inherent to *values*, and not *expressions* and want to write disambiguated paths for values even in contexts where disambiguation is not strictly necessary, for example when a path is passed to a macro `m!(Vec::<i32>::new)`. The problem is that currently, if the disambiguator is not *required*, then it's *prohibited*. This results in confusion - see https://github.com/rust-lang/rust/issues/41740, https://internals.rust-lang.org/t/macro-path-uses-novel-syntax/5561. This PR makes the disambiguator *optional* instead of prohibited in contexts where it's not strictly required, so people can pass paths to macros in whatever form they consider natural (e.g. disambiguated form for value paths). This PR also accepts the disambiguator in paths with parenthesized arguments (`Fn::(Args)`) for consistency and to simplify testing of stuff like https://github.com/rust-lang/rust/pull/41856#issuecomment-301219194. Closes https://github.com/rust-lang/rust/issues/41740 cc @rust-lang/lang r? @nikomatsakis
2017-08-21Merge remote-tracking branch 'origin/master' into genAlex Crichton-20/+13
2017-08-19Auto merge of #43933 - topecongiro:bad-span-for-attributes, r=petrochenkovbors-14/+9
Fix bad span for attributes Closes #42641.
2017-08-18Auto merge of #43904 - topecongiro:libsyntax/parse-attr, r=petrochenkovbors-6/+4
Eat open paren when parsing list in libsyntax/parse/attr.rs This PR adds a small refactoring: ```diff pub fn parse_meta_item_kind(&mut self) -> PResult<'a, ast::MetaItemKind> { Ok(if self.eat(&token::Eq) { ast::MetaItemKind::NameValue(self.parse_unsuffixed_lit()?) - } else if self.token == token::OpenDelim(token::Paren) { + } else if self.eat(&token::OpenDelim(token::Paren)) { ast::MetaItemKind::List(self.parse_meta_seq()?) } else { - self.eat(&token::OpenDelim(token::Paren)); ast::MetaItemKind::Word }) } ``` in `parse_meta_item_kind()`, the parser calls `self.eat(&token::OpenDelim(token::Paren));` before returning `ast::MetaItemKind::Word` just to add `(` to expected token. It seems more natural to eat the paren when parsing `ast::MetaItemKind::List`.
2017-08-17Verify that an `if` condition block returns a valueEsteban Küber-1/+32
2017-08-17Check for `else` keyword on missing `if` conditionEsteban Küber-16/+11
2017-08-17Merge remote-tracking branch 'origin/master' into genAlex Crichton-4/+3
2017-08-17Accept underscores in unicode escapesMalo Jaffré-47/+65
Fixes #43692.
2017-08-17Point out missing if conditionalEsteban Küber-4/+16
On a case where an else conditional is missing, point this out instead of the token immediately after the (incorrect) else block: ``` error: missing condition for `if` statemementt push fork -f --> $DIR/issue-13483.rs:16:5 | 13 | } else if { | ^ expected if condition here ``` instead of ``` error: expected `{`, found `else` --> ../../src/test/ui/issue-13483.rs:14:7 | 14 | } else { | ^^^^ ```
2017-08-17Rollup merge of #43891 - Fourchaux:master, r=steveklabnikCorey Farwell-1/+1
Fix typos & us spellings Fixing some typos and non en-US spellings. (Update of PR https://github.com/rust-lang/rust/pull/42812 )
2017-08-17Include the closing paren to the span of ast::NestedMetaItemSeiichi Uchida-11/+6
2017-08-17Use respan()Seiichi Uchida-3/+3
2017-08-16Stabilize rvalue promotion to 'static.Eduard-Mihai Burtescu-3/+2
2017-08-16Merge remote-tracking branch 'origin/master' into genAlex Crichton-238/+239
2017-08-16Eat open paren when parsing listSeiichi Uchida-6/+4
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-238/+239
Like #43008 (f668999), but _much more aggressive_.
2017-08-15Fix typos & us spellingsFourchaux-1/+1
2017-08-14Merge remote-tracking branch 'origin/master' into genAlex Crichton-28/+85
2017-08-13Rollup merge of #43822 - topecongiro:missing-span-let, r=petrochenkovGuillaume Gomez-1/+1
Include 'let' keyword to the span for ast::Local Currently the span for `ast::Local` does not the include the `let` keyword. This PR fixes it.
2017-08-13Rollup merge of #43814 - Eijebong:fix_typos2, r=petrochenkovGuillaume Gomez-5/+5
Fix some typos Follow up of #43794 If refined my script a little bit and found some more.
2017-08-13Rollup merge of #43782 - nrc:include, r=GuillaumeGomezGuillaume Gomez-5/+6
Fix include! in doc tests By making the path relative to the current file. Fixes #43153 [breaking-change] - if you use `include!` inside a doc test, you'll need to change the path to be relative to the current file rather than relative to the working directory.
2017-08-13Auto merge of #43348 - kennytm:fix-24658-doc-every-platform, r=alexcrichtonbors-0/+13
Expose all OS-specific modules in libstd doc. 1. Uses the special `--cfg dox` configuration passed by rustbuild when running `rustdoc`. Changes the `#[cfg(platform)]` into `#[cfg(any(dox, platform))]` so that platform-specific API are visible to rustdoc. 2. Since platform-specific implementations often won't compile correctly on other platforms, `rustdoc` is changed to apply `everybody_loops` to the functions during documentation and doc-test harness. 3. Since platform-specific code are documented on all platforms now, it could confuse users who found a useful API but is non-portable. Also, their examples will be doc-tested, so must be excluded when not testing on the native platform. An undocumented attribute `#[doc(cfg(...))]` is introduced to serve the above purposed. Fixes #24658 (Does _not_ fully implement #1998).
2017-08-12Fix some typosBastien Orivel-5/+5
2017-08-12Auto merge of #43746 - eddyb:sound-thread-local, r=alexcrichtonbors-15/+58
Check #[thread_local] statics correctly in the compiler. Fixes #43733 by introducing `#[allow_internal_unsafe]` analogous to `#[allow_internal_unstable]`, for letting a macro expand to `unsafe` blocks and functions even in `#![forbid(unsafe_code)]` crates. Fixes #17954 by not letting references to `#[thread_local]` statics escape the function they're taken in - we can't just use a magical lifetime because Rust has *lifetime parametrism*, so if we added the often-proposed `'thread` lifetime, we'd have no way to check it in generic code. To avoid potential edge cases in the compiler, the lifetime is actually that of a temporary at the same position, i.e. `&TLS_STATIC` has the same lifetime `&non_const_fn()` would. Referring to `#[thread_local]` `static`s at compile-time is banned now (as per PR discussion). Additionally, to remove `unsafe impl Sync` from `std::thread::local::fast::Key`, `#[thread_local]` statics are now not required to implement `Sync`, as they are not shared between threads.
2017-08-12Include 'let' keyword to the span for ast::Localtopecongiro-1/+1