Auto merge of #106129 - compiler-errors:compare_method-tweaks, r=BoxyUwU
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`
This commit is contained in:
commit
83a28ef095
17 changed files with 89 additions and 72 deletions
|
@ -1836,7 +1836,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
|
||||
// In some (most?) cases cause.body_id points to actual body, but in some cases
|
||||
// it's an actual definition. According to the comments (e.g. in
|
||||
// rustc_hir_analysis/check/compare_method.rs:compare_predicate_entailment) the latter
|
||||
// rustc_hir_analysis/check/compare_impl_item.rs:compare_predicate_entailment) the latter
|
||||
// is relied upon by some other code. This might (or might not) need cleanup.
|
||||
let body_owner_def_id =
|
||||
self.tcx.hir().opt_local_def_id(cause.body_id).unwrap_or_else(|| {
|
||||
|
|
|
@ -1693,7 +1693,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
&self,
|
||||
generic_param_scope: LocalDefId,
|
||||
outlives_env: &OutlivesEnvironment<'tcx>,
|
||||
) -> Option<ErrorGuaranteed> {
|
||||
) -> Result<(), ErrorGuaranteed> {
|
||||
let errors = self.resolve_regions(outlives_env);
|
||||
|
||||
if let None = self.tainted_by_errors() {
|
||||
|
@ -1705,9 +1705,14 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
self.report_region_errors(generic_param_scope, &errors);
|
||||
}
|
||||
|
||||
(!errors.is_empty()).then(|| {
|
||||
self.tcx.sess.delay_span_bug(rustc_span::DUMMY_SP, "error should have been emitted")
|
||||
})
|
||||
if errors.is_empty() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(self
|
||||
.tcx
|
||||
.sess
|
||||
.delay_span_bug(rustc_span::DUMMY_SP, "error should have been emitted"))
|
||||
}
|
||||
}
|
||||
|
||||
// [Note-Type-error-reporting]
|
||||
|
|
|
@ -178,7 +178,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||
&self,
|
||||
generic_param_scope: LocalDefId,
|
||||
outlives_env: &OutlivesEnvironment<'tcx>,
|
||||
) -> Option<ErrorGuaranteed> {
|
||||
) -> Result<(), ErrorGuaranteed> {
|
||||
self.process_registered_region_obligations(
|
||||
outlives_env.region_bound_pairs(),
|
||||
outlives_env.param_env,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue