about summary refs log tree commit diff
path: root/src/librustc/traits
AgeCommit message (Collapse)AuthorLines
2019-10-15Handle `Self` restriction neededEsteban Küber-0/+28
2019-10-15Handle more cases involving `impl` and `trait`Esteban Küber-67/+80
2019-10-15Handle more casesEsteban Küber-1/+10
2019-10-15Use structured suggestion for restricting boundsEsteban Küber-2/+95
When a trait bound is not met and restricting a type parameter would make the restriction hold, use a structured suggestion pointing at an appropriate place (type param in param list or `where` clause). Account for opaque parameters where instead of suggesting extending the `where` clause, we suggest appending the new restriction: `fn foo(impl Trait + UnmetTrait)`.
2019-10-12Make trivial dropck outlives a queryMark Rousskov-6/+13
This allows caching some recursive types and getting to an error much more quickly.
2019-10-10Auto merge of #65077 - estebank:mut-trait-expected, r=nikomatsakisbors-22/+100
Note when a mutable trait object is needed Fix https://github.com/rust-lang/rust/issues/63619, fix https://github.com/rust-lang/rust/issues/37914. CC https://github.com/rust-lang/rust/issues/64068.
2019-10-09Only suggest change mut if vars are resolvedEsteban Küber-0/+6
2019-10-09Obligation must apply modulo regionsEsteban Küber-2/+4
2019-10-09Tweak wordingEsteban Küber-1/+2
2019-10-09Note when a mutable trait object is neededEsteban Küber-21/+90
2019-10-08Remove `InferCtxt::in_snapshot()`.Nicholas Nethercote-17/+18
It's the same as `InferCtxt::commit_unconditionally()` except that it is passed a snapshot and has a worse name. The commit also changes `commit_unconditionally()` to receive a snapshot, for consistency with `commit_if_ok()` and `probe()`.
2019-10-06Auto merge of #64564 - jonas-schievink:cowardly-default, r=nikomatsakisbors-30/+44
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-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-04remove GeneratorSubsts visitorscsmoe-1/+1
2019-10-04replace GeneratorSubsts inside related typescsmoe-1/+1
2019-10-04generate GeneratorSubsts from SubstsRefcsmoe-5/+6
2019-10-04Rollup merge of #64817 - csmoe:closure, r=nikomatsakisMazdak Farrokhzad-8/+20
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-11/+19
2019-10-01Rollup merge of #64937 - estebank:dedup-closure-err, r=CentrilMazdak Farrokhzad-0/+8
Deduplicate closure type errors Closure typing obligations flow in both direcitons to properly infer types. Because of this, we will get 2 type errors whenever there's an unfulfilled obligation. To avoid this, we deduplicate them in the `InferCtxt`.
2019-10-01Rollup merge of #64895 - davidtwco:issue-64130-async-error-definition, ↵Mazdak Farrokhzad-12/+165
r=nikomatsakis async/await: improve not-send errors cc #64130. ``` note: future does not implement `std::marker::Send` because this value is used across an await --> $DIR/issue-64130-non-send-future-diags.rs:15:5 | LL | let g = x.lock().unwrap(); | - has type `std::sync::MutexGuard<'_, u32>` LL | baz().await; | ^^^^^^^^^^^ await occurs here, with `g` maybe used later LL | } | - `g` is later dropped here ``` r? @nikomatsakis
2019-09-30Deduplicate closure type errorsEsteban Küber-0/+8
Closure typing obligations flow in both direcitons to properly infer types. Because of this, we will get 2 type errors whenever there's an unfulfilled obligation. To avoid this, we deduplicate them in the `InferCtxt`.
2019-09-30async/await: improve obligation errorsDavid Wood-12/+165
This commit improves obligation errors for async/await: ``` note: future does not implement `std::marker::Send` because this value is used across an await --> $DIR/issue-64130-non-send-future-diags.rs:15:5 | LL | let g = x.lock().unwrap(); | - has type `std::sync::MutexGuard<'_, u32>` LL | baz().await; | ^^^^^^^^^^^ await occurs here, with `g` maybe used later LL | } | - `g` is later dropped here ``` Signed-off-by: David Wood <david@davidtw.co>
2019-09-29remove ClosureSubsts with SubstsRefcsmoe-3/+6
2019-09-29introduce from_ref helper for replacementcsmoe-3/+4
2019-09-29remove bit_set re-export from rustc_data_structurescsmoe-1/+1
2019-09-29Auto merge of #64546 - weiznich:bugfix/rfc-2451-rerebalance-tests, ↵bors-1/+9
r=nikomatsakis Bugfix/rfc 2451 rerebalance tests r? @nikomatsakis Fixes #64412 Depends/Contains on #64414 cc #55437 and #63599
2019-09-28Switch over all StableHash impls to new formatMark Rousskov-10/+4
2019-09-28Rollup merge of #64794 - Mark-Simulacrum:rm-dep-track-map, r=estebankMazdak Farrokhzad-28/+1
Remove unused DepTrackingMap Deletes some related code (MemoizationMap trait, etc.) I believe this became unused with red/green incremental introduction, but am uncertain.
2019-09-27Remove shrink_to_tcx_lifetimeMark Rousskov-98/+9
There's no longer two distinct gcx and tcx lifetimes which made this necessary (or, at least, the code compiles -- it's possible we got better at normalizing, but that seems unlikely).
2019-09-27Remove stray uses of gcx nameMark Rousskov-1/+1
2019-09-27Remove global_tcx from TyCtxtMark Rousskov-16/+12
The non-global context was removed; there's only one context now. This is a noop method that only serves to confuse readers -- remove it.
2019-09-26Rename `Item.node` to `Item.kind`varkor-4/+4
2019-09-26Rename `Ty.node` to `Ty.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-26Rename `Pat.node` to `Pat.kind`varkor-2/+2
2019-09-26Rename `Expr.node` to `Expr.kind`varkor-3/+3
For both `ast::Expr` and `hir::Expr`.
2019-09-26Auto merge of #64515 - varkor:kindedterm, r=oli-obkbors-7/+7
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-7/+7
2019-09-26Auto merge of #62661 - arielb1:never-reserve, r=nikomatsakisbors-11/+49
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-25Remove unused DepTrackingMapMark Rousskov-28/+1
2019-09-25Fix rebasevarkor-1/+1
2019-09-25Rename surviving uses of `sty`varkor-9/+9
2019-09-25Rename `sty` to `kind`varkor-41/+41
2019-09-25Rename non-`TyS` uses of `sty`varkor-2/+2
2019-09-25Auto merge of #64627 - nnethercote:ObligForest-even-more, r=nikomatsakisbors-19/+36
Even more `ObligationForest` improvements Following on from #64545, more speed and readability improvements. r? @nikomatsakis
2019-09-25Rollup merge of #64746 - estebank:elide-impl-trait-obligations-on-err, ↵Mazdak Farrokhzad-36/+53
r=cramertj Remove blanket silencing of "type annotation needed" errors Remove blanket check for existence of other errors before emitting "type annotation needed" errors, and add some eager checks to avoid adding obligations when they refer to types that reference `[type error]` in order to reduce unneeded errors. Fix #64084.
2019-09-24Remove blanket silencing of "type annotation needed" errorsEsteban Küber-36/+53
Remove blanket check for existence of other errors before emitting "type annotation needed" errors, and add some eager checks to avoid adding obligations when they refer to types that reference `[type error]` in order to reduce unneded errors.
2019-09-24add error message for caseAriel Ben-Yehuda-2/+29