summary refs log tree commit diff
path: root/compiler/rustc_infer/src
AgeCommit message (Collapse)AuthorLines
2023-01-20Fix typo in opaque_types.rsIkko Eltociear Ashimine-2/+2
paramters -> parameters
2023-01-20Auto merge of #106090 - WaffleLapkin:dereffffffffff, r=Nilstriebbors-11/+11
Remove some `ref` patterns from the compiler Previous PR: https://github.com/rust-lang/rust/pull/105368 r? `@Nilstrieb`
2023-01-19even more unify Projection/Opaque in outlives codeAli MJ Al-Nasrawy-139/+65
2023-01-17Stop using `BREAK` & `CONTINUE` in compilerScott McMurray-10/+10
Switching them to `Break(())` and `Continue(())` instead. libs-api would like to remove these constants, so stop using them in compiler to make the removal PR later smaller.
2023-01-17Rollup merge of #106970 - kylematsuda:earlybinder-item-bounds, r=lcnrMatthias Krüger-1/+1
Switch to `EarlyBinder` for `item_bounds` query Part of the work to finish #105779 (also see https://github.com/rust-lang/types-team/issues/78). Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `item_bounds` query and removes `bound_item_bounds`. r? `@lcnr`
2023-01-17Rollup merge of #104505 - WaffleLapkin:no-double-spaces-in-comments, r=jackh726Matthias Krüger-18/+18
Remove double spaces after dots in comments Most of the comments do not have double spaces, so I assume these are typos.
2023-01-17change item_bounds query to return EarlyBinder; remove bound_item_bounds queryKyle Matsuda-1/+1
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-18/+18
2023-01-17Don't call closures immediately, use `try{}` blocksMaybe Waffle-11/+11
2023-01-17Rollup merge of #106829 - compiler-errors:more-alias-combine, r=spastorinoMatthias Krüger-86/+41
Unify `Opaque`/`Projection` handling in region outlives code They share basically identical paths in most places which are even easier to unify now that they're both `ty::Alias` r? types
2023-01-15Remove bound_{explicit,}_item_boundsMichael Goulet-3/+2
2023-01-15Rollup merge of #106859 - tialaramex:master, r=NilstriebMatthias Krüger-0/+16
Suggestion for type mismatch when we need a u8 but the programmer wrote a char literal Today Rust just points out that we have a char and we need a u8, but if I wrote 'A' then I could fix this by just writing b'A' instead. This code should detect the case where we're about to report a type mismatch of this kind, and the programmer wrote a char literal, and the char they wrote is ASCII, so therefore just prefixing b to make a byte literal will do what they meant. I have definitely written this mistake more than once, it's not difficult to figure out what to do, but the compiler might as well tell us anyway. I provided a test with two simple examples where the suggestion is appropriate, and one where it is not because the char literal is not ASCII, showing that the suggestion is only triggered in the former cases. I have contributed only a small typo doc fix before, so this is my first substantive rustc change.
2023-01-14Improve E0308: suggest user meant to use byte literal, w/ tests and fixNick Lamb-0/+16
suggested by Nilstrieb Co-authored-by: nils <48135649+Nilstrieb@users.noreply.github.com>
2023-01-14Auto merge of #106696 - kylematsuda:early-binder, r=lcnrbors-0/+1
Switch to `EarlyBinder` for `const_param_default` and `impl_trait_ref` queries Part of the work to close #105779 and implement https://github.com/rust-lang/types-team/issues/78. Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This PR adds `EarlyBinder` to the return type of `const_param_default` and `impl_trait_ref`, and removes their `bound_X` variants. r? `@lcnr`
2023-01-14change impl_trait_ref query to return EarlyBinder; remove ↵Kyle Matsuda-1/+1
bound_impl_trait_ref query; add EarlyBinder to impl_trait_ref in metadata
2023-01-14change usages of impl_trait_ref to bound_impl_trait_refKyle Matsuda-1/+2
2023-01-13Unify Opaque/Projection handling in region outlives codeMichael Goulet-86/+41
2023-01-13Keep obligation chain when elaborating obligationsEsteban Küber-3/+15
2023-01-12is_ty_infer -> is_ty_or_numeric_inferMichael Goulet-7/+7
2023-01-12Rollup merge of #106714 - Ezrashaw:remove-e0490, r=davidtwconils-61/+3
remove unreachable error code `E0490` AFAIK, the untested and undocumented error code `E0490` is now unreachable, it was from the days of the original borrow checker. cc ``@GuillaumeGomez`` #61137
2023-01-12Auto merge of #106760 - compiler-errors:rollup-0bogyco, r=compiler-errorsbors-1/+10
Rollup of 8 pull requests Successful merges: - #103236 (doc: rewrite doc for signed int::{carrying_add,borrowing_sub}) - #103800 (Stabilize `::{core,std}::pin::pin!`) - #106097 (Migrate mir_build diagnostics 2 of 3) - #106170 (Move autoderef to `rustc_hir_analysis`) - #106323 (Stabilize f16c_target_feature) - #106360 (Tweak E0277 `&`-removal suggestions) - #106524 (Label `struct/enum constructor` instead of `fn item`, mention that it should be called on type mismatch) - #106739 (Remove `<dyn AstConv<'tcx>>::fun(c, ...)` calls in favour of `c.astconv().fun(...)`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-12remove unreachable error code `E0490`Ezra Shaw-61/+3
2023-01-11Fix invalid syntax in impl Trait parameter type suggestions for E0311yanchen4791-17/+77
2023-01-11Move autoderef to rustc_hir_analysisMichael Goulet-1/+10
2023-01-11Change `src/test` to `tests` in source files, fix tidy and testsAlbert Larsan-3/+3
2023-01-10Rollup merge of #106204 - compiler-errors:no-take-opaques-in-compare, r=oli-obkYuki Okushi-9/+7
No need to take opaques in `check_type_bounds` `InferCtxt` already has its defining use anchor set to err r? ``@oli-obk``
2023-01-09Assert defining anchor is set in take_opaque_typesMichael Goulet-9/+7
2023-01-09Rollup merge of #106389 - compiler-errors:no-canonicalized, r=lcnrfee1-dead-10/+9
Simplify some canonical type alias names * delete the `Canonicalized<'tcx>` type alias in favor for `Canonical<'tcx>` * `CanonicalizedQueryResponse` -> `CanonicalQueryResponse` I don't particularly care about the latter, but it should be consistent. We could alternatively delete the first alias and rename the struct to `Canonicalized`, and then keep the name of `CanonicalizedQueryResponse` untouched.
2023-01-09Rollup merge of #106164 - compiler-errors:check-region-tweak, r=oli-obkfee1-dead-21/+18
Move `check_region_obligations_and_report_errors` to `TypeErrCtxt` Makes sense for this function to live with its sibling `resolve_regions_and_report_errors`, around which it's basically just a wrapper.
2023-01-08Rollup merge of #106131 - compiler-errors:not-ptrs, r=davidtwcoMichael Goulet-16/+51
Mention "signature" rather than "fn pointer" when impl/trait methods are incompatible Fixes #80929 Fixes #67296
2023-01-08Mention signature rather than fn pointers when comparing impl/trait methodsMichael Goulet-16/+51
2023-01-08remove unreachable error code `E0313`Ezra Shaw-42/+0
2023-01-07Rollup merge of #101936 - IntQuant:issue-100717-infer-4, r=compiler-errorsMatthias Krüger-326/+671
Migrating rustc_infer to session diagnostics (part 3) ``@rustbot`` label +A-translation r? rust-lang/diagnostics cc https://github.com/rust-lang/rust/issues/100717 Seems like a part of static_impl_trait.rs emits suggestions in a loop, and note.rs needs to have two instances of the same subdiagnostic, so these will need to wait until we have eager translation/list support. Other than that, there is only error_reporting/mod.rs left to migrate.
2023-01-06Auto merge of #105805 - yanchen4791:issue-105227-fix, r=estebankbors-7/+71
Suggest adding named lifetime when the return contains value borrowed from more than one lifetimes of function inputs fix for #105227. The problem: The suggestion of adding an explicit `'_` lifetime bound is **incorrect** when the function's return type contains a value which could be borrowed from more than one lifetimes of the function's inputs. Instead, a named lifetime parameter can be introduced in such a case. The solution: Checking the number of elided lifetimes in the function signature. If more than one lifetimes found in the function inputs when the suggestion of adding explicit `'_` lifetime, change it to using named lifetime parameter `'a` instead.
2023-01-05Suggests adding named lifetime when the return contains value borrowed from ↵yanchen4791-7/+71
more than one lifetimes of the function's inputs
2023-01-05Use `BottomUpFolder`Esteban Küber-1/+1
2023-01-04Rollup merge of #106403 - compiler-errors:rename-hir-methods, r=cjgillotMichael Goulet-37/+34
Rename `hir::Map::{get_,find_}parent_node` to `hir::Map::{,opt_}parent_id`, and add `hir::Map::{get,find}_parent` The `hir::Map::get_parent_node` function doesn't return a `Node`, and I think that's quite confusing. Let's rename it to something that sounds more like something that gets the parent hir id => `hir::Map::parent_id`. Same with `find_parent_node` => `opt_parent_id`. Also, combine `hir.get(hir.parent_id(hir_id))` and similar `hir.find(hir.parent_id(hir_id))` function into new functions that actually retrieve the parent node in one call. This last commit is the only one that might need to be looked at closely.
2023-01-04Address commentsMichael Goulet-49/+43
2023-01-04Simplify some iterator combinatorsMichael Goulet-55/+36
2023-01-04get_parent and find_parentMichael Goulet-36/+33
2023-01-04rename get_parent_node to parent_idMichael Goulet-3/+3
2023-01-03Move check_region_obligations_and_report_errors to TypeErrCtxtMichael Goulet-21/+18
2023-01-03Simplify some canonical type alias namesMichael Goulet-10/+9
2022-12-29Rollup merge of #106221 - Nilstrieb:rptr-more-like-ref-actually, ↵Matthias Krüger-5/+5
r=compiler-errors Rename `Rptr` to `Ref` in AST and HIR The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already as well.
2022-12-28Address review commentsMichael Goulet-35/+29
2022-12-28Make trait/impl where clause mismatch on region error a bit more actionableMichael Goulet-39/+90
2022-12-28Rename `Rptr` to `Ref` in AST and HIRNilstrieb-5/+5
The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already as well.
2022-12-28Auto merge of #106129 - compiler-errors:compare_method-tweaks, r=BoxyUwUbors-6/+11
Some `compare_method` tweaks 1. Make some of the comparison functions' names more regular 2. Reduce pub scope of some of the things in `compare_method` ~3. Remove some unnecessary opaque type handling code -- `InferCtxt` already is in a mode that doesn't define opaque types~ * moved to a different PR 4. Bubble up `ErrorGuaranteed` for region constraint errors in `compare_method` - Improves a redundant error message in one unit test. 5. Move the `compare_method` module to have a more general name, since it's more like `compare_impl_item` :) 6. Rename `collect_trait_impl_trait_tys`
2022-12-28eager is the default nowNikita Tomashevich-1/+1
2022-12-28Fix formattingNikita Tomashevich-2/+1