summary refs log tree commit diff
path: root/src/libsyntax/ast.rs
AgeCommit message (Collapse)AuthorLines
2020-01-26Suggest defining type parameter when appropriateEsteban Küber-0/+14
``` error[E0412]: cannot find type `T` in this scope --> file.rs:3:12 | 3 | impl Trait<T> for Struct {} | - ^ not found in this scope | | | help: you might be missing a type parameter: `<T>` ``` Fix #64298.
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-17/+3
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/+1
2020-01-17Use named fields for `ast::ItemKind::Impl`Dylan MacKenzie-10/+13
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-10Introduce `#![feature(half_open_range_patterns)]`.Mazdak Farrokhzad-1/+1
This feature adds `X..`, `..X`, and `..=X` patterns.
2020-01-09Add a `constness` field to `ast::TraitRef`Dylan MacKenzie-3/+17
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-02Normalize `syntax::source_map` imports.Mazdak Farrokhzad-4/+3
2020-01-01Rename `syntax_pos` to `rustc_span` in source codeVadim Petrochenkov-3/+3
2019-12-28doc comments: Less attribute mimickingVadim Petrochenkov-4/+0
2019-12-23Add new folder for destructuring assignment testsvarkor-0/+1
2019-12-23Add span information to `ExprKind::Assign`varkor-1/+1
2019-12-22Format the worldMark Rousskov-128/+130
2019-12-21Rollup merge of #67355 - Centril:merge-mut, r=oli-obkMazdak Farrokhzad-10/+10
Merge `ast::Mutability` and `mir::Mutability` r? @oli-obk
2019-12-20introduce 'type AttrVec'Mazdak Farrokhzad-8/+11
2019-12-201. ast::Mutability::{Mutable -> Mut, Immutable -> Not}.Mazdak Farrokhzad-10/+10
2. mir::Mutability -> ast::Mutability.
2019-12-20Rollup merge of #67131 - Centril:item-merge, r=petrochenkovMazdak Farrokhzad-36/+25
Merge `TraitItem` & `ImplItem into `AssocItem` In this PR we: - Merge `{Trait,Impl}Item{Kind?}` into `AssocItem{Kind?}` as discussed in https://github.com/rust-lang/rust/issues/65041#issuecomment-538105286. - This is done by using the cover grammar of both forms. - In particular, it requires that we syntactically allow (under `#[cfg(FALSE)]`): - `default`ness on `trait` items, - `impl` items without a body / definition (`const`, `type`, and `fn`), - and associated `type`s in `impl`s with bounds, e.g., `type Foo: Ord;`. - The syntactic restrictions are replaced by semantic ones in `ast_validation`. - Move syntactic restrictions around C-variadic parameters from the parser into `ast_validation`: - `fn`s in all contexts now syntactically allow `...`, - `...` can occur anywhere in the list syntactically (`fn foo(..., x: usize) {}`), - and `...` can be the sole parameter (`fn foo(...) {}`. r? @petrochenkov
2019-12-18Fix comment orderingMatthew Jasper-4/+4
2019-12-12`AssocImplKind::{Method -> Fn}`.Mazdak Farrokhzad-2/+1
2019-12-12Remove `ast::{Impl,Trait}{Item,ItemKind}`.Mazdak Farrokhzad-10/+4
2019-12-12parse: refactor fun ret ty & param tyMazdak Farrokhzad-2/+2
2019-12-12Unify associated function parsing.Mazdak Farrokhzad-0/+1
2019-12-12Unify `{Impl,Trait}Item` as `AssocItem`.Mazdak Farrokhzad-17/+24
2019-12-12Unify `{Trait,Impl}ItemKind::TyAlias` structures.Mazdak Farrokhzad-1/+1
2019-12-12`TraitItemKind::Type` -> `TraitItemKind::TyAlias`.Mazdak Farrokhzad-1/+1
2019-12-12Use `Option` in `ImplItemKind::Method`.Mazdak Farrokhzad-1/+1
2019-12-12Use `Option` in `ImplItemKind::Const`.Mazdak Farrokhzad-2/+2
2019-12-12Alias `TraitItem` & `ImplItem`.Mazdak Farrokhzad-17/+5
Allow defaultness on trait items syntactically.
2019-12-07Make `ForeignItem` an alias of `Item`.Mazdak Farrokhzad-12/+3
2019-12-03Deduplicate CrateConfigMark Rousskov-4/+1
2019-12-03Move BufferedEarlyLint to librustc_sessionMark Rousskov-41/+2
2019-12-02Address review commentsVadim Petrochenkov-9/+13
2019-12-02syntax: Use `ast::MacArgs` for macro definitionsVadim Petrochenkov-7/+1
2019-12-02syntax: Use `ast::MacArgs` for attributesVadim Petrochenkov-4/+4
2019-12-02syntax: Remove redundant span from `ast::Mac`Vadim Petrochenkov-7/+14
Also remove a couple of redundant `visit_mac` asserts
2019-12-02syntax: Introduce a struct `MacArgs` for macro argumentsVadim Petrochenkov-15/+69
2019-11-26Rollup merge of #66719 - Mark-Simulacrum:int-normalization, r=CentrilTyler Mandry-0/+24
Store pointer width as u32 on Config This removes the dependency on IntTy, UintTy from Session. It's not obviously a win, but it seems a bit odd to store the AST IntTy/UintTy in Session, rather we store the pointer width as an integer and add normalization methods to IntTy and UintTy.
2019-11-25Auto merge of #66279 - cjgillot:hashstable, r=Zoxcbors-6/+16
Use proc-macro to derive HashStable everywhere Hello, A second proc-macro is added to derive HashStable for crates librustc depends on. This proc-macro `HashStable_Generic` (to bikeshed) allows to decouple code and strip much of librustc's boilerplate. Still, two implementations `Span` and `TokenKind` require to be placed in librustc. The latter only depends on the `bug` macro. Advise welcome on how to sever that link. A trait `StableHasingContextLike` has been introduced at each crate root, in order to handle those implementations which require librustc's very `StableHashingContext`. This overall effort allowed to remove the `impl_stable_hash_for` macro. Each commit passes the `x.py check`. I still have to double check there was no change in the implementation.
2019-11-24Store ptr_width as u32 on ConfigMark Rousskov-0/+24
This removes the dependency on IntTy, UintTy from Session.
2019-11-24Add raw address of expressions to the AST and HIRMatthew Jasper-3/+18
2019-11-22Derives for ast.Camille GILLOT-4/+4
2019-11-22Invert implementations for TokenKind.Camille GILLOT-1/+1
Also export a bunch of Token-related impls.
2019-11-22Export HashStable for DelimSpan, Lit and Path.Camille GILLOT-1/+11
2019-11-22Rollup merge of #66183 - Centril:empty-vis-trait-decl, r=petrochenkovMazdak Farrokhzad-21/+29
*Syntactically* permit visibilities on trait items & enum variants Fixes #65041 Suppose we have `$vis trait_item` or `$vis enum_variant` and `$vis` is a `:vis` macro fragment. Before this PR, this would fail to parse. This is now instead allowed as per language team consensus in https://github.com/rust-lang/rust/issues/65041#issuecomment-538105286. (See added tests for elaboration.) Moreover, we now also permit visibility modifiers on trait items & enum variants *syntactically* but reject them with semantic checks (in `ast_validation`): ```rust #[cfg(FALSE)] trait Foo { pub fn bar(); } // OK #[cfg(FALSE)] enum E { pub U } // OK ```
2019-11-17Remove extern crate.Camille GILLOT-0/+1
2019-11-17HashStable in libsyntax.Camille GILLOT-4/+3