typeck: port "no resolve overridden impl substs"
Port "could not resolve substs on overridden impl" diagnostic to use the diagnostic derive. Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
664733efd5
commit
47582471c6
3 changed files with 11 additions and 1 deletions
|
@ -127,3 +127,5 @@ typeck-manual-implementation =
|
||||||
manual implementations of `{$trait_name}` are experimental
|
manual implementations of `{$trait_name}` are experimental
|
||||||
.label = manual implementations of `{$trait_name}` are experimental
|
.label = manual implementations of `{$trait_name}` are experimental
|
||||||
.help = add `#![feature(unboxed_closures)]` to the crate attributes to enable
|
.help = add `#![feature(unboxed_closures)]` to the crate attributes to enable
|
||||||
|
|
||||||
|
typeck-substs-on-overridden-impl = could not resolve substs on overridden impl
|
||||||
|
|
|
@ -323,3 +323,10 @@ pub struct ManualImplementation {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub trait_name: String,
|
pub trait_name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(SessionDiagnostic)]
|
||||||
|
#[error(slug = "typeck-substs-on-overridden-impl")]
|
||||||
|
pub struct SubstsOnOverriddenImpl {
|
||||||
|
#[primary_span]
|
||||||
|
pub span: Span,
|
||||||
|
}
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
//! on traits with methods can.
|
//! on traits with methods can.
|
||||||
|
|
||||||
use crate::constrained_generic_params as cgp;
|
use crate::constrained_generic_params as cgp;
|
||||||
|
use crate::errors::SubstsOnOverriddenImpl;
|
||||||
|
|
||||||
use rustc_data_structures::fx::FxHashSet;
|
use rustc_data_structures::fx::FxHashSet;
|
||||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||||
|
@ -165,7 +166,7 @@ fn get_impl_substs<'tcx>(
|
||||||
let outlives_env = OutlivesEnvironment::new(ty::ParamEnv::empty());
|
let outlives_env = OutlivesEnvironment::new(ty::ParamEnv::empty());
|
||||||
infcx.resolve_regions_and_report_errors(impl1_def_id, &outlives_env, RegionckMode::default());
|
infcx.resolve_regions_and_report_errors(impl1_def_id, &outlives_env, RegionckMode::default());
|
||||||
let Ok(impl2_substs) = infcx.fully_resolve(impl2_substs) else {
|
let Ok(impl2_substs) = infcx.fully_resolve(impl2_substs) else {
|
||||||
tcx.sess.struct_span_err(span, "could not resolve substs on overridden impl").emit();
|
tcx.sess.emit_err(SubstsOnOverriddenImpl { span });
|
||||||
return None;
|
return None;
|
||||||
};
|
};
|
||||||
Some((impl1_substs, impl2_substs))
|
Some((impl1_substs, impl2_substs))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue