Matthias Krüger
314fe4d170
Rollup merge of #104239 - b-naber:sccs-info, r=jackh726
...
Better debug logs for borrowck constraint graph
It's really cumbersome to work with `RegionVar`s when trying to debug borrowck code or when trying to understand how the borrowchecker works. This PR collects some region information (behind `cfg(debug_assertions)`) for created `RegionVar`s (NLL region vars, this PR doesn't touch canonicalization) and prints the nodes and edges of the strongly connected constraints graph using representatives that use that region information (either lifetime names, locations in MIR or spans).
2023-02-21 23:01:58 +01:00
Oli Scherer
88a7b6803b
Make hidden type registration opt-in, so that each site can be reviewed on its own and we have the right defaults for trait solvers
2023-02-21 14:50:51 +00:00
b-naber
2f79f73821
collect region contexts during mir renumbering
2023-02-19 22:11:27 +00:00
Kyle Matsuda
8e92849cbb
changes from review
2023-02-16 17:05:59 -07:00
Kyle Matsuda
c183110cc2
remove bound_type_of query; make type_of return EarlyBinder; change type_of in metadata
2023-02-16 17:05:56 -07:00
Kyle Matsuda
d822b97a27
change usages of type_of to bound_type_of
2023-02-16 17:01:52 -07:00
bors
c5d1b3ea96
Auto merge of #108020 - nnethercote:opt-mk_region, r=compiler-errors
...
Optimize `mk_region`
PR #107869 avoiding some interning under `mk_ty` by special-casing `Ty` variants with simple (integer) bodies. This PR does something similar for regions.
r? `@compiler-errors`
2023-02-16 16:11:54 +00:00
Matthias Krüger
8f65e25aec
Rollup merge of #108010 - compiler-errors:can_eq-returns-bool, r=lcnr
...
Make `InferCtxt::can_eq` and `InferCtxt::can_sub` return booleans
Nobody matches on the result, nor does the result return anything useful...
2023-02-15 21:30:56 +01:00
Nicholas Nethercote
cef9004f5a
Add specialized variants of mk_region.
...
Much like there are specialized variants of `mk_ty`. This will enable
some optimization in the next commit.
Also rename the existing `re_error*` functions as `mk_re_error*`, for
consistency.
2023-02-15 09:02:44 +11:00
Michael Goulet
eb286dd070
Make can_eq and can_sub return booleans
2023-02-13 19:29:02 +00:00
Alan Egerton
63ad5d0522
Rename folder traits' tcx method to interner
2023-02-13 10:24:51 +00:00
Alan Egerton
9783fcc13b
Make folding traits generic over the Interner
2023-02-13 10:24:49 +00:00
Alan Egerton
ba55a453eb
Alias folding/visiting traits instead of re-export
2023-02-13 10:24:46 +00:00
Nicholas Nethercote
7a72560154
Reduce direct mk_ty usage.
...
We use more specific `mk_*` functions in most places, might as well use
them as much as possible.
2023-02-13 09:32:48 +11:00
Boxy
1f89e2aef2
emit AliasEq when relating type and const aliases
2023-02-10 14:33:13 +00:00
Michael Goulet
03a8a4ff3e
Replacing bound vars is actually instantiating a binder
2023-02-07 23:13:54 +00:00
Nicholas Nethercote
fb8e6819aa
Split and inline ShallowResolver::fold_ty.
2023-02-06 08:52:04 +11:00
Nicholas Nethercote
f08a3371b0
Improve early bailout test in resolve_vars_if_possible.
...
`!t.has_non_region_infer()` is the test used in
`OpportunisticVarResolver`, and catches a few cases that
`!t.needs_infer()` misses.
2023-02-06 08:52:04 +11:00
Michael Goulet
0e98a162c8
Track bound types like bound regions
2023-01-30 22:18:20 +00:00
Maybe Waffle
6a28fb42a8
Remove double spaces after dots in comments
2023-01-17 08:09:33 +00:00
nils
c61f29ca52
Rollup merge of #106714 - Ezrashaw:remove-e0490, r=davidtwco
...
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-12 15:44:52 +01:00
Ezra Shaw
02005e9f22
remove unreachable error code E0490
2023-01-12 14:15:21 +13:00
Michael Goulet
c8334ce60c
Move autoderef to rustc_hir_analysis
2023-01-11 20:12:57 +00:00
Yuki Okushi
e5e116dca9
Rollup merge of #106204 - compiler-errors:no-take-opaques-in-compare, r=oli-obk
...
No need to take opaques in `check_type_bounds`
`InferCtxt` already has its defining use anchor set to err
r? ``@oli-obk``
2023-01-10 08:05:34 +09:00
Michael Goulet
f769d34291
Assert defining anchor is set in take_opaque_types
2023-01-09 18:14:28 +00:00
fee1-dead
7779386a3a
Rollup merge of #106164 - compiler-errors:check-region-tweak, r=oli-obk
...
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-09 23:35:29 +08:00
Michael Goulet
6afd16171d
Rollup merge of #106131 - compiler-errors:not-ptrs, r=davidtwco
...
Mention "signature" rather than "fn pointer" when impl/trait methods are incompatible
Fixes #80929
Fixes #67296
2023-01-08 19:57:53 -08:00
Michael Goulet
49f849a3d2
Mention signature rather than fn pointers when comparing impl/trait methods
2023-01-08 03:49:24 +00:00
Ezra Shaw
93c0d8d5d5
remove unreachable error code E0313
2023-01-08 14:47:12 +13:00
Michael Goulet
c104ee9f6d
Move check_region_obligations_and_report_errors to TypeErrCtxt
2023-01-03 23:58:12 +00:00
Michael Goulet
8973b3e3cc
Bubble up ErrorGuaranteed from region constraints in method item compare
2022-12-24 21:37:00 +00:00
Michael Goulet
96154d7fa7
Add IMPLIED_BOUNDS_ENTAILMENT lint
2022-12-19 18:16:22 +00:00
Matthias Krüger
0aa4cde747
avoid .into() conversion to identical types
2022-12-18 16:20:32 +01:00
Boxy
dd19656df3
fold instead of obliterating args
2022-12-12 14:30:01 +00:00
Matthias Krüger
8e0d83a70c
Rollup merge of #105185 - compiler-errors:normalize_fn_sig-in-err-ctxt, r=lcnr
...
Move `normalize_fn_sig` to `TypeErrCtxt`
r? `@lcnr`
2022-12-02 21:22:50 +01:00
Michael Goulet
ffca711760
Move normalize_fn_sig to TypeErrCtxt
2022-12-02 19:29:14 +00:00
Michael Goulet
e45daa9856
Drive-by: remove unused type alias
2022-12-01 19:00:09 +00:00
Maybe Waffle
f4d00fe785
Remove Const::from_value
...
...it's just `mk_const` but without the sparcles
2022-11-28 17:28:30 +00:00
Maybe Waffle
26b87bf8ff
Simplify calls to tcx.mk_const
...
`mk_const(ty::ConstKind::X(...), ty)` can now be simplified to
`mk_cosnt(..., ty)`.
I searched with the following regex: \mk_const\([\n\s]*(ty::)?ConstKind\
I've left `ty::ConstKind::{Bound, Error}` as-is, they seem clearer this
way.
2022-11-28 17:27:20 +00:00
Maybe Waffle
7087d9b2a0
Remove tcx.mk_const_var
...
... `tcx.mk_const` can now be used instead
2022-11-28 17:27:20 +00:00
Michael Goulet
6210812494
Do not record unresolved const vars in generator interior
2022-11-26 05:38:43 +00:00
Boxy
2ac5d91d63
Make expand_abstract_consts infallible
2022-11-25 09:28:44 +00:00
kadmin
5bb1a9febc
Add expand_abstract_const
...
Adds the ability to directly expand a const to an expr without having to deal with intermediate
steps.
2022-11-25 09:28:43 +00:00
kadmin
f9750c1554
Add empty ConstKind::Abstract
...
Initial pass at expr/abstract const/s
Address comments
Switch to using a list instead of &[ty::Const], rm `AbstractConst`
Remove try_unify_abstract_consts
Update comments
Add edits
Recurse more
More edits
Prevent equating associated consts
Move failing test to ui
Changes this test from incremental to ui, and mark it as failing and a known bug.
Does not cause the compiler to ICE, so should be ok.
2022-11-25 09:28:43 +00:00
Oli Scherer
9a8e1eea7a
Move a field around
2022-11-21 16:35:23 +00:00
Oli Scherer
94fe30ff2f
Treat different opaque types of the same def id as equal during coherence
2022-11-21 16:06:07 +00:00
Boxy
9ed348376f
require an ErrorGuaranteed to taint infcx with errors
2022-11-18 13:25:17 +00:00
Boxy
1c48039a87
rename is_tainted_by_errors
2022-11-18 13:25:17 +00:00
Boxy
9c510048fd
InferCtxt::is_tainted_by_errors returns ErrorGuaranteed
2022-11-18 13:25:17 +00:00
Michael Goulet
ed6a7cc228
Remove save_and_restore_in_snapshot_flag
2022-11-09 22:58:39 +00:00