about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
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
2017-08-12syntax: #[allow_internal_unsafe] bypasses the unsafe_code lint in macros.Eduard-Mihai Burtescu-15/+58
2017-08-12Auto merge of #43794 - Eijebong:fix_typos, r=lukaramu,steveklanik,imperiobors-2/+2
Fix some typos I wrote a really naive script and found those typos in the documentation.
2017-08-11Rollup merge of #43779 - mattico:fix-unicode-typo, r=aidanhsGuillaume Gomez-1/+1
Fix typo in unicode char definition Reference: http://www.fileformat.info/info/unicode/char/16ed/index.htm
2017-08-11Rollup merge of #43773 - ubsan:patch-1, r=eddybGuillaume Gomez-1/+1
fix a typo (this should not have been merged with this typo)
2017-08-11Rollup merge of #43712 - oli-obk:cfg, r=arielb1Guillaume Gomez-10/+10
Reexport all SyntaxExtension variants This was previously done very inconsistently and made matches look weird since some variants had the `SyntaxExtension::` prefix while others didn't.
2017-08-11Fix some typosBastien Orivel-2/+2
2017-08-10Auto merge of #43720 - pornel:staticconst, r=petrochenkovbors-10/+13
Hint correct extern constant syntax Error message for `extern "C" { const …}` is terse, and the right syntax is hard to guess given unfortunate difference between meaning of `static` in C and Rust. I've added a hint for the right syntax.
2017-08-10Reword error hintKornel-1/+2
2017-08-10Auto merge of #43582 - ivanbakel:unused_mut_ref, r=arielb1bors-3/+3
Fixed mutable vars being marked used when they weren't #### NB : bootstrapping is slow on my machine, even with `keep-stage` - fixes for occurances in the current codebase are <s>in the pipeline</s> done. This PR is being put up for review of the fix of the issue. Fixes #43526, Fixes #30280, Fixes #25049 ### Issue Whenever the compiler detected a mutable deref being used mutably, it marked an associated value as being used mutably as well. In the case of derefencing local variables which were mutable references, this incorrectly marked the reference itself being used mutably, instead of its contents - with the consequence of making the following code emit no warnings ``` fn do_thing<T>(mut arg : &mut T) { ... // don't touch arg - just deref it to access the T } ``` ### Fix Make dereferences not be counted as a mutable use, but only when they're on borrows on local variables. #### Why not on things other than local variables? * Whenever you capture a variable in a closure, it gets turned into a hidden reference - when you use it in the closure, it gets dereferenced. If the closure uses the variable mutably, that is actually a mutable use of the thing being dereffed to, so it has to be counted. * If you deref a mutable `Box` to access the contents mutably, you are using the `Box` mutably - so it has to be counted.
2017-08-10Some tidying up around include!Nick Cameron-5/+6
2017-08-10Implemented #[doc(cfg(...))].kennytm-0/+13
This attribute has two effects: 1. Items with this attribute and their children will have the "This is supported on **** only" message attached in the documentation. 2. The items' doc tests will be skipped if the configuration does not match.
2017-08-10Auto merge of #43735 - est31:master, r=alexcrichtonbors-0/+10
Avoid calling the column!() macro in panic Closes #43057 This "fix" adds a new macro called `__rust_unstable_column` and to use it instead of the `column` macro inside panic. The new macro can be shadowed as well as `column` can, but its very likely that there is no code that does this in practice. There is no real way to make "unstable" macros that are usable by stable macros, so we do the next best thing and prefix the macro with `__rust_unstable` to make sure people recognize it is unstable. r? @alexcrichton
2017-08-10Add a feature gateest31-0/+10
@alexcrichton figured out a way how to do it :)
2017-08-09Fix typo in unicode char definitionMatt Ickstadt-1/+1
2017-08-10Better diagnostics and recovery for `const` in extern blocksVadim Petrochenkov-12/+12
2017-08-09fix a typonicole mazzuca-1/+1
(this should not have been merged with this typo)
2017-08-09extended information for E0557 feature has been removedZack M. Davis-1/+12
2017-08-09extended information for E0552 unrecognized representation hintZack M. Davis-1/+30
2017-08-09extended information for E0554 feature attributes only work on nightliesZack M. Davis-2/+16
It's more pleasing to use the inner-attribute syntax (`#!` rather than `#`) in the error message, as that is how `feature` attributes in particular will be declared (as they apply to the entire crate).
2017-08-08Auto merge of #43698 - MaloJaffre:confusables, r=eddybbors-19/+125
Update the list of confusable characters Also reorder and space the list to make it clearer for futures updates and to come closer to the original list. This was tedious but somewhat rewarding! Thanks @est31 for the instructions. Fixes #43629. r? @est31
2017-08-07Hint correct extern constant syntaxKornel-1/+3
2017-08-07Reexport all SyntaxExtension variantsOliver Schneider-10/+10
2017-08-06fixing doctest failures in resurfaced extended informationZack M. Davis-10/+22
After repatriating error explanations to the global registry, some lurking doctest failures surfaced and needed to be chased down. Sadly, a few doctests needed to be ignored due to a not-yet-understood regression in the doctest `compile_fail` functionality (filed #43707).
2017-08-06de-orphan extended informationZack M. Davis-1/+1
Bizarrely, librustc_passes, librustc_plugin, librustc_mir, and libsyntax weren't getting their error explanations registered. Resolves #35284.
2017-08-06Fix typo in unicode_chars.rsMalo Jaffré-1/+1
2017-08-06Update the list of confusable charactersMalo Jaffré-19/+125
Also reorder and space the list to make it clearer for futures updates and to come closer to the original list. Thanks @est31 for the instructions. Fixes #43629. r? @est31
2017-08-02Auto merge of #43584 - arielb1:unused-reads, r=eddybbors-2/+3
Fix quadratic performance with lots of use statements This fixes 2 problems that caused quadratic performance when lots of use-statements were present. After this patch, performance is linear (and very fast) even with 1M uses. Fixes #43572. Fixes #43573. r? @eddyb
2017-08-01Fixed all unnecessary muts in language coreIsaac van Bakel-3/+3
2017-08-01syntax: avoid loading the same source-file multiple timesAriel Ben-Yehuda-2/+3
We already had a cache for file contents, but we read the source-file before testing the cache, causing obvious slowness, so this just avoids loading the source-file when the cache already has the contents.
2017-07-30default binding modes: add pat_binding_modesTobias Schottdorf-7/+8
This PR kicks off the implementation of the [default binding modes RFC][1] by introducing the `pat_binding_modes` typeck table mentioned in the [mentoring instructions][2]. `pat_binding_modes` is populated in `librustc_typeck/check/_match.rs` and used wherever the HIR would be scraped prior to this PR. Unfortunately, one blemish, namely a two callers to `contains_explicit_ref_binding`, remains. This will likely have to be removed when the second part of [1], the `pat_adjustments` table, is tackled. Appropriate comments have been added. See #42640. [1]: https://github.com/rust-lang/rfcs/pull/2005 [2]: https://github.com/rust-lang/rust/issues/42640#issuecomment-313535089
2017-07-30Auto merge of #43551 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-2/+12
Rollup of 8 pull requests - Successful merges: #43409, #43501, #43509, #43512, #43513, #43536, #43544, #43549 - Failed merges:
2017-07-29Rollup merge of #43501 - topecongiro:span-to-whereclause, r=nrcMark Simulacrum-2/+12
Add Span to ast::WhereClause This PR adds `Span` field to `ast::WhereClause`. The motivation here is to make rustfmt's life easier when recovering comments before and after where clause. r? @nrc
2017-07-29Auto merge of #43009 - GuillaumeGomez:unused-doc-comments, r=nrcbors-5/+11
Throw errors when doc comments are added where they're unused #42617
2017-07-28syntax: Capture a `TokenStream` when parsing itemsAlex Crichton-11/+150
This is then later used by `proc_macro` to generate a new `proc_macro::TokenTree` which preserves span information. Unfortunately this isn't a bullet-proof approach as it doesn't handle the case when there's still other attributes on the item, especially inner attributes. Despite this the intention here is to solve the primary use case for procedural attributes, attached to functions as outer attributes, likely bare. In this situation we should be able to now yield a lossless stream of tokens to preserve span information.
2017-07-29Add Span to ast::WhereClausetopecongiro-2/+12
2017-07-28syntax: Add `tokens: Option<TokenStream>` to ItemAlex Crichton-9/+33
This commit adds a new field to the `Item` AST node in libsyntax to optionally contain the original token stream that the item itself was parsed from. This is currently `None` everywhere but is intended for use later with procedural macros.
2017-07-28Auto merge of #43432 - pczarn:macro-parser-description, r=jseyfriedbors-100/+102
Make the macro parser theory description more accurate The macro parser is described as an NFA, not an Earley parser.
2017-07-27Avoid duplicated errors for generic arguments in macro pathsVadim Petrochenkov-1/+1
2017-07-27Give span to angle bracketed generic argumentsVadim Petrochenkov-26/+18
2017-07-27Discern between `Path` and `Path<>` in ASTVadim Petrochenkov-20/+14
2017-07-27Simplify parsing of pathsVadim Petrochenkov-249/+143
2017-07-27Make a lint insteadGuillaume Gomez-32/+7
2017-07-27Throw errors when doc comments are added where they're unusedGuillaume Gomez-5/+36