about summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2019-12-26Treat extern statics just like statics in the "const pointer to static" ↵Oliver Scherer-2/+0
representation
2019-12-25Fix skipped setting of syntax::GLOBALSMark Rousskov-2/+4
2019-12-25Store callbacks in global staticsMark Rousskov-58/+3
The callbacks have precisely two states: the default, and the one present throughout almost all of the rustc run (the filled in value which has access to TyCtxt). We used to store this as a thread local, and reset it on each thread to the non-default value. But this is somewhat wasteful, since there is no reason to set it globally -- while the callbacks themselves access TLS, they do not do so in a manner that fails in when we do not have TLS to work with.
2019-12-25rewrite scalar to integer methodsChristian Poveda-28/+29
2019-12-25Add Scalar::to_(u|i)16 methodsChristian Poveda-0/+13
2019-12-25Remove `-Znll-dont-emit-read-for-match`Matthew Jasper-13/+0
2019-12-24x.py fmt after previous deignoreMark Rousskov-2197/+1744
2019-12-24Rollup merge of #67543 - JohnTitor:regression-tests, r=CentrilMazdak Farrokhzad-1/+1
Add regression tests for fixed ICEs Closes #61747 (fixed from 1.41.0-nightly (4007d4ef2 2019-12-01)) Closes #66205 (fixed from 1.41.0-nightly (4007d4ef2 2019-12-01)) Closes #66270 (fixed by #66246) Closes #67424 (fixed by #67160) Also picking a minor nit up from #67071 with 101dd7bad9432730fa2f625ae43afcc2929457d4 r? @Centril
2019-12-23Auto merge of #66296 - Centril:bindings_after_at-init, r=pnkfelixbors-2/+18
Initial implementation of `#![feature(bindings_after_at)]` Following up on #16053, under the gate `#![feature(bindings_after_at)]`, `x @ Some(y)` is allowed subject to restrictions necessary for soundness. The implementation and test suite should be fairly complete now. One aspect that is not covered is the interaction with nested `#![feature(or_patterns)]`. This is not possible to test at the moment in a good way because that feature has not progressed sufficiently and has fatal errors in MIR building. We should make sure to add such tests before we stabilize both features (but shipping one of them is fine). r? @pnkfelix cc @nikomatsakis @matthewjasper @pcwalton cc https://github.com/rust-lang/rust/issues/65490
2019-12-23Rollup merge of #67538 - varkor:lhs-assign-diagnostics, r=CentrilMazdak Farrokhzad-10/+14
Improve diagnostics for invalid assignment - Improve wording and span information for invalid assignment diagnostics. - Link to https://github.com/rust-lang/rfcs/issues/372 when it appears the user is trying a destructuring assignment. - Make the equality constraint in `where` clauses error consistent with the invalid assignment error.
2019-12-23Rollup merge of #67536 - Centril:move-is_range_literal, r=Mark-SimulacrumMazdak Farrokhzad-64/+64
Move `{hir::lowering -> hir}::is_range_literal` The function is never used inside lowering, but only ever in external crates. By moving it, we facilitate lowering as its own crate. Best read commit-by-commit. r? @Mark-Simulacrum
2019-12-23Rollup merge of #67466 - oli-obk:const_intrinsic, r=CentrilMazdak Farrokhzad-96/+2
Require const stability attributes on intrinsics to be able to use them in constant contexts r? @Centril finally fixes #61495 cc @RalfJung
2019-12-23improve robustness of pat walkersMazdak Farrokhzad-2/+11
2019-12-23refactor with extract_binding_modeMazdak Farrokhzad-0/+7
2019-12-23is_range_literal: leave FIXMEMazdak Farrokhzad-0/+3
2019-12-23is_range_literal: fix falloutMazdak Farrokhzad-12/+9
2019-12-23Add new folder for destructuring assignment testsvarkor-0/+1
2019-12-23Add span information to `ExprKind::Assign`varkor-10/+13
2019-12-23Move `{hir::lowering -> hir}::is_range_literal`.Mazdak Farrokhzad-62/+62
The function is never used inside lowering, but only ever in external crates. By moving it, we faciliate lowering as its own crate.
2019-12-22Format the worldMark Rousskov-12883/+11239
2019-12-23Use `is_none` instead of `if let`Yuki Okushi-1/+1
2019-12-22Rollup merge of #67299 - christianpoveda:try_immty_from_int, r=RalfJungMazdak Farrokhzad-11/+27
Add `ImmTy::try_from_(u)int` methods r? @RalfJung
2019-12-22Rollup merge of #66877 - skinny121:const-eval-entry-points, r=oli-obkMazdak Farrokhzad-57/+120
Add simpler entry points to const eval for common usages. I found the `tcx.const_eval` API to be complex/awkward to work with, because of the inherent complexity from all of the different situations it is called from. Though it mainly used in one of the following ways: - Evaluates the value of a constant without any substitutions, e.g. evaluating a static, discriminant, etc. - Evaluates the value of a resolved instance of a constant. this happens when evaluating unevaluated constants or normalising trait constants. - Evaluates a promoted constant. This PR adds three new functions `const_eval_mono`, `const_eval_resolve`, and `const_eval_promoted` to `TyCtxt`, which each cater to one of the three ways `tcx.const_eval` is normally used.
2019-12-22Add error message if `Scalar::from_(u)int` failsChristian Poveda-2/+8
2019-12-22Auto merge of #66931 - cjgillot:hirene-preamble, r=eddybbors-454/+507
Allocate HIR on an arena 1/4 This PR is the first in a series of 4, aiming at allocating the HIR on an arena, as a memory optimisation. 1. This first PR lays the groundwork and migrates some low-hanging fruits. 2. The second PR will migrate `hir::Expr`, `hir::Pat` and related. 3. The third PR will migrate `hir::Ty` and related. 4. The final PR will be dedicated to eventual cleanups. In order to make the transition as gradual as possible, some lowering routines receive `Box`-allocated data and move it into the arena. This is a bit wasteful, but hopefully temporary. Nonetheless, special care should be taken to avoid double arena allocations. Work mentored by @Zoxc.
2019-12-21Nits.Camille GILLOT-4/+5
2019-12-21Tidy.Camille GILLOT-21/+39
2019-12-21Use Arena inside hir::Body.Camille GILLOT-32/+36
2019-12-21Use Arena inside hir::Mod.Camille GILLOT-17/+17
2019-12-21Use Arena inside hir::StructField.Camille GILLOT-23/+24
2019-12-21Use Arena inside hir::EnumDef.Camille GILLOT-50/+54
2019-12-21Use Arena inside hir::ImplItem.Camille GILLOT-43/+45
2019-12-21Use Arena inside hir::TraitItem.Camille GILLOT-44/+45
2019-12-21Use Arena inside hir::ForeignItem.Camille GILLOT-39/+42
2019-12-21Handle Attributes in arena.Camille GILLOT-33/+32
2019-12-21Use Arena inside hir::Item.Camille GILLOT-101/+111
2019-12-22Add simpler entry points to const eval for common usages.Ben Lewis-57/+120
2019-12-21Use Arena inside hir::Crate.Camille GILLOT-73/+83
2019-12-21Rollup merge of #67160 - matthewjasper:gat-generics, r=nikomatsakisMazdak Farrokhzad-11/+52
Make GATs less ICE-prone. After this PR simple lifetime-generic associated types can now be used in a compiling program. There are two big limitations: * #30472 has not been addressed in any way (see src/test/ui/generic-associated-types/iterable.rs) * Using type- and const-generic associated types errors because bound types and constants aren't handled by trait solving. * The errors are technically non-fatal, but they happen in a [part of the compiler](https://github.com/rust-lang/rust/blob/4abb0ad2731e9ac6fd5d64d4cf15b7c82e4b5a81/src/librustc_typeck/lib.rs#L298) that fairly aggressively stops compiling on errors. closes #47206 closes #49362 closes #62521 closes #63300 closes #64755 closes #67089
2019-12-21Change results to optionsChristian Poveda-6/+6
2019-12-21Rollup merge of #67355 - Centril:merge-mut, r=oli-obkMazdak Farrokhzad-79/+63
Merge `ast::Mutability` and `mir::Mutability` r? @oli-obk
2019-12-21Auto merge of #66994 - Centril:stmt-polish, r=estebankbors-27/+18
refactor expr & stmt parsing + improve recovery Summary of important changes (best read commit-by-commit, ignoring whitespace changes): - `AttrVec` is introduces as an alias for `ThinVec<Attribute>` - `parse_expr_bottom` and `parse_stmt` are thoroughly refactored. - Extract diagnostics logic for `vec![...]` in a pattern context. - Recovery is added for `do catch { ... }` - Recovery is added for `'label: non_block_expr` - Recovery is added for `var $local`, `auto $local`, and `mut $local`. Fixes #65257. - Recovery is added for `e1 and e2` and `e1 or e2`. - ~~`macro_legacy_warnings` is turned into an error (has been a warning for 3 years!)~~ - Fixes #63396 by forward-porting #64105 which now works thanks to added recovery. - `ui-fulldeps/ast_stmt_expr_attr.rs` is turned into UI and pretty tests. - Recovery is fixed for `#[attr] if expr {}` r? @estebank
2019-12-20Require const stability attributes on intrinsics to be able to use them in ↵Oliver Scherer-96/+2
constant contexts
2019-12-20introduce 'type AttrVec'Mazdak Farrokhzad-27/+18
2019-12-201. ast::Mutability::{Mutable -> Mut, Immutable -> Not}.Mazdak Farrokhzad-79/+63
2. mir::Mutability -> ast::Mutability.
2019-12-20Rollup merge of #67428 - Centril:ibp-explicit-match, r=matthewjasperMazdak Farrokhzad-1/+9
`is_binding_pat`: use explicit match & include or-pats in grammar r? @matthewjasper @nikomatsakis
2019-12-20Rollup merge of #67392 - csmoe:async-typeinfo, r=estebankMazdak Farrokhzad-0/+10
Fix unresolved type span inside async object Closes #65180 r? @estebank It's hard to create a minimal repro for that issue, [decided](https://rust-lang.zulipchat.com/#narrow/stream/187312-wg-async-foundations/topic/meeting.202019.2E12.2E17/near/183675659) to give up finding mcve. cc [previous take](https://github.com/rust-lang/rust/pull/65668)
2019-12-20Use `delay_span_bug` less oftenMatthew Jasper-8/+23
2019-12-20Correctly lower paths to generic associated typesMatthew Jasper-3/+3
2019-12-20Check associated type implementations for generic mismatchesMatthew Jasper-0/+26