about summary refs log tree commit diff
path: root/src/librustc_traits
AgeCommit message (Collapse)AuthorLines
2020-01-08normalize rustc::hir::intravisit importsMazdak Farrokhzad-1/+1
2020-01-08intravisit: abstract over HIR MapMazdak Farrokhzad-1/+4
2020-01-07Move ty::wf to traits.Camille GILLOT-1/+1
2020-01-05Remove rustc_hir reexports in rustc::hir.Mazdak Farrokhzad-17/+18
2020-01-04canonicalize FxHash{Map,Set} importsMazdak Farrokhzad-1/+1
2020-01-02Normalize `syntax::symbol` imports.Mazdak Farrokhzad-1/+1
2020-01-02Normalize `syntax::source_map` imports.Mazdak Farrokhzad-3/+3
2020-01-01Rename `syntax_pos` to `rustc_span` in source codeVadim Petrochenkov-6/+6
2019-12-30Make things build againVadim Petrochenkov-1/+1
2019-12-22Format the worldMark Rousskov-836/+513
2019-12-21Use Arena inside hir::StructField.Camille GILLOT-1/+1
2019-12-21Use Arena inside hir::ImplItem.Camille GILLOT-1/+1
2019-12-21Use Arena inside hir::TraitItem.Camille GILLOT-1/+1
2019-12-21Use Arena inside hir::Item.Camille GILLOT-1/+1
2019-12-201. ast::Mutability::{Mutable -> Mut, Immutable -> Not}.Mazdak Farrokhzad-2/+2
2. mir::Mutability -> ast::Mutability.
2019-11-18Retire BraceStructLiftImpl.Camille GILLOT-10/+2
2019-11-17Auto merge of #66384 - cjgillot:typefoldable, r=Zoxcbors-7/+3
Derive TypeFoldable using a proc-macro A new proc macro is added in librustc_macros. It is used to derive TypeFoldable inside librustc and librustc_traits. For now, the macro uses the `'tcx` lifetime implicitly, and does not allow for a more robust selection of the adequate lifetime. The Clone-based TypeFoldable implementations are not migrated. Closes #65674
2019-11-13Use TypeFoldable derive macro in librustc_traits.Camille GILLOT-7/+3
2019-11-12Rename in librustc_traits.Camille GILLOT-6/+4
2019-11-10Merge hir::GeneratorMovability into ast::Movability.Camille GILLOT-1/+1
2019-11-10Merge hir::Mutability into ast::Mutability.Camille GILLOT-2/+2
2019-11-06Rollup merge of #66086 - RalfJung:smallvec, r=nagisaMazdak Farrokhzad-1/+1
bump smallvec to 1.0 This includes https://github.com/servo/rust-smallvec/pull/162, fixing an unsoundness in smallvec. See https://github.com/servo/rust-smallvec/pull/175 for the 1.0 release announcement. Cc @mbrubeck @emilio
2019-11-04bump smallvec to 1.0Ralf Jung-1/+1
2019-11-01De-querify `trivial_dropck_outlives`.Nicholas Nethercote-1/+2
It's sufficiently simple and fast that memoizing it is a slight pessimization.
2019-10-21Rename `ConstValue::Infer(InferConst::Canonical(..))` to `ConstValue::Bound(..)`varkor-15/+6
2019-10-18rustc: arena-allocate the slice in `ty::GenericsPredicate`, not the whole ↵Eduard-Mihai Burtescu-2/+2
struct.
2019-10-12Keep allocated vectors during dropckMark Rousskov-61/+50
Previously we'd frequently throw away vectors which is bad for performance
2019-10-12Make trivial dropck outlives a queryMark Rousskov-0/+4
This allows caching some recursive types and getting to an error much more quickly.
2019-10-08Rollup merge of #65181 - nikomatsakis:lazy-norm-anon-const-push-1, r=varkorMazdak Farrokhzad-0/+2
fix bug in folding for constants These was a bug in the folding for constants that caused it to overlook bound regions. This branch includes some other little things that I did while trying to track the bug down. r? @oli-obk
2019-10-07add `debug!` to evaluate_obligationNiko Matsakis-0/+2
2019-10-04clean up GeneratorSubstscsmoe-4/+6
2019-10-04Rollup merge of #64817 - csmoe:closure, r=nikomatsakisMazdak Farrokhzad-5/+6
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-03generate ClosureSubsts from SubstsRefcsmoe-2/+5
2019-10-01Improve HRTB error span when -Zno-leak-check is usedAaron Hill-1/+1
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-09-29remove ClosureSubsts with SubstsRefcsmoe-3/+1
2019-09-27Remove lift_to_globalMark Rousskov-1/+1
2019-09-26Rename `ForeignItem.node` to `ForeignItem.kind`varkor-1/+1
2019-09-26Rename `Item.node` to `Item.kind`varkor-1/+1
2019-09-26Rename `TraitItem.node` to `TraitItem.kind`varkor-1/+1
2019-09-26Rename `ImplItem.node` to `ImplItem.kind`varkor-1/+1
2019-09-26Auto merge of #64515 - varkor:kindedterm, r=oli-obkbors-21/+21
Rename `subst::Kind` to `subst::GenericArg` And `subst::UnpackedKind` to `subst::GenericArgKind`. Individual variable names (e.g. `kind`) are not renamed, which would be an infeasible mission. Fixes https://github.com/rust-lang/rust/issues/64352. r? @eddyb
2019-09-26Rename `subst::Kind` to `subst::GenericArg`varkor-21/+21
2019-09-26Auto merge of #62661 - arielb1:never-reserve, r=nikomatsakisbors-2/+2
reserve `impl<T> From<!> for T` this is necessary for never-type stabilization. cc #57012 #35121 I think we wanted a crater run for this @nikomatsakis? r? @nikomatsakis
2019-09-25Rename `sty` to `kind`varkor-11/+11
2019-09-24remove outdated fixmeNiko Matsakis-1/+0
2019-09-24resolve the rustc_reservation_impl attribute in 1 placeAriel Ben-Yehuda-2/+3
2019-09-23Remove unused dependenciesShotaro Yamada-2/+0
2019-08-05Fiddle param env through to `try_eval_bits` in most placesOliver Scherer-0/+5
2019-08-02Replace "existential" by "opaque"varkor-1/+1
2019-07-28Deny `unused_lifetimes` through rustbuildVadim Petrochenkov-2/+0