summary refs log tree commit diff
path: root/src/libsyntax/ast.rs
AgeCommit message (Collapse)AuthorLines
2018-04-30Warn on pointless `#[derive]` in more placesAustin Bonander-1/+1
This fixes the regression in #49934 and ensures that unused `#[derive]`s on statements, expressions and generic type parameters survive to trip the `unused_attributes` lint. For `#[derive]` on macro invocations it has a hardcoded warning since linting occurs after expansion. This also adds regression testing for some nodes that were already warning properly. closes #49934
2018-04-02Expand attribute macros on statements and expressions.Austin Bonander-0/+7
Retains the `stmt_expr_attributes` feature requirement for attributes on expressions. closes #41475 cc #38356
2018-03-18Initial implementation of RFC 2151, Raw IdentifiersLymia Aluysia-1/+1
2018-03-17Add some docs + Fix rebaseVadim Petrochenkov-0/+6
2018-03-17Rename `Span::empty` to `Span::shrink_to_lo`, add `Span::shrink_to_hi`Vadim Petrochenkov-1/+1
2018-03-17AST: Keep distinction between `path` and `::path` in imports and visibilitiesVadim Petrochenkov-9/+8
Add the root segment for name resolution purposes only
2018-03-17AST: Make renames in imports closer to the sourceVadim Petrochenkov-3/+14
Fix `unused_import_braces` lint false positive on `use prefix::{self as rename}`
2018-03-17AST/HIR: Clarify what the optional name in extern crate items meanVadim Petrochenkov-1/+1
2018-03-09Auto merge of #48326 - RalfJung:generic-bounds, r=petrochenkovbors-0/+19
Warn about ignored generic bounds in `for` This adds a new lint to fix #42181. For consistency and to avoid code duplication, I also moved the existing "bounds in type aliases are ignored" here. Questions to the reviewer: * Is it okay to just remove a diagnostic error code like this? Should I instead keep the warning about type aliases where it is? The old code provided a detailed explanation of what's going on when asked, that information is now lost. On the other hand, `span_warn!` seems deprecated (after this patch, it has exactly one user left!). * Did I miss any syntactic construct that can appear as `for` in the surface syntax? I covered function types (`for<'a> fn(...)`), generic traits (`for <'a> Fn(...)`, can appear both as bounds as as trait objects) and bounds (`for<'a> F: ...`). * For the sake of backwards compatibility, this adds a warning, not an error. @nikomatsakis suggested an error in https://github.com/rust-lang/rust/issues/42181#issuecomment-306924389, but I feel that can only happen in a new epoch -- right? Cc @eddyb
2018-03-02Replace Rc with Lrc for shared dataJohn Kåre Alsaker-2/+2
2018-03-01Support parentheses in patterns under feature gateVadim Petrochenkov-1/+3
Improve recovery for trailing comma after `..`
2018-02-27add lint to detect ignored generic bounds; this subsumes the previous ↵Ralf Jung-0/+19
'generic bounds in type aliases are ignored' warning
2018-02-24Implement multiple patterns with `|` in `if let` and `while let`Vadim Petrochenkov-2/+2
2018-02-23Auto merge of #47799 - topecongiro:fix-span-of-visibility, r=petrochenkovbors-2/+4
Fix span of visibility This PR 1. adds a closing parenthesis to the span of `Visibility::Crate` (e.g. `pub(crate)`). The current span only covers `pub(crate`. 2. adds a `span` field to `Visibility::Restricted`. This span covers the entire visibility expression (e.g. `pub (in self)`). Currently all we can have is a span for `Path`. This PR is motivated by the bug found in rustfmt (https://github.com/rust-lang-nursery/rustfmt/issues/2398). The first change is a strict improvement IMHO. The second change may not be desirable, as it adds a field which is currently not used by the compiler.
2018-02-17fix more typos found by codespell.Matthias Krüger-1/+1
2018-02-18Change ast::Visibility to Spanned typeSeiichi Uchida-3/+5
2018-02-18Add a span field to Visibility::RestrictedSeiichi Uchida-1/+1
This span covers the whole visibility expression: e.g. `pub (in path)`.
2018-01-30stabilize match_beginning_vertJonathan Goodman-1/+0
2018-01-25Rollup merge of #47502 - petrochenkov:label, r=eddybAlex Crichton-6/+18
AST/HIR: Add a separate structure for labels
2018-01-23Adds support for immovable generators. Move checking of invalid borrows ↵John Kåre Alsaker-1/+8
across suspension points to borrowck. Fixes #44197, #45259 and #45093.
2018-01-22AST/HIR: Add a separate structure for labelsVadim Petrochenkov-6/+18
2018-01-15Move `ExprPrecedence` to `libsyntax/util/parser.rs`Esteban Küber-135/+1
2018-01-15Use single source of truth for expr precedenceEsteban Küber-0/+180
Introduce a new unified type that holds the expression precedence for both AST and HIR nodes.
2018-01-13Remove `impl Foo for ..` in favor of `auto trait Foo`leonardo.yvens-6/+1
No longer parse it. Remove AutoTrait variant from AST and HIR. Remove backwards compatibility lint. Remove coherence checks, they make no sense for the new syntax. Remove from rustdoc.
2018-01-04rustc: use {U,I}size instead of {U,I}s shorthands.Eduard-Mihai Burtescu-6/+6
2018-01-01Fix docs for future pulldown migrationMalo Jaffré-2/+2
2017-12-22Auto merge of #46732 - estebank:silence-recovered-blocks, r=petrochenkovbors-0/+1
Do not emit type errors on recovered blocks When a parse error occurs on a block, the parser will recover and create a block with the statements collected until that point. Now a flag stating that a recovery has been performed in this block is propagated so that the type checker knows that the type of the block (which will be identified as `()`) shouldn't be checked against the expectation to reduce the amount of irrelevant diagnostic errors shown to the user. Fix #44579.
2017-12-21Do not emit type errors on recovered blocksEsteban Küber-0/+1
When a parse error occurs on a block, the parser will recover and create a block with the statements collected until that point. Now a flag stating that a recovery has been performed in this block is propagated so that the type checker knows that the type of the block (which will be identified as `()`) shouldn't be checked against the expectation to reduce the amount of irrelevant diagnostic errors shown to the user.
2017-12-21Auto merge of #45930 - jplatte:generics_refactoring, r=eddybbors-18/+43
Generics refactoring (groundwork for const generics) These changes were suggested by @eddyb. After this change, the `Generics` contain one `Vec` of an enum for the generic parameters, rather than two separate `Vec`s for lifetime and type parameters. Type params and const params will need to be in a shared `Vec` to preserve their ordering, and moving lifetimes into the same `Vec` should simplify the code that processes `Generics`.
2017-12-21Add GenericParam, refactor Generics in ast, hir, rustdocJonas Platte-18/+43
The Generics now contain one Vec of an enum for the generic parameters, rather than two separate Vec's for lifetime and type parameters. Additionally, places that previously used Vec<LifetimeDef> now use Vec<GenericParam> instead.
2017-12-20Move impls for qpath recovery trait from `ast.rs`Vadim Petrochenkov-56/+25
2017-12-17syntax: recovery for incorrect associated item paths like `[T; N]::clone`Vadim Petrochenkov-0/+94
2017-12-14add trait aliases to ASTAlex Burka-0/+5
2017-11-30Implement RFC 2128 (use_nested_groups)Pietro Albini-37/+10
This commit adds support for nested groups inside `use` declarations, such as `use foo::{bar, sub::{baz::Foo, *}};`.
2017-11-21Support `::crate` in pathsVadim Petrochenkov-3/+8
2017-11-03add `auto` keyword, parse `auto trait`, lower to HIRleonardo.yvens-2/+9
Adds an `IsAuto` field to `ItemTrait` which flags if the trait was declared as an `auto trait`. Auto traits cannot have generics nor super traits.
2017-11-03[Syntax Breaking] Rename DefaultImpl to AutoImplleonardo.yvens-2/+2
DefaultImpl is a highly confusing name for what we now call auto impls, as in `impl Send for ..`. The name auto impl is not formally decided but for sanity anything is better than `DefaultImpl` which refers neither to `default impl` nor to `impl Default`.
2017-11-01Rollup merge of #45579 - ↵kennytm-1/+3
leodasvacas:document-that-call-can-be-adt-constructor, r=estebank Document that call expressions also represent ADT constructors. This is a rather obscure part of the language.
2017-10-27Implement RFC 1861: Extern typesPaul Lietar-1/+4
2017-10-27Document that call expressions also represent ADT constructors.leonardo.yvens-1/+3
This is a rather obscure part of the language.
2017-10-24Auto merge of #45401 - zackmdavis:crate_shorthand_visibility_modifier, ↵bors-1/+10
r=nikomatsakis `crate` shorthand visibility modifier cc #45388. r? @nikomatsakis
2017-10-22`crate` shorthand visibility modifierZack M. Davis-1/+10
With regrets, this breaks rustfmt and rls. This is in the matter of #45388.
2017-10-17Lifting Generics from MethodSig to TraitItem and ImplItem since we want to ↵Sunjay Varma-1/+2
support generics in each variant of TraitItem and ImplItem
2017-10-14Implement `dyn Trait` syntaxVadim Petrochenkov-1/+8
2017-10-05Auto merge of #44943 - nivkner:fixme_fixup, r=dtolnaybors-2/+0
address some FIXME whose associated issues were marked as closed part of #44366
2017-10-02fix comment on DefaultImplAlex Burka-2/+2
2017-10-02fix ItemKind::DefaultImpl doc commentAlex Burka-2/+2
Upgrade comment to doc comment.
2017-09-30remove "refinement on pat" FIXMENiv Kaminer-1/+0
2017-09-30address some `FIXME`s whose associated issues were marked as closedNiv Kaminer-2/+1
remove FIXME(#13101) since `assert_receiver_is_total_eq` stays. remove FIXME(#19649) now that stability markers render. remove FIXME(#13642) now the benchmarks were moved. remove FIXME(#6220) now that floating points can be formatted. remove FIXME(#18248) and write tests for `Rc<str>` and `Rc<[u8]>` remove reference to irelevent issues in FIXME(#1697, #2178...) update FIXME(#5516) to point to getopts issue 7 update FIXME(#7771) to point to RFC 628 update FIXME(#19839) to point to issue 26925
2017-09-22Add information about the syntax used in rangesBadel2-2/+8
... or ..=