about summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2019-06-24HirIdification: miscellaneous bitsljedrz-7/+5
2019-06-24HIR: rename find_by_hir_id to findljedrz-29/+29
2019-06-24HIR: remove the NodeId findljedrz-6/+0
2019-06-24HIR: rename get_parent_node_by_hir_id to get_parent_nodeljedrz-14/+14
2019-06-24HIR: remove the NodeId get_parent_node, HirIdify is_argumentljedrz-16/+9
2019-06-24Auto merge of #62075 - Centril:guardless-match-arms, r=petrochenkovbors-1/+1
Remove `ast::Guard` With the introduction of `ast::ExprKind::Let` in https://github.com/rust-lang/rust/pull/60861, the `ast::Guard` structure is now redundant in terms of representing [`if let` guards](https://github.com/rust-lang/rust/issues/51114) in AST since it can be represented by `ExprKind::Let` syntactically. Therefore, we remove `ast::Guard` here. However, we keep `hir::Guard` because the semantic representation is a different matter and this story is more unclear right now (might involve `goto 'arm` in HIR or something...). r? @petrochenkov
2019-06-23Replace Vec<Vec<_>> with Vec<_>Aaron Hill-18/+9
2019-06-23Fix typos pointed out by @varkorAaron Hill-9/+9
Co-Authored-By: varkor <github@varkor.com>
2019-06-23clean up internals of pointer checks; make get_size_and_align also check for ↵Ralf Jung-15/+3
fn allocations
2019-06-23move CheckInAllocMsg to more logical placeRalf Jung-25/+25
2019-06-23Centralize bounds, alignment and NULL checking for memory accesses in one ↵Ralf Jung-49/+51
function: memory.check_ptr_access That function also takes care of converting a Scalar to a Pointer, should that be needed. Not all accesses need that though: if the access has size 0, None is returned. Everyone accessing memory based on a Scalar should use this method to get the Pointer they need. All operations on the Allocation work on Pointer inputs and expect all the checks to have happened (and will ICE if the bounds are violated). The operations on Memory work on Scalar inputs and do the checks themselves. The only other public method to check pointers is memory.ptr_may_be_null, which is needed in a few places. With this, we can make all the other methods (tests for a pointer being in-bounds and checking alignment) private helper methods, used to implement the two public methods. That maks the public API surface much easier to use and harder to mis-use. While I am at it, this also removes the assumption that the vtable part of a `dyn Trait`-fat-pointer is a `Pointer` (as opposed to a pointer cast to an integer, stored as raw bits).
2019-06-23Auto merge of #60861 - Centril:let-chains-ast-intro, r=petrochenkovbors-140/+140
[let_chains, 2/6] Introduce `Let(..)` in AST, remove IfLet + WhileLet and parse let chains Here we remove `ast::ExprKind::{IfLet, WhileLet}` and introduce `ast::ExprKind::Let`. Moreover, we also: + connect the parsing logic for let chains + introduce the feature gate + rewire HIR lowering a bit. However, this does not connect the new syntax to semantics in HIR. That will be the subject of a subsequent PR. Per https://github.com/rust-lang/rust/issues/53667#issuecomment-471583239. Next step after https://github.com/rust-lang/rust/pull/59288. cc @Manishearth re. Clippy. r? @oli-obk
2019-06-23Remove redundant syntax::ast::Guard.Mazdak Farrokhzad-1/+1
2019-06-23Rollup merge of #62068 - ia0:fix_meta_var, r=petrochenkovMazdak Farrokhzad-1/+1
Fix meta-variable binding errors in macros The errors are either: - The meta-variable used in the right-hand side is not bound (or defined) in the left-hand side. - The meta-variable used in the right-hand side does not repeat with the same kleene operator as its binder in the left-hand side. Either it does not repeat enough, or it uses a different operator somewhere. This change should have no semantic impact. Found by https://github.com/rust-lang/rust/pull/62008
2019-06-23Fix meta-variable binding errors in macrosJulien Cretin-1/+1
The errors are either: - The meta-variable used in the right-hand side is not bound (or defined) in the left-hand side. - The meta-variable used in the right-hand side does not repeat with the same kleene operator as its binder in the left-hand side. Either it does not repeat enough, or it uses a different operator somewhere. This change should have no semantic impact.
2019-06-23let_chains: Remove ast_validation logic in favor of lowering with recovery.Mazdak Farrokhzad-8/+40
2019-06-23let_chains: Adjust lowering logic in lieu of ::Let.Mazdak Farrokhzad-138/+106
2019-06-22Fix fallout from rebaseAaron Hill-4/+4
2019-06-22Change how we compute yield_in_scopeAaron Hill-1/+116
Compound operators (e.g. 'a += b') have two different possible evaluation orders. When the left-hand side is a primitive type, the expression is evaluated right-to-left. However, when the left-hand side is a non-primitive type, the expression is evaluated left-to-right. This causes problems when we try to determine if a type is live across a yield point. Since we need to perform this computation before typecheck has run, we can't simply check the types of the operands. This commit calculates the most 'pessimistic' scenario - that is, erring on the side of treating more types as live, rather than fewer. This is perfectly safe - in fact, this initial liveness computation is already overly conservative (e.g. issue #57478). The important thing is that we compute a superset of the types that are actually live across yield points. When we generate MIR, we'll determine which types actually need to stay live across a given yield point, and which ones cam actually be dropped. Concretely, we force the computed HIR traversal index for right-hand-side yield expression to be equal to the maximum index for the left-hand side. This covers both possible execution orders: * If the expression is evalauted right-to-left, our 'pessismitic' index is unecessary, but safe. We visit the expressions in an ExprKind::AssignOp from right to left, so it actually would have been safe to do nothing. However, while increasing the index of a yield point might cause the compiler to reject code that could actually compile, it will never cause incorrect code to be accepted. * If the expression is evaluated left-to-right, our 'pessimistic' index correctly ensures that types in the left-hand-side are seen as occuring before the yield - which is exactly what we want
2019-06-22Fix HIR visit orderAaron Hill-1/+1
Fixes #61442 When rustc::middle::region::ScopeTree ccomputes its yield_in_scope field, it relies on the HIR visitor order to properly compute which types must be live across yield points. In order for the computed scopes to agree with the generated MIR, we must ensure that expressions evaluated before a yield point are visited before the 'yield' expression. However, the visitor order for ExprKind::AssignOp was incorrect. The left-hand side of a compund assignment expression is evaluated before the right-hand side, but the right-hand expression was being visited before the left-hand expression. If the left-hand expression caused a new type to be introduced (e.g. through a deref-coercion), the new type would be incorrectly seen as occuring *after* the yield point, instead of before. This leads to a mismatch between the computed generator types and the MIR, since the MIR will correctly see the type as being live across the yield point. To fix this, we correct the visitor order for ExprKind::AssignOp to reflect the actual evaulation order.
2019-06-22Deny explicit_outlives_requirements in the compilerMatthew Jasper-8/+7
2019-06-22Count all errors for `track_errors`Matthew Jasper-0/+1
2019-06-22Prefer to use `has_errors` to `err_count`Matthew Jasper-9/+6
2019-06-22Rollup merge of #62019 - jeremystucki:refactoring, r=estebankMazdak Farrokhzad-25/+25
Remove needless lifetimes
2019-06-22Rollup merge of #61984 - ljedrz:more_node_id_pruning, r=ZoxcMazdak Farrokhzad-91/+53
More NodeId pruning Just another round of the `HirId`ification initiative. r? @Zoxc
2019-06-22Rollup merge of #61270 - michaelwoerister:remove-incr-comp-warning, r=oli-obkMazdak Farrokhzad-18/+2
Remove warnings about incr. comp. generating less debugging output. This PR removes the > `-C save-temps` might not produce all requested temporary products when incremental compilation is enabled.` warning and others similar to it. I think these warnings have annoyed lots of people over the past ~3 years; while not helping a single one of them `:P` r? @oli-obk
2019-06-21Auto merge of #61959 - oli-obk:const_field_ice, r=eddybbors-24/+39
Fix a hash collision issue on the `const_field` query fixes #61530
2019-06-21Remove needless lifetimesJeremy Stucki-25/+25
2019-06-21Remove warnings about incr. comp. generating less debugging output.Michael Woerister-18/+2
2019-06-21Further reduce the likelyhood of hash collisionsOliver Scherer-0/+1
2019-06-21Stabilize profile-guided optimization.Michael Woerister-18/+17
2019-06-21Documentation typoOliver Scherer-1/+1
2019-06-20Rollup merge of #61979 - spastorino:fmt-place-base, r=oli-obkMazdak Farrokhzad-23/+25
Implement Debug for PlaceBase r? @oli-obk More tiny bits that can be extracted from Place 2.0 PR
2019-06-20Implement Debug for PlaceBaseSantiago Pastorino-23/+25
2019-06-20rename hir::map::get_by_hir_id to getljedrz-28/+28
2019-06-20remove hir::map::getljedrz-7/+1
2019-06-20make blocks::Code work with HirIdljedrz-4/+4
2019-06-20rename hir::map::expect_expr_by_hir_id to expect_exprljedrz-3/+3
2019-06-20remove uses of the NodeId hir::map::exprljedrz-6/+0
2019-06-20remove definitions::def_index_to_node_id (unused)ljedrz-5/+0
2019-06-20make hir::def_kind work with HirIdljedrz-5/+5
2019-06-20rename hir::map::name_by_hir_id to ::nameljedrz-12/+12
2019-06-20remove hir::map::nameljedrz-7/+0
2019-06-20replace NodeId with HirId in infer::SubregionOriginljedrz-3/+3
2019-06-20remove TyCtx::expr_span (unused)ljedrz-14/+0
2019-06-20replace NodeId with HirId in traits::ObligationCauseCodeljedrz-4/+4
2019-06-20Rollup merge of #61968 - eddyb:hir-noclone, r=petrochenkovMazdak Farrokhzad-217/+198
rustc: disallow cloning HIR nodes. Besides being inefficient, cloning also risks creating broken HIR (without properly recreating all the IDs and whatnot, in which case you might as well reconstruct the entire node without ever `Clone`-ing anything). We detect *some* detrimental situations (based on the occurrence of `HirId`s, I believe?), but it's better to statically disallow it, IMO. One of the examples that is fixed by this PR is `tcx.hir().fn_decl{,_by_hir_id}`, which was cloning an entire `hir::FnDecl` *every single time it was called*. r? @petrochenkov cc @rust-lang/compiler
2019-06-19Pacify tidyOliver Scherer-5/+6
2019-06-19rustc: disallow cloning HIR nodes.Eduard-Mihai Burtescu-176/+172
2019-06-19rustc: replace `GenericArgs::with_generic_args` hack with a plain getter.Eduard-Mihai Burtescu-41/+26