about summary refs log tree commit diff
path: root/src/librustc_builtin_macros
AgeCommit message (Collapse)AuthorLines
2020-03-09expand/builtin_macros: Minor cleanupVadim Petrochenkov-1/+1
2020-03-09rustc_parse: Use `Token::ident` where possibleVadim Petrochenkov-33/+32
2020-03-08Rollup merge of #69548 - LeSeulArtichaut:assert-errors, r=petrochenkovMazdak Farrokhzad-8/+4
Turn trailing tokens in `assert!()` into hard errors I didn't have time to build the compiler and thus edited the tests manually, I hope it will still pass. Closes #69531 r? @Centril do you want to queue the Crater experiment?
2020-03-07Rollup merge of #69773 - matthiaskrgr:typos, r=petrochenkovMazdak Farrokhzad-1/+1
fix various typos
2020-03-06Turn trailing tokens in `assert!()` into hard errorsLeSeulArtichaut-8/+4
2020-03-06Don't redundantly repeat field names (clippy::redundant_field_names)Matthias Krüger-1/+1
2020-03-06fix various typosMatthias Krüger-1/+1
2020-03-05Use more efficient &&str to String conversion (clippy::inefficient_to_string)Matthias Krüger-1/+1
2020-03-05Use righthand '&' instead of lefthand "ref". (clippy::toplevel_ref_arg)Matthias Krüger-9/+9
2020-03-02use values() or keys() respectively when iterating only over keys or values ↵Matthias Krüger-1/+1
of maps.
2020-03-01Rollup merge of #69580 - matthiaskrgr:map_clone, r=CentrilYuki Okushi-1/+1
use .copied() instead of .map(|x| *x) on iterators
2020-03-01Rollup merge of #69579 - petrochenkov:noprevspan, r=CentrilYuki Okushi-7/+7
parser: Remove `Parser::prev_span` Follow-up to https://github.com/rust-lang/rust/pull/69384. r? @Centril
2020-03-01Auto merge of #69592 - petrochenkov:nosyntax, r=Centrilbors-94/+96
Rename `libsyntax` to `librustc_ast` This was the last rustc crate that wasn't following the `rustc_*` naming convention. Follow-up to https://github.com/rust-lang/rust/pull/67763.
2020-02-29Rename `syntax` to `rustc_ast` in source codeVadim Petrochenkov-94/+96
2020-02-29Rollup merge of #69572 - matthiaskrgr:try_err_and_iter_on_ref, r=CentrilDylan DPC-1/+1
use .iter() instead of .into_iter() on references
2020-02-29Make it build againVadim Petrochenkov-1/+1
2020-02-29use .copied() instead of .map(|x| *x) on iteratorsMatthias Krüger-1/+1
2020-02-29parser: `prev_span` -> `prev_token.span`Vadim Petrochenkov-7/+7
2020-02-29use .iter() instead of .into_iter() on references.Matthias Krüger-1/+1
2020-02-29Rollup merge of #69551 - matthiaskrgr:len_zero, r=Mark-SimulacrumDylan DPC-2/+2
use is_empty() instead of len() == x to determine if structs are empty.
2020-02-29Rollup merge of #69546 - matthiaskrgr:slice_to_vec, r=davidtwco,nagisaDylan DPC-2/+2
use to_vec() instead of .iter().cloned().collect() to convert slices to vecs.
2020-02-28Rollup merge of #69481 - matthiaskrgr:single_char, r=ecstatic-morseMazdak Farrokhzad-5/+5
use char instead of &str for single char patterns
2020-02-28use is_empty() instead of len() == x to determine if structs are empty.Matthias Krüger-2/+2
2020-02-28use to_vec() instead of .iter().cloned().collect() to convert slices to vecs.Matthias Krüger-2/+2
2020-02-27use char instead of &str for single char patternsMatthias Krüger-5/+5
2020-02-24parser: `token` -> `normalized_token`, `nonnormalized_token` -> `token`Vadim Petrochenkov-1/+1
2020-02-24parse/ast: move `Defaultness` into variants.Mazdak Farrokhzad-11/+12
2020-02-24ast: add `Defaultness` to `Item`, making `AssocItem` an alias.Mazdak Farrokhzad-16/+9
2020-02-18Rollup merge of #69194 - Centril:assoc-extern-fuse, r=petrochenkovMazdak Farrokhzad-75/+78
parse: fuse associated and extern items up to defaultness Language changes: - The grammar of extern `type` aliases is unified with associated ones, and becomes: ```rust TypeItem = "type" ident generics {":" bounds}? where_clause {"=" type}? ";" ; ``` Semantic restrictions (`ast_validation`) are added to forbid any parameters in `generics`, any bounds in `bounds`, and any predicates in `where_clause`, as well as the presence of a type expression (`= u8`). (Work still remains to fuse this with free `type` aliases, but this can be done later.) - The grammar of constants and static items (free, associated, and extern) now permits the absence of an expression, and becomes: ```rust GlobalItem = {"const" {ident | "_"} | "static" "mut"? ident} {"=" expr}? ";" ; ``` - A semantic restriction is added to enforce the presence of the expression (the body). - A semantic restriction is added to reject `const _` in associated contexts. Together, these changes allow us to fuse the grammar of associated items and extern items up to `default`ness which is the main goal of the PR. ----------------------- We are now very close to fully fusing the entirely of item parsing and their ASTs. To progress further, we must make a decision: should we parse e.g. `default use foo::bar;` and whatnot? Accepting that is likely easiest from a parsing perspective, as it does not require using look-ahead, but it is perhaps not too onerous to only accept it for `fn`s (and all their various qualifiers), `const`s, `static`s, and `type`s. r? @petrochenkov
2020-02-17Rename `FunctionRetTy` to `FnRetTy`Yuki Okushi-5/+5
2020-02-15Record proc macro harness order for use during metadata deserializationAaron Hill-18/+43
Fixes #68690 When we generate the proc macro harness, we now explicitly recorder the order in which we generate entries. We then use this ordering data to deserialize the correct proc-macro-data from the crate metadata.
2020-02-15ast: make `= <expr>;` optional in free statics/consts.Mazdak Farrokhzad-72/+76
2020-02-15ast: move Generics into AssocItemKindsMazdak Farrokhzad-3/+2
2020-02-13rustc_bulltin_macros: tweak span_labelsMazdak Farrokhzad-2/+2
2020-02-13IsAsync -> enum Async { Yes { span: Span, .. }, No }Mazdak Farrokhzad-2/+4
use new span for better diagnostics.
2020-02-13Constness -> enum Const { Yes(Span), No }Mazdak Farrokhzad-9/+11
Same idea for `Unsafety` & use new span for better diagnostics.
2020-02-10Add `#[repr(no_niche)]`.Felix S. Klock II-1/+2
This repr-hint makes a struct/enum hide any niche within from its surrounding type-construction context. It is meant (at least initially) as an implementation detail for resolving issue 68303. We will not stabilize the repr-hint unless someone finds motivation for doing so. (So, declaration of `no_niche` feature lives in section of file where other internal implementation details are grouped, and deliberately leaves out the tracking issue number.) incorporated review feedback, and fixed post-rebase.
2020-02-06Rollup merge of #68788 - Centril:unified-fn-bodies, r=petrochenkovDylan DPC-2/+2
Towards unified `fn` grammar Part of https://github.com/rust-lang/rust/pull/68728. - Syntactically, `fn` items in `extern { ... }` blocks can now have bodies (`fn foo() { ... }` as opposed to `fn foo();`). As above, we use semantic restrictions instead. - Syntactically, `fn` items in free contexts (directly in a file or a module) can now be without bodies (`fn foo();` as opposed to `fn foo() { ... }`. As above, we use semantic restrictions instead, including for non-ident parameter patterns. - We move towards unifying the `fn` front matter; this is fully realized in https://github.com/rust-lang/rust/pull/68728. r? @petrochenkov
2020-02-05parser: merge `fn` grammars wrt. bodies & headersMazdak Farrokhzad-2/+2
also refactor `FnKind` and `visit_assoc_item` visitors
2020-02-04remove redundant imports (clippy::single_component_path_imports)Matthias Krüger-1/+0
2020-02-01syntax::print -> new crate rustc_ast_prettyMazdak Farrokhzad-6/+7
2020-02-011. move node_id to syntaxMazdak Farrokhzad-5/+5
2. invert rustc_session & syntax deps 3. drop rustc_session dep in rustc_hir
2020-02-01Move builtin attribute logic to new rustc_attr crate.Mazdak Farrokhzad-2/+3
For now, this is all the crate contains, but more attribute logic & types will be moved there over time.
2020-01-30Use `P` for `NtTraitItem`, `NtImplItem`, and `NtForeignItem`.Nicholas Nethercote-7/+8
This commit reduces the size of `Nonterminal` from a whopping 240 bytes to 72 bytes (on x86-64), which gets it below the `memcpy` threshold. It also removes some impedance mismatches with `Annotatable`, which already uses `P` for these variants.
2020-01-27don't clone types that are copy, round two.Matthias Krüger-1/+1
2020-01-21Rollup merge of #68140 - ecstatic-morse:const-trait-bound-opt-out, r=oli-obkMazdak Farrokhzad-0/+2
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-20Delete unused "next" variants from formatting infrastructureMark Rousskov-12/+1
The formatting infrastructure stopped emitting these a while back, and in removing them we can simplify related code.
2020-01-19Add `constness` field to `ast::ItemKind::Impl`Dylan MacKenzie-0/+2
2020-01-18remove rustc_error_codes deps except in rustc_driverMazdak Farrokhzad-5/+0
2020-01-17Use named fields for `ast::ItemKind::Impl`Dylan MacKenzie-16/+16