about summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2019-10-06Update ui testsGuillaume Gomez-5/+2
2019-10-06Rollup merge of #65142 - matthewjasper:unshadow-anon-lifetimes, r=petrochenkovTyler Mandry-1/+1
Ensure that associated `async fn`s have unique fresh param names Closes #64630
2019-10-06Auto merge of #64564 - jonas-schievink:cowardly-default, r=nikomatsakisbors-30/+55
Deny specializing items not in the parent impl Part of https://github.com/rust-lang/rust/issues/29661 (https://github.com/rust-lang/rfcs/pull/2532). At least sort of? This was discussed in https://github.com/rust-lang/rust/pull/61812#discussion_r300504114 and is needed for that PR to make progress (fixing an unsoundness). One annoyance with doing this is that it sometimes requires users to copy-paste a provided trait method into an impl just to mark it `default` (ie. there is no syntax to forward this impl method to the provided trait method). cc @Centril and @arielb1
2019-10-06Add long error explanation for E0566Guillaume Gomez-1/+24
2019-10-06Auto merge of #65089 - nnethercote:optimize-integral-pattern-matching, ↵bors-19/+10
r=Mark-Simulacrum Optimize integral pattern matching Various improvements to integral pattern matching. Together they reduce instruction counts for `unicode_normalization-check-clean` by about 16%. r? @Mark-Simulacrum
2019-10-06Remove loaded_from_cache map from DepGraphMark Rousskov-31/+0
It's now unused, even with -Zquery-dep-graph
2019-10-06Fix const arguments not displaying in types mismatch diagnostic.ben-1/+18
2019-10-05Rollup merge of #65118 - cuviper:Zmutable-noalias-default, r=rkruppeTyler Mandry-1/+1
Update the documented default of -Z mutable-noalias It has been fully disabled by default since #54639.
2019-10-05Rollup merge of #65105 - Mark-Simulacrum:split-librustc, r=nikomatsakisTyler Mandry-2800/+0
Split out some passes from librustc This is just moving them out to librustc_passes -- I've not measured compile time or run time. I don't expect any significant impact, but this seems prudent regardless.
2019-10-05Rollup merge of #65100 - csmoe:generator, r=nikomatsakisTyler Mandry-60/+57
Replace GeneratorSubsts with SubstsRef Closes #42340 r? @nikomatsakis
2019-10-05Rollup merge of #64708 - SimonSapin:option-deref, r=CentrilTyler Mandry-1/+0
Stabilize `Option::as_deref` and `Option::as_deref_mut` The tracking issue https://github.com/rust-lang/rust/issues/50264 still has unresolved question for the corresponding `Result` methods.
2019-10-05Ensure that associated `async fn`s have unique fresh param namesMatthew Jasper-1/+1
2019-10-05Pacify tidyJonas Schievink-1/+4
2019-10-05Fix the bootstrapJonas Schievink-0/+8
2019-10-05Add comment to `Type` and `OpaqueTy` matchJonas Schievink-1/+1
2019-10-05Deny specializing items not in the parent implJonas Schievink-30/+44
2019-10-04Update the documented default of -Z mutable-noaliasJosh Stone-1/+1
It has been fully disabled by default since #54639.
2019-10-04middle::intrinsicck -> rustc_passesMark Rousskov-276/+0
2019-10-04middle::entry -> rustc_passesMark Rousskov-278/+0
2019-10-04middle::dead -> rustc_passesMark Rousskov-677/+0
2019-10-04move middle::liveness to rustc_passesMark Rousskov-1569/+0
2019-10-04clean up GeneratorSubstscsmoe-5/+5
2019-10-04remove GeneratorSubsts visitorscsmoe-14/+4
2019-10-04replace GeneratorSubsts inside related typescsmoe-9/+9
2019-10-04generate GeneratorSubsts from SubstsRefcsmoe-32/+31
2019-10-04replace GeneratorSubsts with SubstsRefcsmoe-2/+10
2019-10-04Introduce a special case in `IntRange::from_const`.Nicholas Nethercote-19/+10
The `if let Some(val) = value.try_eval_bits(...)` branch in `from_const()` is very hot for the `unicode_normalization` benchmark. This commit introduces a special-case alternative for scalars that avoids `try_eval_bits()` and all the functions it calls (`Const::eval()`, `ConstValue::try_to_bits()`, `ConstValue::try_to_scalar()`, and `Scalar::to_bits()`), instead extracting the result immediately. The type and value checking done by `Scalar::to_bits()` is replicated by moving it into a new function `Scalar::check_raw()` and using that new function in the special case. PR #64673 introduced some special-case handling of scalar types in `Const::try_eval_bits()`. This handling is now moved out of that function into the new `IntRange::integral_size_and_signed_bias` function. This commit reduces the instruction count for `unicode_normalization-check-clean` by about 10%.
2019-10-04Rollup merge of #65026 - petrochenkov:ice1, r=eddybMazdak Farrokhzad-3/+1
metadata: Some crate loading cleanup So, my goal was to fix caching of loaded crates which is broken and causes ICEs like #56935 or #64450. While investigating I found that the code is pretty messy and likes to confuse various things that look similar but are actually different. This PR does some initial cleanup in that area, I hope to get to the caching itself a bit later.
2019-10-04Rollup merge of #64874 - matthewjasper:simplify-euv, r=eddybMazdak Farrokhzad-463/+92
Simplify ExprUseVisitor * Remove HIR const qualification * Remove parts of ExprUseVisitor that aren't being used r? @eddyb
2019-10-04Rollup merge of #64817 - csmoe:closure, r=nikomatsakisMazdak Farrokhzad-74/+91
Replace ClosureSubsts with SubstsRef Addresses https://github.com/rust-lang/rust/issues/42340 part 3 https://github.com/rust-lang/rust/pull/59312 might benefit from this clean up. r? @nikomatsakis
2019-10-03Remove -Zprofile-queriesMark Rousskov-149/+4
2019-10-03Rollup merge of #65056 - spastorino:place-mut-visitor-adjusts, r=oli-obkTyler Mandry-20/+38
Make visit projection iterative r? @oli-obk /cc @nikomatsakis
2019-10-04metadata: Simplify interface of `resolve_crate`Vadim Petrochenkov-3/+1
2019-10-03Make visit_projection iterativeSantiago Pastorino-3/+4
2019-10-03Auto merge of #64999 - nikomatsakis:issue-60424-async-return-inference, ↵bors-17/+69
r=cramertj extract expected return type for async fn generators Fixes #60424 cc @Centril, I know you've been eager to see this fixed. r? @cramertj
2019-10-03generate ClosureSubsts from SubstsRefcsmoe-149/+84
2019-10-03Add visit_projection_elem method to visitorsSantiago Pastorino-18/+35
2019-10-03Rollup merge of #63678 - Aaron1011:fix/hrtb-leak, r=nikomatsakisMazdak Farrokhzad-4/+16
Improve HRTB error span when -Zno-leak-check is used As described in #57374, NLL currently produces unhelpful higher-ranked trait bound (HRTB) errors when '-Zno-leak-check' is enabled. This PR tackles one half of this issue - making the error message point at the proper span. The error message itself is still the very generic "higher-ranked subtype error", but this can be improved in a follow-up PR. The root cause of the bad spans lies in how NLL attempts to compute the 'blamed' region, for which it will retrieve a span for. Consider the following code, which (correctly) does not compile: ```rust let my_val: u8 = 25; let a: &u8 = &my_val; let b = a; let c = b; let d: &'static u8 = c; ``` This will cause NLL to generate the following subtype constraints: d :< c c :< b b <: a Since normal Rust lifetimes are covariant, this results in the following region constraints (I'm using 'd to denote the lifetime of 'd', 'c to denote the lifetime of 'c, etc.): 'c: 'd 'b: 'c 'a: 'b From this, we can derive that 'a: 'd holds, which implies that 'a: 'static must hold. However, this is not the case, since 'a refers to 'my_val', which does not outlive the current function. When NLL attempts to infer regions for this code, it will see that the region 'a has grown 'too large' - it will be inferred to outlive 'static, despite the fact that is not declared as outliving 'static We can find the region responsible, 'd, by starting at the *end* of the 'constraint chain' we generated above. This works because for normal (non-higher-ranked) lifetimes, we generally build up a 'chain' of lifetime constraints *away* from the original variable/lifetime. That is, our original lifetime 'a is required to outlive progressively more regions. If it ends up living for too long, we can look at the 'end' of this chain to determine the 'most recent' usage that caused the lifetime to grow too large. However, this logic does not work correctly when higher-ranked trait bounds (HRTBs) come into play. This is because HRTBs have *contravariance* with respect to their bound regions. For example, this code snippet compiles: ```rust let a: for<'a> fn(&'a ()) = |_| {}; let b: fn(&'static ()) = a; ``` Here, we require that 'a' is a subtype of 'b'. Because of contravariance, we end up with the region constraint 'static: 'a, *not* 'a: 'static This means that our 'constraint chains' grow in the opposite direction of 'normal lifetime' constraint chains. As we introduce subtypes, our lifetime ends up being outlived by other lifetimes, rather than outliving other lifetimes. Therefore, starting at the end of the 'constraint chain' will cause us to 'blame' a lifetime close to the original definition of a variable, instead of close to where the bad lifetime constraint is introduced. This PR improves how we select the region to blame for 'too large' universal lifetimes, when bound lifetimes are involved. If the region we're checking is a 'placeholder' region (e.g. the region 'a' in for<'a>, or the implicit region in fn(&())), we start traversing the constraint chain from the beginning, rather than the end. There are two (maybe more) different ways we generate region constraints for NLL: requirements generated from trait queries, and requirements generated from MIR subtype constraints. While the former always use explicit placeholder regions, the latter is more tricky. In order to implement contravariance for HRTBs, TypeRelating replaces placeholder regions with existential regions. This requires us to keep track of whether or not an existential region was originally a placeholder region. When we look for a region to blame, we check if our starting region is either a placeholder region or is an existential region created from a placeholder region. If so, we start iterating from the beginning of the constraint chain, rather than the end.
2019-10-02s/`async` fn/`async fn`/Niko Matsakis-1/+1
2019-10-02document `shallow_resolve`Niko Matsakis-0/+11
2019-10-02improve comments on `GeneratorKind` and `AsyncGeneratorKind`Niko Matsakis-3/+5
2019-10-02Rollup merge of #64989 - sinkuu:fix_ice_64964, r=davidtwcoMazdak Farrokhzad-0/+6
Fix ICE #64964 Fixes #64964, which is an ICE with `await`ing in a method + incr-comp.
2019-10-02Rollup merge of #64961 - rust-lang:spastorino-patch-1, r=oli-obkMazdak Farrokhzad-1/+2
Make comment about dummy type a bit more clear
2019-10-02Rollup merge of #64850 - Mark-Simulacrum:dedup-dep-node, r=michaelwoeristerMazdak Farrokhzad-22/+18
Remove inlines from DepNode code
2019-10-02Rollup merge of #64581 - ztlpn:fix-ok-wrapping-unreachable-code, r=CentrilMazdak Farrokhzad-11/+28
Fix unreachable_code warnings for try{} block ok-wrapped expressions Fixes #54165 and fixes #63324.
2019-10-02WIP tidy hir/lowering/expr.rsNiko Matsakis-4/+6
2019-10-02track the kind of async generator we are creatingNiko Matsakis-13/+50
2019-10-02Remove inline annotations from dep_nodeMark Rousskov-22/+18
2019-10-02Fix async/await ICE #64964Shotaro Yamada-0/+6
2019-10-02Compute the layout of uninhabited structsOliver Scherer-10/+12