summary refs log tree commit diff
path: root/compiler/rustc_infer/src
AgeCommit message (Collapse)AuthorLines
2021-03-18hir: Preserve used syntax in `TyKind::TraitObject`Vadim Petrochenkov-2/+3
2021-03-15More precise spans for HIR pathsVadim Petrochenkov-1/+1
2021-03-06Change x64 size checks to not apply to x32.Harald van Dijk-3/+3
Rust contains various size checks conditional on target_arch = "x86_64", but these checks were never intended to apply to x86_64-unknown-linux-gnux32. Add target_pointer_width = "64" to the conditions.
2021-03-01Rollup merge of #82635 - pierwill:edit-infer, r=oli-obkJoshua Nelson-2/+2
Fix typos in rustc_infer::infer::nll_relate
2021-02-28Fix typos in rustc_infer::infer::nll_relatepierwill-2/+2
2021-02-28Fix a typo in the `find_anon_type` docYuki Okushi-1/+1
2021-02-27Rollup merge of #82370 - ↵Dylan DPC-64/+70
0yoyoyo:update-issue-81650-point-anonymous-lifetime, r=estebank Improve anonymous lifetime note to indicate the target span Improvement for #81650 Cc #81995 Message after this improvement: (Improve note in the middle) ``` error[E0311]: the parameter type `T` may not live long enough --> src/main.rs:25:11 | 24 | fn play_with<T: Animal + Send>(scope: &Scope, animal: T) { | -- help: consider adding an explicit lifetime bound...: `T: 'a +` 25 | scope.spawn(move |_| { | ^^^^^ | note: the parameter type `T` must be valid for the anonymous lifetime defined on the function body at 24:40... --> src/main.rs:24:40 | 24 | fn play_with<T: Animal + Send>(scope: &Scope, animal: T) { | ^^^^^ note: ...so that the type `[closure@src/main.rs:25:17: 27:6]` will meet its required lifetime bounds --> src/main.rs:25:11 | 25 | scope.spawn(move |_| { | ^^^^^ ``` r? ``````@estebank``````
2021-02-24clarifies error when finding mismatched returned types for async functionsNell Shamrell-2/+11
Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
2021-02-21Apply tidy check0yoyoyo-1/+1
2021-02-21Add indication of anonymous lifetime position0yoyoyo-1/+9
2021-02-21Change `find_anon_type` method to function0yoyoyo-63/+61
2021-02-19Rollup merge of #81496 - guswynn:expected_async_block, r=oli-obkDylan DPC-8/+10
name async generators something more human friendly in type error diagnostic fixes #81457 Some details: 1. I opted to load the generator kind from the hir in TyCategory. I also use 1 impl in the hir for the descr 2. I named both the source of the future, in addition to the general type (`future`), not sure what is preferred 3. I am not sure what is required to make sure "generator" is not referred to anywhere. A brief `rg "\"generator\"" showed me that most diagnostics correctly distinguish from generators and async generator, but the `descr` of `DefKind` is pretty general (not sure how thats used) 4. should the descr impl of AsyncGeneratorKind use its display impl instead of copying the string?
2021-02-18Rollup merge of #82066 - matthewjasper:trait-ref-fix, r=jackh726Dylan DPC-1/+24
Ensure valid TraitRefs are created for GATs This fixes `ProjectionTy::trait_ref` to use the correct substs. Places that need all of the substs have been updated to not use `trait_ref`. r? ````@jackh726````
2021-02-18Rollup merge of #82240 - matthiaskrgr:qmark, r=Dylan-DPCYuki Okushi-6/+1
remove useless ?s (clippy::needless_question_marks) Example code: ```rust fn opts() -> Option<String> { let s: Option<String> = Some(String::new()); Some(s?) // this can just be "s" } ```
2021-02-17Rollup merge of #81972 - matthewjasper:hrtb-error-cleanup, r=nikomatsakisDylan DPC-108/+128
Placeholder lifetime error cleanup - Remove note of trait definition - Avoid repeating the same self type - Use original region names when possible - Use this error kind more often - Print closure signatures when they are suppose to implement `Fn*` traits Works towards #57374 r? ```@nikomatsakis```
2021-02-17remove useless ?s (clippy::needless_question_marks)Matthias Krüger-6/+1
Example code: ``` fn opts() -> Option<String> { let s: Option<String> = Some(String::new()); Some(s?) // this can just be "s" } ```
2021-02-16Auto merge of #81611 - cjgillot:meowner, r=estebankbors-13/+9
Only store a LocalDefId in some HIR nodes Some HIR nodes are guaranteed to be HIR owners: Item, TraitItem, ImplItem, ForeignItem and MacroDef. As a consequence, we do not need to store the `HirId`'s `local_id`, and we can directly store a `LocalDefId`. This allows to avoid a bit of the dance with `tcx.hir().local_def_id` and `tcx.hir().local_def_id_to_hir_id` mappings.
2021-02-16Rollup merge of #82163 - matthiaskrgr:slice, r=jyn514Guillaume Gomez-1/+1
avoid full-slicing slices If we already have a slice, there is no need to get another full-range slice from that, just use the original. clippy::redundant_slicing
2021-02-16Rollup merge of #82160 - pierwill:patch-2, r=lcnrGuillaume Gomez-1/+1
Fix typo in rustc_infer::infer::UndoLog Also use double quotes.
2021-02-16avoid full-slicing slicesMatthias Krüger-1/+1
If we already have a slice, there is no need to get another full-range slice from that, just use the original. clippy::redundant_slicing
2021-02-15Trait impls are Items, therefore HIR owners.Camille GILLOT-2/+1
2021-02-15Only store a LocalDefId in hir::ImplItem.Camille GILLOT-6/+4
2021-02-15Only store a LocalDefId in hir::TraitItem.Camille GILLOT-5/+4
2021-02-15Use ItemId as a strongly typed index.Camille GILLOT-1/+1
2021-02-15Fix typo in rustc_infer::infer::UndoLogpierwill-1/+1
Also use double quotes.
2021-02-15name async generators something more human friendly in type error diagnosticsGus Wynn-8/+10
2021-02-14param_env debugs are instrumental to rustc's successEllen-1/+1
2021-02-13Don't go through TraitRef to relate projectionsMatthew Jasper-1/+24
2021-02-13yeet ya fixme into the voidEllen-4/+8
2021-02-13debug!("paramenv={}paramenv={}paramenv={}paramenv={}")Ellen-0/+1
2021-02-12Fix suggestion to introduce explicit lifetime0yoyoyo-1/+6
2021-02-10Keep existing names of regions in placeholder_errorMatthew Jasper-4/+4
2021-02-09Print closure signatures when reporting placeholder errorsMatthew Jasper-6/+32
2021-02-09Report "nice" placeholder errors more oftenMatthew Jasper-73/+69
If we have a cause containing `ValuePairs::PolyTraitRefs` but neither TraitRef has any escaping bound regions then we report the same error as for `ValuePairs::TraitRefs`.
2021-02-09Avoid repeating self type in placeholder errorMatthew Jasper-2/+18
2021-02-09Remove unnecessary note on errorsMatthew Jasper-4/+0
Seeing the trait definition doesn't help with implementation not general enough errors, so don't make the error message larger to show it.
2021-02-09Using tracing macros in placeholder_error.rsMatthew Jasper-21/+7
2021-02-09Use longer lifetime in `try_report_from_nll` return typeMatthew Jasper-4/+4
2021-02-09Rollup merge of #80732 - spastorino:trait-inheritance-self2, r=nikomatsakisDylan DPC-1/+40
Allow Trait inheritance with cycles on associated types take 2 This reverts the revert of #79209 and fixes the ICEs that's occasioned by that PR exposing some problems that are addressed in #80648 and #79811. For easier review I'd say, check only the last commit, the first one is just a revert of the revert of #79209 which was already approved. This also could be considered part or the actual fix of #79560 but I guess for that to be closed and fixed completely we would need to land #80648 and #79811 too. r? `@nikomatsakis` cc `@Aaron1011`
2021-02-08Anonymize late bound regions on transitive bounds that define assoc typeSantiago Pastorino-15/+22
2021-02-05Adapt to latest master changes by using PredicateKindSantiago Pastorino-1/+1
2021-02-05Revert "Auto merge of #79637 - spastorino:revert-trait-inheritance-self, ↵Santiago Pastorino-1/+33
r=Mark-Simulacrum" This reverts commit b4def89d76896eec73b4af33642ba7e5eb53c567, reversing changes made to 7dc1e852d43cb8c9e77dc1e53014f0eb85d2ebfb.
2021-02-04tidy: Run tidy style against markdown files.Eric Huss-1/+0
2021-02-02Rollup merge of #81655 - matsujika:suggest-accessing-field-rewording, r=estebankJack Huey-1/+1
Improve wording of suggestion about accessing field Follow-up to #81504 The compiler at this moment suggests "you might have meant to use field `b` of type `B`", sounding like it's type `B` which has the field `b`. r? ```@estebank```
2021-02-02Rollup merge of #80593 - jackh726:chalk-upgrade, r=nikomatsakisJack Huey-8/+4
Upgrade Chalk ~~Blocked on rust-lang/chalk#670~~ ~~Now blocked on rust-lang/chalk#680 and release~~ In addition to the straight upgrade, I also tried to fix some tests by properly returning variables and max universes in the solution. Unfortunately, this actually triggers the same perf problem that rustc traits code runs into in `canonicalizer`. Not sure what the root cause of this problem is, or why it's supposed to be solved in chalk. r? ```@nikomatsakis```
2021-02-02Bump rustfmt versionMark Rousskov-1/+6
Also switches on formatting of the mir build module
2021-02-02Improve wording of suggestion about accessing fieldHirochika Matsumoto-1/+1
2021-02-01Upgrade ChalkJack Huey-8/+4
2021-02-01Rollup merge of #81504 - matsujika:suggestion-field-access, r=estebankJonas Schievink-0/+48
Suggest accessing field when appropriate Fix #81222 r? ``@estebank``
2021-02-01Rollup merge of #81463 - matsujika:nll-ensure-c-case, r=varkorJonas Schievink-11/+11
Rename NLL* to Nll* accordingly to C-CASE Given [C-CASE](https://rust-lang.github.io/api-guidelines/naming.html#casing-conforms-to-rfc-430-c-case), `NLLRegionVariableOrigin` and `NLL` are encouraged to be `NllRegionVariableOrigin` and `Nll` respectively.