about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2020-01-23unused-parens: implement for block return valuesTyler Lanphear-5/+1
2020-01-22Rollup merge of #68441 - Centril:pprust-as_deref, r=Mark-SimulacrumTyler Mandry-2/+2
pprust: use as_deref Some drive-by cleanup.
2020-01-22pprust: use as_derefMazdak Farrokhzad-2/+2
2020-01-21Rollup merge of #68140 - ecstatic-morse:const-trait-bound-opt-out, r=oli-obkMazdak Farrokhzad-22/+32
Implement `?const` opt-out for trait bounds For now, such bounds are treated exactly the same as unprefixed ones in all contexts. [RFC 2632](https://github.com/rust-lang/rfcs/pull/2632) does not specify whether such bounds are forbidden outside of `const` contexts, so they are allowed at the moment. Prior to this PR, the constness of a trait bound/impl was stored in `TraitRef`. Now, the constness of an `impl` is stored in `ast::ItemKind::Impl` and the constness of a bound in `ast::TraitBoundModifer`. Additionally, constness of trait bounds is now stored in an additional field of `ty::Predicate::Trait`, and the combination of the constness of the item along with any `TraitBoundModifier` determines the constness of the bound in accordance with the RFC. Encoding the constness of impls at the `ty` level is left for a later PR. After a discussion in \#wg-grammar on Discord, it was decided that the grammar should not encode the mutual exclusivity of trait bound modifiers. The grammar for trait bound modifiers remains `[?const] [?]`. To encode this, I add a dummy variant to `ast::TraitBoundModifier` that is used when the syntax `?const ?` appears. This variant causes an error in AST validation and disappears during HIR lowering. cc #67794 r? @oli-obk
2020-01-20Parse `?const ?Trait`Dylan MacKenzie-0/+5
2020-01-20Add `constness` field to `ty::Predicate::Trait`Dylan MacKenzie-1/+2
2020-01-20Revert "Add a `constness` field to `ast::TraitRef`"Dylan MacKenzie-19/+4
This reverts commit fd4a6a12136c5b5d6bce4081e95890df1fd1febd.
2020-01-20Add `MaybeConst` variant to `{ast,hir}::TraitBoundModifier`Dylan MacKenzie-2/+9
2020-01-19Add `constness` field to `ast::ItemKind::Impl`Dylan MacKenzie-0/+12
2020-01-20Rollup merge of #68353 - Centril:code-liberation, r=petrochenkovDylan DPC-3/+0
Remove `rustc_error_codes` deps except in `rustc_driver` Remove dependencies on `rustc_error_codes` in all crates except for `rustc_driver`. This has some benefits: 1. Adding a new error code when hacking on the compiler only requires rebuilding at most `rustc_error_codes`, `rustc_driver`, and the reflexive & transitive closure of the crate where the new error code is being added and its reverse dependencies. This improves time-to-UI-tests (TTUT). 2. Adding an error description to an error code only requires rebuilding `rustc_error_codes` and `rustc_driver`. This should substantially improve TTUT. r? @petrochenkov cc @rust-lang/wg-diagnostics
2020-01-18remove rustc_error_codes deps except in rustc_driverMazdak Farrokhzad-3/+0
2020-01-18slice_patterns: remove internal uses of gateMazdak Farrokhzad-1/+1
2020-01-17Use named fields for `ast::ItemKind::Impl`Dylan MacKenzie-25/+44
2020-01-14Code review changes and fix rustdoc test.Ben Lewis-33/+6
2020-01-14perf: eagerly convert literals to consts, this avoids creating loads on ↵Ben Lewis-7/+34
unevaluated consts which requires a lot of unnecessary work to evaluate them further down the line.
2020-01-11Rollup merge of #68114 - ecstatic-morse:fix-feature-gating, r=CentrilMazdak Farrokhzad-1/+1
Don't require `allow_internal_unstable` unless `staged_api` is enabled. #63770 changed `qualify_min_const_fn` to require `allow_internal_unstable` for *all* crates that used an unstable feature, regardless of whether `staged_api` was enabled or the `fn` that used that feature was stably const. In practice, this meant that every crate in the ecosystem that wanted to use nightly features added `#![feature(const_fn)]`, which skips `qualify_min_const_fn` entirely. After this PR, crates that do not have `#![feature(staged_api)]` will only need to enable the feature they are interested in. For example, `#![feature(const_if_match)]` will be enough to enable `if` and `match` in constants. Crates with `staged_api` (e.g., `libstd`) require `#[allow_internal_unstable]` to be added to a function if it uses nightly features unless that function is also marked `#[rustc_const_unstable]`. This prevents proliferation of `#[allow_internal_unstable]` into functions that are not callable in a `const` context on stable. r? @oli-obk (author of #63770) cc @Centril
2020-01-10Remove unnecessary `const_fn` feature gatesDylan MacKenzie-1/+1
This flag opts out of the min-const-fn checks entirely, which is usually not what we want. The few cases where the flag is still necessary have been annotated.
2020-01-11{syntax -> rustc_ast_passes}::show_spanMazdak Farrokhzad-71/+0
2020-01-11{syntax -> rustc_ast_passes}::feature_gateMazdak Farrokhzad-734/+0
2020-01-11nix syntax::early_buffered_lintsMazdak Farrokhzad-10/+0
2020-01-11move {rustc -> rustc_session}::lint::builtinMazdak Farrokhzad-24/+2
2020-01-11simplify feature_err importsMazdak Farrokhzad-1/+0
2020-01-11get_features -> rustc_parse::configMazdak Farrokhzad-172/+5
2020-01-11gating diagnostics -> rustc_session::parseMazdak Farrokhzad-72/+7
2020-01-11Rollup merge of #68050 - Centril:canon-error, r=Mark-SimulacrumYuki Okushi-7/+6
Canonicalize rustc_error imports r? @Mark-Simulacrum
2020-01-10nix syntax::errors & prefer rustc_errors over errorsMazdak Farrokhzad-7/+6
2020-01-10Introduce `#![feature(half_open_range_patterns)]`.Mazdak Farrokhzad-8/+13
This feature adds `X..`, `..X`, and `..=X` patterns.
2020-01-09Add a `constness` field to `ast::TraitRef`Dylan MacKenzie-4/+19
This is used for both the `?const` syntax in bounds as well as the `impl const Trait` syntax. I also considered handling these separately by adding a variant of `TraitBoundModifier` and a field to `ItemKind::Impl`, but this approach was less intrusive.
2020-01-09Add `const_trait_bound_opt_out` feature gateDylan MacKenzie-0/+1
2020-01-09Add `const_trait_impl` feature gateDylan MacKenzie-0/+1
2020-01-10Rollup merge of #68040 - sinkuu:unused, r=petrochenkovYuki Okushi-2/+0
Cleanup
2020-01-09Remove unused dependenciesShotaro Yamada-2/+0
2020-01-09Rollup merge of #67849 - cjkenn:check-sorted-words, r=estebankYuki Okushi-5/+34
Add a check for swapped words when we can't find an identifier Fixes #66968 Couple things here: 1. The matches take the precedence of case insensitive match, then levenshtein match, then swapped words match. Doing this allows us to not even check for swapped words unless the other checks return `None`. 2. I've assumed that the swapped words check is not held to the limits of the max levenshtein distance threshold (ie. we want to try and find a match even if the levenshtein distance is very high). This means that we cannot perform this check in the `fold` that occurs after the `filter_map` call, because the candidate will be filtered out. So, I've split this into two separate `fold` calls, and had to collect the original iterator into a vec so it can be copied (I don't think we want to change the function signature to take a vec or require the `Copy` trait). An alternative implemenation may be to remove the `filter_map`, `fold` over the entire iterator, and do a check against `max_dist` inside the relevant cases there. r? @estebank
2020-01-08- remove syntax::{span_warn!, span_err!, span_fatal!. struct_err!}Mazdak Farrokhzad-216/+60
- remove syntax::{help!, span_help!, span_note!} - remove unused syntax::{struct_span_fatal, struct_span_err_or_warn!, span_err_or_warn!} - lintify check_for_bindings_named_same_as_variants + conflicting_repr_hints - inline syntax::{struct_span_warn!, diagnostic_used!} - stringify_error_code! -> error_code! & use it more. - find_plugin_registrar: de-fatalize an error - de-fatalize metadata errors - move type_error_struct! to rustc_typeck - struct_span_err! -> rustc_errors
2020-01-05Rollup merge of #67881 - varkor:scattering-of-backticks, r=CentrilDylan DPC-2/+2
Add backticks to various diagnostics
2020-01-05Add backticks to various diagnosticsvarkor-2/+2
2020-01-04hir::{hir,def,itemlikevisit,pat_util,print} -> rustc_hirMazdak Farrokhzad-1/+11
Also fix fallout wrt. HashStable.
2020-01-03missed tidy checkcjkenn-2/+2
2020-01-03add a check for variable names that might match by wordcjkenn-5/+34
2020-01-02syntax::map_in_place: leave fixmeMazdak Farrokhzad-0/+2
2020-01-02Normalize `syntax::edition` imports.Mazdak Farrokhzad-12/+5
2020-01-02Normalize `syntax::symbol` imports.Mazdak Farrokhzad-14/+14
2020-01-02Normalize `syntax::source_map` imports.Mazdak Farrokhzad-28/+24
2020-01-01Rename `syntax_pos` to `rustc_span` in source codeVadim Petrochenkov-44/+44
2019-12-30Make things build againVadim Petrochenkov-1/+1
2019-12-28doc comments: Less attribute mimickingVadim Petrochenkov-13/+17
2019-12-27Stabilize the `matches!` macroSimon Sapin-1/+0
Fixes https://github.com/rust-lang/rust/issues/65721 FCP: https://github.com/rust-lang/rust/issues/65721#issuecomment-569118119
2019-12-23Add new folder for destructuring assignment testsvarkor-0/+1
2019-12-23Add span information to `ExprKind::Assign`varkor-7/+7
2019-12-22Format the worldMark Rousskov-1631/+1740