rust/compiler/rustc_infer/src
Nicholas Nethercote fe843feaab Use fewer origins when creating type variables.
`InferCtxt::next_{ty,const}_var*` all take an origin, but the
`param_def_id` is almost always `None`. This commit changes them to just
take a `Span` and build the origin within the method, and adds new
methods for the rare cases where `param_def_id` might not be `None`.
This avoids a lot of tedious origin building.

Specifically:
- next_ty_var{,_id_in_universe,_in_universe}: now take `Span` instead of
  `TypeVariableOrigin`
- next_ty_var_with_origin: added

- next_const_var{,_in_universe}: takes Span instead of ConstVariableOrigin
- next_const_var_with_origin: added

- next_region_var, next_region_var_in_universe: these are unchanged,
  still take RegionVariableOrigin

The API inconsistency (ty/const vs region) seems worth it for the
large conciseness improvements.
2024-05-10 09:47:46 +10:00
..
errors Pass translation closure to add_to_diag_with() as reference 2024-04-21 07:45:03 +00:00
infer Use fewer origins when creating type variables. 2024-05-10 09:47:46 +10:00
traits Use ObligationCtxt in favor of TraitEngine in many places 2024-05-02 22:03:01 -04:00
lib.rs Step bootstrap cfgs 2024-05-01 22:19:11 -04:00