about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2018-04-19add EDITIONS_NAME_LIST, make edition tracked, enforce that only stable ↵Kurtis Nusbaum-1/+11
editions are allowed to be used on non-nightly builds
2018-04-19rustc: Blanket whitelist `#[target_feature]`Alex Crichton-1/+1
This commit transitions the `target_feature` attribute from `Normal` to `Whitelisted`. Discovered in #50095 the fact of whether this attribute is used or not is dependent on typechecking running and executing `check_name`, but incremental compilation doesn't currently account for this, meaning that the attribute ends up being flagged as unused when it shouldn't be. I was a little too ambitious it seems hoping that `Normal` could be used, so instead this transitions to `Whitelisted` to be the same as other codegen attributes like `#[inline]` Closes #50095
2018-04-19add --edition optionKurtis Nusbaum-6/+2
2018-04-18proc_macro: Stay on the "use the cache" path moreAlex Crichton-9/+125
Discovered in #50061 we're falling off the "happy path" of using a stringified token stream more often than we should. This was due to the fact that a user-written token like `0xf` is equality-different from the stringified token of `15` (despite being semantically equivalent). This patch updates the call to `eq_unspanned` with an even more awful solution, `probably_equal_for_proc_macro`, which ignores the value of each token and basically only compares the structure of the token stream, assuming that the AST doesn't change just one token at a time. While this is a step towards fixing #50061 there is still one regression from #49154 which needs to be fixed.
2018-04-19Avoid allocating when parsing \u{...} literals.Nicholas Nethercote-2/+10
`char_lit` uses an allocation in order to ignore '_' chars in \u{...} literals. This patch changes it to not do that by processing the chars more directly. This improves various rustc-perf benchmark measurements by up to 6%, particularly regex, futures, clap, coercions, hyper, and encoding.
2018-04-18Auto merge of #50006 - rcoh:reorder-compiler-builtins, r=oli-obkbors-1/+2
Reorder injection of std to get better compilation error Per #49851, reorder injection imports to get a better error message. r? @oli-obk
2018-04-18Auto merge of #49993 - nnethercote:shrink-Token, r=alexcrichtonbors-11/+16
Change the hashcounts in raw `Lit` variants from usize to u16. This reduces the size of `Token` from 32 bytes to 24 bytes on 64-bit platforms.
2018-04-17Auto merge of #49664 - alexcrichton:stable-simd, r=BurntSushibors-11/+16
Stabilize x86/x86_64 SIMD This commit stabilizes the SIMD in Rust for the x86/x86_64 platforms. Notably this commit is stabilizing: * The `std::arch::{x86, x86_64}` modules and the intrinsics contained inside. * The `is_x86_feature_detected!` macro in the standard library * The `#[target_feature(enable = "...")]` attribute * The `#[cfg(target_feature = "...")]` matcher Stabilization of the module and intrinsics were primarily done in rust-lang-nursery/stdsimd#414 and the two attribute stabilizations are done in this commit. The standard library is also tweaked a bit with the new way that stdsimd is integrated. Note that other architectures like `std::arch::arm` are not stabilized as part of this commit, they will likely stabilize in the future after they've been implemented and fleshed out. Similarly the `std::simd` module is also not being stabilized in this commit, only `std::arch`. Finally, nothing related to `__m64` is stabilized in this commit either (MMX), only SSE and up types and intrinsics are stabilized. Closes #29717 Closes #44839 Closes #48556
2018-04-16Separately gate each target_feature featureAlex Crichton-0/+11
Use an explicit whitelist for what features are actually stable and can be enabled.
2018-04-16Reorder injection of std to get better compilation errorRussell Cohen-1/+2
2018-04-17Remove `underscore_lifetimes` and `match_default_bindings` from active ↵kennytm-6/+0
feature list These are already stabilized in 1.26.
2018-04-16Stabilize x86/x86_64 SIMDAlex Crichton-11/+5
This commit stabilizes the SIMD in Rust for the x86/x86_64 platforms. Notably this commit is stabilizing: * The `std::arch::{x86, x86_64}` modules and the intrinsics contained inside. * The `is_x86_feature_detected!` macro in the standard library * The `#[target_feature(enable = "...")]` attribute * The `#[cfg(target_feature = "...")]` matcher Stabilization of the module and intrinsics were primarily done in rust-lang-nursery/stdsimd#414 and the two attribute stabilizations are done in this commit. The standard library is also tweaked a bit with the new way that stdsimd is integrated. Note that other architectures like `std::arch::arm` are not stabilized as part of this commit, they will likely stabilize in the future after they've been implemented and fleshed out. Similarly the `std::simd` module is also not being stabilized in this commit, only `std::arch`. Finally, nothing related to `__m64` is stabilized in this commit either (MMX), only SSE and up types and intrinsics are stabilized. Closes #29717 Closes #44839 Closes #48556
2018-04-16Auto merge of #49719 - mark-i-m:no_sep, r=petrochenkovbors-67/+22
Update `?` repetition disambiguation. **Do not merge** (yet) This is a test implementation of some ideas from discussion in https://github.com/rust-lang/rust/issues/48075 . This PR - disallows `?` repetition from taking a separator, since the separator is never used. - disallows the use of `?` as a separator. This allows patterns like `$(a)?+` to match `+` and `a+` rather than `a?a?a`. This is a _breaking change_, but maybe that's ok? Perhaps a crater run is the right approach? cc @durka @alexreg @nikomatsakis
2018-04-15don't see issue #0Zack M. Davis-4/+3
The unstable-feature attribute requires an issue (neglecting it is E0547), which gets used in the error messages. Unfortunately, there are some cases where "0" is apparently used a placeholder where no issue exists, directing the user to see the (nonexistent) issue #0. (It would have been better to either let `issue` be optional—compare to how issue is an `Option<u32>` in the feature-gate declarations in libsyntax/feature-gate.rs—or actually require that an issue be created.) Rather than endeavoring to change how `#[unstable]` works at this time (given competing contributor and reviewer priorities), this simple patch proposes the less-ambitious solution of just not adding the "(see issue)" note when the number is zero. Resolves #49983.
2018-04-15Auto merge of #48173 - GuillaumeGomez:error-codes-libsyntax_ext, r=estebankbors-1/+4
Add error codes for libsyntax_ext I intend to add error codes for `libsyntax_ext` as well. However, they cannot be used at stage 0 directly so I thought it might be possible to enable them at the stage 1 only so we can have access to the macros. However, the error code registration seems to not work this way. Currently I get the following error: ``` error: used diagnostic code E0660 not registered --> libsyntax_ext/asm.rs:93:25 | 93 | span_err!(cx, sp, E0660, "malformed inline assembly"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: used diagnostic code E0661 not registered --> libsyntax_ext/asm.rs:151:33 | 151 | / span_err!(cx, sp, E0661, 152 | | "output operand constraint lacks '=' or '+'"); | |________________________________________________________________________________________^ | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to 2 previous errors error: Could not compile `syntax_ext`. ``` If anyone has an idea, I'd gladly take it. I'm trying to figure this out on my side as well. I also opened this PR to know if it was worth it to continue (maybe we don't want this?). Anyway, any answer for both questions is very welcome! cc @rust-lang/compiler
2018-04-14Add error codes for libsyntax_extGuillaume Gomez-1/+4
2018-04-14Rollup merge of #49852 - alexcrichton:fix-more-proc-macros, r=nrckennytm-12/+27
proc_macro: Avoid cached TokenStream more often This commit adds even more pessimization to use the cached `TokenStream` inside of an AST node. As a reminder the `proc_macro` API requires taking an arbitrary AST node and transforming it back into a `TokenStream` to hand off to a procedural macro. Such functionality isn't actually implemented in rustc today, so the way `proc_macro` works today is that it stringifies an AST node and then reparses for a list of tokens. This strategy unfortunately loses all span information, so we try to avoid it whenever possible. Implemented in #43230 some AST nodes have a `TokenStream` cache representing the tokens they were originally parsed from. This `TokenStream` cache, however, has turned out to not always reflect the current state of the item when it's being tokenized. For example `#[cfg]` processing or macro expansion could modify the state of an item. Consequently we've seen a number of bugs (#48644 and #49846) related to using this stale cache. This commit tweaks the usage of the cached `TokenStream` to compare it to our lossy stringification of the token stream. If the tokens that make up the cache and the stringified token stream are the same then we return the cached version (which has correct span information). If they differ, however, then we will return the stringified version as the cache has been invalidated and we just haven't figured that out. Closes #48644 Closes #49846
2018-04-14macros: Do not match on "complex" nonterminals requiring AST comparisonsVadim Petrochenkov-1/+17
2018-04-13Auto merge of #49718 - petrochenkov:fieldcmp, r=eddybbors-59/+9
Hygiene 2.0: Avoid comparing fields by name There are two separate commits here (not counting tests): - The first one unifies named (`obj.name`) and numeric (`obj.0`) field access expressions in AST and HIR. Before field references in these expressions are resolved it doesn't matter whether the field is named or numeric (it's just a symbol) and 99% of code is common. After field references are resolved we work with them by index for all fields (see the second commit), so it's again not important whether the field was named or numeric (this includes MIR where all fields were already by index). (This refactoring actually fixed some bugs in HIR-based borrow checker where borrows through names (`S { 0: ref x }`) and indices (`&s.0`) weren't considered overlapping.) - The second commit removes all by-name field comparison and instead resolves field references to their indices once, and then uses those resolutions. (There are still a few name comparisons in save-analysis, because save-analysis is weird, but they are made correctly hygienic). Thus we are fixing a bunch of "secondary" field hygiene bugs (in borrow checker, lints). Fixes https://github.com/rust-lang/rust/issues/46314
2018-04-12Avoid comparing fields by name when possibleVadim Petrochenkov-5/+4
Resolve them into field indices once and then use those resolutions + Fix rebase
2018-04-12AST/HIR: Merge field access expressions for named and numeric fieldsVadim Petrochenkov-58/+9
2018-04-12Implement inferring outlives requirements for references, structs, enum, ↵toidiu-0/+9
union, and projection types. added a feature gate and tests for these scenarios.
2018-04-12Change the hashcounts in raw `Lit` variants from usize to u16.Nicholas Nethercote-11/+16
This reduces the size of `Token` from 32 bytes to 24 bytes on 64-bit platforms.
2018-04-12Auto merge of #48528 - bitshifter:repr_packed, r=eddybbors-20/+45
Implementation of `#[repr(packed(n))]` RFC 1399. Tracking issue https://github.com/rust-lang/rust/issues/33158.
2018-04-12Auto merge of #49698 - SimonSapin:unicode-for-everyone, r=alexcrichtonbors-3/+3
Merge the std_unicode crate into the core crate [The standard library facade](https://github.com/rust-lang/rust/issues/27783) has historically contained a number of crates with different roles, but that number has decreased over time. `rand` and `libc` have moved to crates.io, and [`collections` was merged into `alloc`](https://github.com/rust-lang/rust/pull/42648). Today we have `core` that applies everywhere, `std` that expects a full operating system, and `alloc` in-between that only requires a memory allocator (which can be provided by users)… and `std_unicode`, which doesn’t really have a reason to be separate anymore. It contains functionality based on Unicode data tables that can be large, but as long as relevant functions are not called the tables should be removed from binaries by linkers. This deprecates the unstable `std_unicode` crate and moves all of its contents into `core`, replacing them with `pub use` reexports. The crate can be removed later. This also removes the `CharExt` trait (replaced with inherent methods in libcore) and `UnicodeStr` trait (merged into `StrExt`). There traits were both unstable and not intended to be used or named directly. A number of new items are newly-available in libcore and instantly stable there, but only if they were already stable in libstd. Fixes #49319.
2018-04-12Mark the rest of the `unicode` feature flag as perma-unstable.Simon Sapin-1/+1
2018-04-12Deprecate the std_unicode crateSimon Sapin-2/+2
2018-04-11Implementation of `#[repr(packed(n))]` RFC 1399.Cameron Hart-20/+45
2018-04-11Rollup merge of #49525 - varkor:sort_by_cached_key-conversion, r=scottmcmkennytm-1/+2
Use sort_by_cached_key where appropriate A follow-up to https://github.com/rust-lang/rust/pull/48639, converting various slice sorting calls to `sort_by_cached_key` when the key functions are more expensive.
2018-04-11Auto merge of #49715 - Mark-Simulacrum:deny-warnings, r=alexcrichtonbors-1/+0
Move deny(warnings) into rustbuild This permits easier iteration without having to worry about warnings being denied. Fixes #49517
2018-04-10proc_macro: Avoid cached TokenStream more oftenAlex Crichton-12/+27
This commit adds even more pessimization to use the cached `TokenStream` inside of an AST node. As a reminder the `proc_macro` API requires taking an arbitrary AST node and transforming it back into a `TokenStream` to hand off to a procedural macro. Such functionality isn't actually implemented in rustc today, so the way `proc_macro` works today is that it stringifies an AST node and then reparses for a list of tokens. This strategy unfortunately loses all span information, so we try to avoid it whenever possible. Implemented in #43230 some AST nodes have a `TokenStream` cache representing the tokens they were originally parsed from. This `TokenStream` cache, however, has turned out to not always reflect the current state of the item when it's being tokenized. For example `#[cfg]` processing or macro expansion could modify the state of an item. Consequently we've seen a number of bugs (#48644 and #49846) related to using this stale cache. This commit tweaks the usage of the cached `TokenStream` to compare it to our lossy stringification of the token stream. If the tokens that make up the cache and the stringified token stream are the same then we return the cached version (which has correct span information). If they differ, however, then we will return the stringified version as the cache has been invalidated and we just haven't figured that out. Closes #48644 Closes #49846
2018-04-10Auto merge of #49390 - Zoxc:sync-syntax, r=michaelwoeristerbors-38/+31
More thread-safety changes r? @michaelwoerister
2018-04-09in which `!` is suggested for erroneous identifier `not`Zack M. Davis-2/+52
Impressing confused Python users with magical diagnostics is perhaps worth this not-grossly-unreasonable (only 40ish lines) extra complexity in the parser? Thanks to Vadim Petrochenkov for guidance. This resolves #46836.
2018-04-09don't suggest placing code in block if next token is open-braceZack M. Davis-0/+5
Thanks to the inestimably inimitable Esteban "Estebank" Küber for pointing this out. This is relevant to #46836.
2018-04-09Convert sort_by to sort_by_cached_keyvarkor-1/+2
2018-04-09Auto merge of #49673 - ollie27:stab, r=sfacklerbors-1/+1
Correct a few stability attributes * `const_indexing` language feature was stabilized in 1.26.0 by #46882 * `Display` impls for `PanicInfo` and `Location` were stabilized in 1.26.0 by #47687 * `TrustedLen` is still unstable so its impls should be as well even though `RangeInclusive` was stabilized by #47813 * `!Send` and `!Sync` for `Args` and `ArgsOs` were stabilized in 1.26.0 by #48005 * `EscapeDefault` has been stable since 1.0.0 so should continue to show that even though it was moved to core in #48735 This could be backported to beta like #49612
2018-04-08Move deny(warnings) into rustbuildMark Simulacrum-1/+0
This permits easier iteration without having to worry about warnings being denied. Fixes #49517
2018-04-07Auto merge of #49661 - alexcrichton:bump-bootstrap, r=nikomatsakisbors-2/+0
Bump the bootstrap compiler to 1.26.0 beta Holy cow that's a lot of `cfg(stage0)` removed and a lot of new stable language features!
2018-04-07Inject the `compiler_builtins` crate whenever the `core` crate is injectedOliver Schneider-16/+27
2018-04-06Fix feature gating for crate/extern in pathsVadim Petrochenkov-2/+10
2018-04-06Use `Ident` instead of `Name` in `MetaItem`Vadim Petrochenkov-96/+77
2018-04-06Make lifetime nonterminals closer to identifier nonterminalsVadim Petrochenkov-47/+47
2018-04-06Remove more duplicated spansVadim Petrochenkov-97/+79
2018-04-06Rename `ast::Variant_::name` into `ident` + Fix rebaseVadim Petrochenkov-18/+14
2018-04-06Use `Span::apply_mark` where possibleVadim Petrochenkov-5/+5
2018-04-06Get rid of `SpannedIdent`Vadim Petrochenkov-117/+95
2018-04-06Rename `PathSegment::identifier` to `ident`Vadim Petrochenkov-44/+40
2018-04-06Use `Span` instead of `SyntaxContext` in `Ident`Vadim Petrochenkov-15/+12
2018-04-05No separator for `?`. No `?` as a separator.Mark Mansi-67/+22
2018-04-05Rollup merge of #49350 - abonander:macros-in-extern, r=petrochenkovAlex Crichton-58/+209
Expand macros in `extern {}` blocks This permits macro and proc-macro and attribute invocations (the latter only with the `proc_macro` feature of course) in `extern {}` blocks, gated behind a new `macros_in_extern` feature. A tracking issue is now open at #49476 closes #48747