rust/compiler/rustc_borrowck/src
Yuki Okushi a7f789b502
Rollup merge of #98022 - compiler-errors:erroneous-borrowck-span, r=oli-obk
Fix erroneous span for borrowck error

I am not confident that this is the correct fix, but it does the job. Open to suggestions for a real fix instead.

Fixes #97997

The issue is that we pass a [dummy location](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_middle/mir/visit.rs.html#302) when type-checking the ["required consts"](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/struct.Body.html#structfield.required_consts) that are needed by the MIR body during borrowck. This means that when we fail to evaluate the constant, we use the span of `bb0[0]`, instead of the actual span of the constant.

There are quite a few other places that use `START_BLOCK.start_location()`, `Location::START`, etc. when calling for a random/unspecified `Location` value. This is because, unlike (for example) `Span`, we don't have a dummy/miscellaneous value to use instead. I would appreciate guidance (either in this PR, or a follow-up) on what needs to be done to clean this up in general.
2022-06-21 20:08:10 +09:00
..
constraints add def_id and substs to ConstraintCategory::CallArgument 2022-05-25 18:13:03 +02:00
diagnostics Rollup merge of #98110 - cjgillot:closure-brace, r=Aaron1011 2022-06-15 19:37:14 +09:00
region_infer Move RegionKind to rustc_type_ir 2022-06-19 00:20:27 -04:00
type_check Rollup merge of #98022 - compiler-errors:erroneous-borrowck-span, r=oli-obk 2022-06-21 20:08:10 +09:00
borrow_set.rs Remove crate visibility usage in compiler 2022-05-20 20:04:54 -04:00
borrowck_errors.rs Remove crate visibility usage in compiler 2022-05-20 20:04:54 -04:00
constraint_generation.rs Refactor call terminator to always hold a destination place 2022-05-23 17:49:04 -04:00
consumers.rs Add InferCtxt::with_opaque_type_inference to get_body_with_borrowck_facts 2021-10-06 19:07:56 -07:00
dataflow.rs Remove crate visibility usage in compiler 2022-05-20 20:04:54 -04:00
def_use.rs Add new MutatatingUseContexts for deinit and SetDiscriminant 2022-04-11 09:26:26 -04:00
facts.rs Remove crate visibility usage in compiler 2022-05-20 20:04:54 -04:00
invalidation.rs Refactor call terminator to always hold a destination place 2022-05-23 17:49:04 -04:00
lib.rs remove unnecessary to_string and String::new 2022-06-13 15:48:40 +09:00
location.rs Remove crate visibility usage in compiler 2022-05-20 20:04:54 -04:00
member_constraints.rs Lifetime variance fixes for rustc 2022-05-22 14:29:32 -07:00
nll.rs Remove crate visibility usage in compiler 2022-05-20 20:04:54 -04:00
path_utils.rs Remove in_band_lifetimes from borrowck 2021-12-15 08:39:21 +01:00
place_ext.rs Remove crate visibility usage in compiler 2022-05-20 20:04:54 -04:00
places_conflict.rs Remove crate visibility usage in compiler 2022-05-20 20:04:54 -04:00
prefixes.rs Move rustc_mir::borrow_check to new crate rustc_borrowck. 2021-09-07 00:29:22 +02:00
renumber.rs Overhaul Const. 2022-02-15 16:19:59 +11:00
universal_regions.rs Compute is_late_bound in a separate query. 2022-06-03 12:05:04 +02:00
used_muts.rs Refactor call terminator to always hold a destination place 2022-05-23 17:49:04 -04:00