about summary refs log tree commit diff
path: root/src/librustc/ty
AgeCommit message (Collapse)AuthorLines
2020-01-07Rollup merge of #67909 - varkor:obsolete-const-print, r=davidtwcoYuki Okushi-12/+5
Fix ICE in const pretty printing and resolve FIXME Consts now have a `fmt::Display` impl, so we can just use that to pretty-print. This resolves an ICE in https://github.com/rust-lang/rust/issues/61936, though it hits more ICEs afterwards. I couldn't find a test case that was resolved by this that didn't hit errors later on.
2020-01-06Auto merge of #67886 - Centril:rustc_hir_canon_imports, r=nagisabors-81/+76
Nix `rustc_hir` reexports in rustc::hir r? @Zoxc cc @Mark-Simulacrum
2020-01-06Fix ICE in const pretty printing and resolve FIXMEvarkor-12/+5
Consts now have a `fmt::Display` impl, so we can just use that to pretty-print.
2020-01-05Fix typoAaron Hill-1/+1
2020-01-05Rename Instance.ty to Instance.monomorphic_tyAaron Hill-7/+3
2020-01-05s/projections/params/Aaron Hill-1/+1
2020-01-05Run rustfmtAaron Hill-1/+2
2020-01-05Change 'panic!' to 'bug!'Aaron Hill-1/+1
Co-Authored-By: Wesley Wiser <wwiser@gmail.com>
2020-01-05Fix ICE involving calling `Instance.ty` during const evaluationAaron Hill-0/+28
Fixes #67639 `Instance.ty` assumes that we are in a fully monomorphic context (e.g. codegen), and can therefore use an empty `ParamEnv` when performing normalization. Howver, the MIR constant evaluator code ends up calling `Instance.ty` as a result of us attemptign to 'speculatively' const-evaluate generic functions during const propagation. As a result, we may end up with projections involving type parameters (e.g. <T as MyTrait>::Bar>) in the type we are trying to normalize. Normalization expects us to have proper predicates in the `ParamEnv` for such projections, and will ICE if we don't. This commit adds a new method `Instance.ty_env`, which takes a `ParamEnv` for use during normalization. The MIR const-evaluator code is changed to use this method, passing in the proper `ParamEnv` for the context at hand.
2020-01-05Remove rustc_hir reexports in rustc::hir.Mazdak Farrokhzad-81/+76
2020-01-05Use self profile infrastructure for -Z time and -Z time-passesJohn Kåre Alsaker-16/+14
2020-01-04extract Export, ExportMap from hir::defMazdak Farrokhzad-3/+6
2020-01-04{HirId,ItemLocal}{Map,Set} -> rustc::hir & nix rustc::nodemapMazdak Farrokhzad-4/+3
2020-01-04DefId{Map,Set} -> rustc::hir::def_idMazdak Farrokhzad-6/+5
2020-01-04move Node{Map,Set} -> rustc_session::node_idMazdak Farrokhzad-2/+4
2020-01-04canonicalize FxHash{Map,Set} importsMazdak Farrokhzad-3/+4
2020-01-04extract rustc::middle::codegen_fn_attrsMazdak Farrokhzad-2/+3
2020-01-02Normalize `syntax::symbol` imports.Mazdak Farrokhzad-6/+6
2020-01-02Normalize `syntax::source_map` imports.Mazdak Farrokhzad-3/+3
2020-01-01Move stability queries to librustc_passes.Camille GILLOT-4/+0
Contains: - check_mod_unstable_api_usage query; - stability_index query; - check_unused_or_stable features pass.
2020-01-01Rename `syntax_pos` to `rustc_span` in source codeVadim Petrochenkov-28/+28
2019-12-30Auto merge of #67721 - JohnTitor:rollup-o8zm4r9, r=JohnTitorbors-14/+1
Rollup of 10 pull requests Successful merges: - #64273 (Stabilize attribute macros on inline modules) - #67287 (typeck: note other end-point when checking range pats) - #67564 (docs: Iterator adapters have unspecified results after a panic) - #67622 (Some keyword documentation.) - #67657 (Clean up const-hack PRs now that const if / match exist.) - #67677 (resolve: Minor cleanup of duplicate macro reexports) - #67687 (Do not ICE on lifetime error involving closures) - #67698 (Move reachable_set and diagnostic_items to librustc_passes.) - #67701 (tidy: Enforce formatting rather than just check it if `--bless` is specified) - #67715 (Typo fix) Failed merges: r? @ghost
2019-12-30Rollup merge of #67698 - cjgillot:passes-first, r=ZoxcYuki Okushi-14/+1
Move reachable_set and diagnostic_items to librustc_passes. Split out of #67688 r? @Zoxc
2019-12-30Auto merge of #67631 - oli-obk:polymorphic_promotion, r=wesleywiserbors-0/+19
Work around a resolve bug in const prop r? @wesleywiser @anp This isn't exposed right now, but further changes to rustc may start causing bugs without this.
2019-12-29Auto merge of #66942 - cjgillot:hirene-ty, r=Zoxcbors-6/+6
Allocate HIR on an arena 3/4 -- Ty This is the third PR in the series started by #66931 and #66936 Once again, commits don't really make sense on their own. They are mostly split by type of compile error. The additional diff is here: https://github.com/cjgillot/rust/compare/hirene-expr...hirene-ty
2019-12-29Move get_lib_features query in librustc_passes.Camille GILLOT-4/+0
2019-12-29Move diagnostic_items queries to librustc_passes.Camille GILLOT-8/+0
2019-12-29Move reachable_set query in librustc_passes.Camille GILLOT-2/+1
2019-12-29Auto merge of #67614 - Mark-Simulacrum:global-callbacks, r=Zoxcbors-60/+7
Set callbacks globally This sets the callbacks from syntax and rustc_errors just once, utilizing static (rather than thread-local) storage.
2019-12-27Syntax for hir::Ty.Camille GILLOT-6/+6
2019-12-27Fix `Instance::resolve()` incorrectly returning specialized instancesWesley Wiser-0/+19
We only want to return specializations when `Reveal::All` is passed, not when `Reveal::UserFacing` is. Resolving this fixes several issues with the `ConstProp`, `SimplifyBranches`, and `Inline` MIR optimization passes. Fixes #66901
2019-12-27Auto merge of #67192 - oli-obk:const_zst_addr, r=RalfJung,varkorbors-2/+2
Various const eval and pattern matching ICE fixes r? @RalfJung cc @spastorino This PR does not change existing behaviour anymore and just fixes a bunch of ICEs reachable from user code (sometimes even on stable via obscure union transmutes).
2019-12-26Syntax for hir::Expr.Camille GILLOT-8/+8
2019-12-26Retire `to_ptr` which should already have no users but still kept getting ↵Oliver Scherer-2/+2
new ones
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-25Remove `-Znll-dont-emit-read-for-match`Matthew Jasper-13/+0
2019-12-24x.py fmt after previous deignoreMark Rousskov-898/+746
2019-12-23Auto merge of #66296 - Centril:bindings_after_at-init, r=pnkfelixbors-0/+7
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 #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-23refactor with extract_binding_modeMazdak Farrokhzad-0/+7
2019-12-22Format the worldMark Rousskov-3416/+2964
2019-12-22Rollup merge of #66877 - skinny121:const-eval-entry-points, r=oli-obkMazdak Farrokhzad-16/+6
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-22Auto merge of #66931 - cjgillot:hirene-preamble, r=eddybbors-2/+2
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-21Use Arena inside hir::Item.Camille GILLOT-2/+2
2019-12-22Add simpler entry points to const eval for common usages.Ben Lewis-16/+6
2019-12-21Rollup merge of #67160 - matthewjasper:gat-generics, r=nikomatsakisMazdak Farrokhzad-6/+5
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-20Require const stability attributes on intrinsics to be able to use them in ↵Oliver Scherer-96/+2
constant contexts
2019-12-201. ast::Mutability::{Mutable -> Mut, Immutable -> Not}.Mazdak Farrokhzad-34/+34
2. mir::Mutability -> ast::Mutability.