about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2019-09-29Rollup merge of #64894 - Centril:fix-64682, r=petrochenkovMazdak Farrokhzad-76/+41
syntax: fix dropping of attribute on first param of non-method assocated fn Fixes #64682. The general idea is that we bake parsing of `self` into `parse_param_general` and then we just use standard list parsing. Overall, this simplifies the parsing and makes it more consistent. r? @petrochenkov cc @c410-f3r
2019-09-29remove indexed_vec re-export from rustc_data_structurescsmoe-4/+3
2019-09-29remove bit_set re-export from rustc_data_structurescsmoe-1/+2
2019-09-29syntax: fix #64682.Mazdak Farrokhzad-76/+41
Fuse parsing of `self` into `parse_param_general`.
2019-09-29syntax: recover trailing `|` in or-patterns.Mazdak Farrokhzad-26/+79
2019-09-29Rollup merge of #64824 - Mark-Simulacrum:no-stable-hasher-result-everywhere, ↵Mazdak Farrokhzad-5/+2
r=michaelwoerister No StableHasherResult everywhere This removes the generic parameter on `StableHasher`, instead moving it to the call to `finish`. This has the side-effect of making all `HashStable` impls nicer, since we no longer need the verbose `<W: StableHasherResult>` that previously existed -- often forcing line wrapping. This is done for two reasons: * we should avoid false "generic" dependency on the result of StableHasher * we don't need to codegen two/three copies of all the HashStable impls when they're transitively used to produce a fingerprint, u64, or u128. I haven't measured, but this might actually make our artifacts somewhat smaller too. * Easier to understand/read/write code -- the result of the stable hasher is irrelevant when writing a hash impl.
2019-09-29Rollup merge of #63492 - eddyb:cvarargs, r=nagisa,matthewjasperMazdak Farrokhzad-15/+21
Remove redundancy from the implementation of C variadics. This cleanup was first described in https://github.com/rust-lang/rust/issues/44930#issuecomment-497163539: * AST doesn't track `c_variadic: bool` anymore, relying solely on a trailing `CVarArgs` type in fn signatures * HIR doesn't have a `CVarArgs` anymore, relying solely on `c_variadic: bool` * same for `ty::FnSig` (see tests for diagnostics improvements from that) * `{hir,mir}::Body` have one extra argument than the signature when `c_variadic == true` * `rustc_typeck` and `rustc_mir::{build,borrowck}` need to give that argument the right type (which no longer uses a lifetime parameter, but a function-internal scope) * `rustc_target::abi::call` doesn't need special hacks anymore (since it never sees the `VaListImpl` now, it's all inside the body) r? @nagisa / @rkruppe cc @dlrobertson @oli-obk
2019-09-28Switch over all StableHash impls to new formatMark Rousskov-5/+2
2019-09-28syntax: don't keep a redundant c_variadic flag in the AST.Eduard-Mihai Burtescu-15/+21
2019-09-27Filter out stmts made for the redundant_semicolon lint when pretty-printingnathanwhit-3/+12
2019-09-27Auto merge of #64813 - varkor:node-to-kind, r=Centrilbors-298/+295
Rename `*.node` to `*.kind`, and `hair::Pattern*` to `hair::Pat*` In both `ast::Expr` and `hir::Expr`: - Rename `Expr.node` to `Expr.kind`. - Rename `Pat.node` to `Pat.kind`. - Rename `ImplItem.node` to `ImplItem.kind`. - Rename `Lit.node` to `Lit.kind`. - Rename `TraitItem.node` to `TraitItem.kind`. - Rename `Ty.node` to `Ty.kind`. - Rename `Stmt.node` to `Stmt.kind`. - Rename `Item.node` to `Item.kind`. - Rename `ForeignItem.node` to `ForeignItem.kind`. - Rename `MetaItem.node` to `MetaItem.kind`. Also: - Rename `hair::FieldPattern` to `hair::FieldPat`. - Rename `hair::PatternKind` to `hair::PatKind`. - Rename `hair::PatternRange` to `hair::PatRange`. - Rename `PatternContext` to `PatCtxt`. - Rename `PatternTypeProjection` to `PatTyProj`. - Rename `hair::Pattern` to `hair::Pat`. These two sets of changes are grouped together to aid with merging. The only changes are renamings. r? @petrochenkov
2019-09-26Rename `MetaItem.node` to `MetaItem.kind`varkor-35/+35
2019-09-26Rename `ForeignItem.node` to `ForeignItem.kind`varkor-13/+13
2019-09-26Rename `Item.node` to `Item.kind`varkor-28/+28
2019-09-26Rename `Stmt.node` to `Stmt.kind`varkor-40/+40
2019-09-26Rename `Ty.node` to `Ty.kind`varkor-37/+37
2019-09-26Rename `TraitItem.node` to `TraitItem.kind`varkor-11/+11
2019-09-26Rename `Lit.node` to `Lit.kind`varkor-15/+15
2019-09-26Rename `ImplItem.node` to `ImplItem.kind`varkor-13/+13
2019-09-26Rename `Pat.node` to `Pat.kind`varkor-39/+39
2019-09-26Rename `Expr.node` to `Expr.kind`varkor-70/+67
For both `ast::Expr` and `hir::Expr`.
2019-09-26Rollup merge of #64783 - onehr:onehrxn, r=varkorMazdak Farrokhzad-1/+7
Fix issue #64732 Based on issue #64732, when creating a byte literal with single quotes, the suggestion message would indicate that you meant to write a `str` literal, but we actually meant to write a byte string literal. So I changed the unescape_error_reporting.rs to decide whether to print out "if you meant to write a `str` literal, use double quotes", or "if you meant to write a byte string literal, use double quotes". Fixes #64732.
2019-09-26Auto merge of #62661 - arielb1:never-reserve, r=nikomatsakisbors-1/+4
reserve `impl<T> From<!> for T` this is necessary for never-type stabilization. cc #57012 #35121 I think we wanted a crater run for this @nikomatsakis? r? @nikomatsakis
2019-09-25Fix issue #64732Haoran Wang-1/+7
Based on issue #64732, when creating a byte literal with single quotes, the suggestion message would indicate that you meant to write a `str` literal, but we actually meant to write a byte string literal. So I changed the unescape_error_reporting.rs to decide whether to print out "if you meant to write a `str` literal, use double quotes", or "if you meant to write a byte string literal, use double quotes".
2019-09-25Rollup merge of #64764 - Mark-Simulacrum:snap, r=CentrilMazdak Farrokhzad-1/+0
Master is now 1.40 r? @pietroalbini
2019-09-25Rollup merge of #64759 - matklad:simplify-macro, r=petrochenkovMazdak Farrokhzad-48/+18
Refactor mbe a tiny bit
2019-09-25Rollup merge of #64508 - Centril:or-pat-hir, r=matthewjasperMazdak Farrokhzad-2/+0
or-patterns: Push `PatKind/PatternKind::Or` at top level to HIR & HAIR Following up on work in https://github.com/rust-lang/rust/pull/64111, https://github.com/rust-lang/rust/pull/63693, and https://github.com/rust-lang/rust/pull/61708, in this PR: - We change `hair::Arm.patterns: Vec<Pattern<'_>>` into `hir::Arm.pattern: Pattern<'_>`. - `fn hair::Arm::top_pats_hack` is introduced as a temporary crutch in MIR building to avoid more changes. - We change `hir::Arm.pats: HirVec<P<Pat>>` into `hir::Arm.pat: P<Pat>`. - The hacks in `rustc::hir::lowering` are removed since the representation hack is no longer necessary. - In some places, `fn hir::Arm::top_pats_hack` is introduced to leave some things as future work. - Misc changes: HIR pretty printing is adjusted to behave uniformly wrt. top/inner levels, rvalue promotion is adjusted, regionck, and dead_code is also. - Type checking is adjusted to uniformly handle or-patterns at top/inner levels. To make things compile, `p_0 | ... | p_n` is redefined as a "reference pattern" in [`fn is_non_ref_pat`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/check/struct.FnCtxt.html#method.is_non_ref_pat) for now. This is done so that reference types are not eagerly stripped from the `expected: Ty<'tcx>`. - Liveness is adjusted wrt. the `unused_variables` and `unused_assignments` lints to handle top/inner levels uniformly and the handling of `fn` parameters, `let` locals, and `match` arms are unified in this respect. This is not tested for now as exhaustiveness checks are reachable and will ICE. - In `check_match`, checking `@` and by-move bindings is adjusted. However, exhaustiveness checking is not adjusted the moment and is handled by @dlrobertson in https://github.com/rust-lang/rust/pull/63688. - AST borrowck (`construct.rs`) is not adjusted as AST borrowck will be removed soon. r? @matthewjasper cc @dlrobertson @varkor @oli-obk
2019-09-25Snap cfgs to new betaMark Rousskov-1/+0
2019-09-25remove unused peekableAleksey Kladov-4/+3
2019-09-25move function closer to its usageAleksey Kladov-13/+14
2019-09-25remove unused parametersAleksey Kladov-31/+1
2019-09-25Rollup merge of #64753 - ehuss:json-short-explain, r=Mark-SimulacrumMazdak Farrokhzad-0/+7
Don't emit explain with json short messages. This fixes an issue where `--error-format=json --json=diagnostic-short` would emit the "For more information about this error" message, which doesn't match the behavior of `--error-format=short` which explicitly excludes it.
2019-09-24Don't emit explain with json short messages.Eric Huss-0/+7
2019-09-24Rollup merge of #64702 - sinkuu:deps, r=jonas-schievinkMazdak Farrokhzad-1/+0
Remove unused dependencies
2019-09-24Rollup merge of #64698 - Centril:infer-const-with-stash, r=estebankMazdak Farrokhzad-8/+45
Recover on `const X = 42;` and infer type + Error Stash API Here we: 1. Introduce a notion of the "error stash". This is a map in the `Handler` to which you can `err.stash(...)` away your diagnostics and then steal them in a later "phase" of the compiler (e.g. stash in parser, steal in typeck) to enrich them with more information that isn't available in the previous "phase". I believe I've covered all the bases to make sure these diagnostics are actually emitted eventually even under `#[cfg(FALSE)]` but please check my logic. 2. Recover when parsing `[const | static mut?] $ident = $expr;` which has a missing type. Use the "error stash" to stash away the error and later steal the error in typeck where we emit the error as `MachineApplicable` with the actual inferred type. This builds on https://github.com/rust-lang/rust/pull/62804. cc https://github.com/rust-lang/rfcs/pull/2545 r? @estebank
2019-09-24Rollup merge of #64689 - matklad:refactor-mbe, r=petrochenkovMazdak Farrokhzad-292/+295
Refactor macro by example This doesn't do anything useful yet, and just moves code around and restricts visibility
2019-09-24add error message for caseAriel Ben-Yehuda-2/+1
2019-09-24reserve `impl<T> From<!> for T`Ariel Ben-Yehuda-0/+4
this is necessary for never-type stabilization
2019-09-24Stabilize `str::len`, `[T]::len`, `is_empty` and `str::as_bytes` as const fnOliver Scherer-27/+27
2019-09-23cleanup librustc_errors Handler code.Mazdak Farrokhzad-5/+1
2019-09-23Add parser recovery for `const $ident = $expr;`.Mazdak Farrokhzad-3/+44
Then use the diagnostics-stealing API to stash parser errors and enrich them with type information in typeck.
2019-09-23Auto merge of #64272 - Mark-Simulacrum:parallel-handler, r=estebankbors-28/+31
Refactor librustc_errors::Handler API This should be reviewed by-commit. The last commit moves all fields into an inner struct behind a single lock; this is done to prevent possible deadlocks in a multi-threaded compiler, as well as inconsistent state observation.
2019-09-23Remove unused dependenciesShotaro Yamada-1/+0
2019-09-23Auto merge of #64695 - Centril:rollup-t1xnl2c, r=Centrilbors-354/+70
Rollup of 7 pull requests Successful merges: - #64294 (Fix `Stdio::piped` example code and lint) - #64670 (Cleanup syntax::ext::build) - #64674 (Propagate `types.err` in locals further to avoid spurious knock-down errors) - #64676 (Parse assoc type bounds in generic params and provide custom diagnostic) - #64677 (remove outdated comment) - #64679 (Infer consts more consistently) - #64688 (Clarify the "since" tidy check) Failed merges: r? @ghost
2019-09-23Rollup merge of #64676 - estebank:assoc-type-bound-in-generic, r=petrochenkovMazdak Farrokhzad-38/+61
Parse assoc type bounds in generic params and provide custom diagnostic Fix #26271.
2019-09-23Rollup merge of #64670 - Mark-Simulacrum:ext-build-simplify, r=petrochenkovMazdak Farrokhzad-316/+9
Cleanup syntax::ext::build I suspect most of this code could be inlined but I only removed the bits where the inlining didn't really hurt readability (i.e., method call -> function call) or the completely unused code.
2019-09-22review commentsEsteban Küber-1/+1
2019-09-22Point at correct span for parenthesized typesEsteban Küber-6/+7
2019-09-22make mbe::TokenTree private to moduleAleksey Kladov-26/+26
2019-09-22push TokenTree::parse downAleksey Kladov-16/+14