about summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2019-09-28Point at enclosing match when expecting `()` in armEsteban Küber-12/+32
When encountering code like the following: ```rust fn main() { match 3 { 4 => 1, 3 => { println!("Yep it maches."); 2 } _ => 2 } println!("Bye!") } ``` point at the enclosing `match` expression and suggest ignoring the returned value: ``` error[E0308]: mismatched types --> $DIR/match-needing-semi.rs:8:13 | LL | / match 3 { LL | | 4 => 1, LL | | 3 => { LL | | 2 | | ^ expected (), found integer LL | | } LL | | _ => 2 LL | | } | | -- help: consider using a semicolon here | |_____| | expected this to be `()` | = note: expected type `()` found type `{integer} ``` Fix #40799.
2019-09-28Auto merge of #64419 - wesleywiser:const_prop_use_ecx, r=oli-obkbors-0/+6
Deduplicate some code between miri and const prop r? @oli-obk
2019-09-28Switch over all StableHash impls to new formatMark Rousskov-309/+114
2019-09-28rustc: rely on c_variadic == true instead of CVarArgs in HIR/Ty fn signatures.Eduard-Mihai Burtescu-45/+23
2019-09-28rustc: don't store a lifetime in hir::TyKind::CVarArgs.Eduard-Mihai Burtescu-19/+4
2019-09-28syntax: don't keep a redundant c_variadic flag in the AST.Eduard-Mihai Burtescu-3/+1
2019-09-28Trigger ICE on nightly if validators disagreeDylan MacKenzie-0/+2
Also adds an unstable flag to disable the ICE (`-Zsuppress-const-validation-back-compat-ice`) so that nightly users do not have to revert to a previous nightly if their code causes disagreement between the validators.
2019-09-28Rollup merge of #64859 - Centril:const-def-here-new-var, r=estebankMazdak Farrokhzad-0/+8
check_match: improve diagnostics for `let A = 2;` with `const A: i32 = 3` For example: ``` error[E0005]: refutable pattern in local binding: `std::i32::MIN..=1i32` and `3i32..=std::i32::MAX` not covered --> $DIR/const-pat-non-exaustive-let-new-var.rs:2:9 | LL | let A = 3; | ^ | | | interpreted as a constant pattern, not a new variable | help: introduce a variable instead: `a_var` ... LL | const A: i32 = 2; | ----------------- constant defined here ``` r? @estebank cc @matthiaskrgr @rpjohnst
2019-09-28Rollup merge of #64830 - Centril:thou-shallt-not-abort, r=estebankMazdak Farrokhzad-2/+1
Thou shallt not `.abort_if_errors()` r? @estebank
2019-09-28Rollup merge of #64809 - davidtwco:issue-64768-target-feature-const, r=varkorMazdak Farrokhzad-20/+52
hir: Disallow `target_feature` on constants Fixes #64768. This PR fixes an ICE when `#[target_feature]` is applied to constants by disallowing this with the same error as when `#[target_feature]` is applied to other places it shouldn't be. I couldn't see anything in the [RFC](https://github.com/rust-lang/rfcs/blob/master/text/2045-target-feature.md) that suggested that `#[target_feature]` should be applicable to constants or any tests that suggested it should, though I might have missed something - if this is desirable in future, it remains possible to remove this error (but for the time being, I think this error is better than an ICE). I also added some extra cases to the test for other places where `#[target_feature]` should not be permitted. cc @gnzlbg
2019-09-28Rollup merge of #64802 - estebank:walk-parents-iterator, r=matthewjasperMazdak Farrokhzad-110/+129
Account for tail expressions when pointing at return type When there's a type mismatch we make an effort to check if it was caused by a function's return type. This logic now makes sure to only point at the return type if the error happens in a tail expression. Turn `walk_parent_nodes` method into an iterator. CC #39968, CC #40799.
2019-09-28Rollup merge of #64794 - Mark-Simulacrum:rm-dep-track-map, r=estebankMazdak Farrokhzad-156/+3
Remove unused DepTrackingMap Deletes some related code (MemoizationMap trait, etc.) I believe this became unused with red/green incremental introduction, but am uncertain.
2019-09-28Rollup merge of #64781 - Mark-Simulacrum:no-global-tcx, r=eddybMazdak Farrokhzad-158/+50
Remove stray references to the old global tcx
2019-09-28Move `get_slice_bytes` to `rustc::mir::interpret` so it can be reused.ben-19/+20
2019-09-28Add inline function `get_slice_bytes` to remove code duplication.ben-24/+18
2019-09-28Improve diagnostic for `let A = 0;`Mazdak Farrokhzad-0/+8
where `A` is a constant, not a new variable.
2019-09-27Introduce a `ConstPropMachine`Wesley Wiser-12/+0
This allows us to avoid changing things directly in the miri engine just for const prop.
2019-09-27Work around for #64506Wesley Wiser-0/+6
2019-09-27[const-prop] Replace `eval_place()` with use of `InterpCx`Wesley Wiser-0/+12
2019-09-28Gate llvm.sideeffect under -Z insert-sideeffectXiang Fan-0/+3
2019-09-28Add support for relating slices in `super_relate_consts`.ben-3/+36
2019-09-27Inline the remaining hir::Arm::top_pats_hackMazdak Farrokhzad-11/+0
2019-09-27cleanup dead ast-borrowck / migrate-mode code.Mazdak Farrokhzad-52/+2
2019-09-27cleanup check_match wrt. SignalledError.Mazdak Farrokhzad-2/+2
2019-09-27Remove unpretty=flowgraph.Mazdak Farrokhzad-18/+0
2019-09-27Remove shrink_to_tcx_lifetimeMark Rousskov-98/+9
There's no longer two distinct gcx and tcx lifetimes which made this necessary (or, at least, the code compiles -- it's possible we got better at normalizing, but that seems unlikely).
2019-09-27Remove stray uses of gcx nameMark Rousskov-1/+1
2019-09-27Remove lift_to_globalMark Rousskov-8/+3
2019-09-27Remove global_tcx from TyCtxtMark Rousskov-53/+39
The non-global context was removed; there's only one context now. This is a noop method that only serves to confuse readers -- remove it.
2019-09-27fix rebaseEsteban Küber-1/+1
2019-09-27review commentsEsteban Küber-4/+4
2019-09-27Account for tail expressions when pointing at return typeEsteban Küber-2/+25
When there's a type mismatch we make an effort to check if it was caused by a function's return type. This logic now makes sure to only point at the return type if the error happens in a tail expression.
2019-09-27Turn `walk_parent_nodes` method into an iteratorEsteban Küber-105/+101
2019-09-27getting more context for duplicate lang items (fixes #60561)Tomas Tauber-7/+38
Where possible, the error message includes the name of the crate that brought in the crate with duplicate lang items (which helps with debugging). This information is passed on from cstore using the `extern_crate` query.
2019-09-27Add long error explanation for E0734Guillaume Gomez-1/+17
2019-09-27Auto merge of #64813 - varkor:node-to-kind, r=Centrilbors-359/+358
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-27lowering: don't .abort_if_errors()Mazdak Farrokhzad-2/+1
2019-09-26Add note about global state in try_print_query_stackAaron Hill-0/+3
2019-09-26Auto merge of #64816 - Centril:rollup-gbeqot4, r=Centrilbors-11/+0
Rollup of 5 pull requests Successful merges: - #64221 ( Rust 2015: No longer downgrade NLL errors) - #64772 (Remove tx_to_llvm_workers from TyCtxt) - #64783 (Fix issue #64732) - #64787 (Fix ExitStatus on Fuchsia) - #64812 (Add test for E0543) Failed merges: r? @ghost
2019-09-26Use existing Handler to print query stackAaron Hill-2/+3
When the panic handler is run, the existing Handler may be in a weird state if it was responsible for triggering the panic. By using a freshly created Handler, we avoid trying to re-entrantly lock a HandlerInner, which was causing a double panic on ICEs.
2019-09-26Rename `MetaItem.node` to `MetaItem.kind`varkor-5/+5
2019-09-26Rename `ForeignItem.node` to `ForeignItem.kind`varkor-10/+10
2019-09-26Rename `Item.node` to `Item.kind`varkor-93/+94
2019-09-26Rename `Stmt.node` to `Stmt.kind`varkor-18/+18
2019-09-26Rename `Ty.node` to `Ty.kind`varkor-43/+44
2019-09-26Rename `TraitItem.node` to `TraitItem.kind`varkor-32/+32
2019-09-26Rename `Lit.node` to `Lit.kind`varkor-5/+5
2019-09-26Rename `ImplItem.node` to `ImplItem.kind`varkor-32/+35
2019-09-26Rename `Pat.node` to `Pat.kind`varkor-46/+46
2019-09-26Rename `Expr.node` to `Expr.kind`varkor-75/+69
For both `ast::Expr` and `hir::Expr`.