Use constraint span when lowering associated types
This commit is contained in:
parent
f86521e0a3
commit
94ee54c425
9 changed files with 365 additions and 200 deletions
|
|
@ -72,7 +72,7 @@ use syntax::symbol::{kw, sym, Symbol};
|
|||
use syntax::tokenstream::{TokenStream, TokenTree};
|
||||
use syntax::parse::token::{self, Token};
|
||||
use syntax::visit::{self, Visitor};
|
||||
use syntax_pos::{DUMMY_SP, Span};
|
||||
use syntax_pos::Span;
|
||||
|
||||
const HIR_ID_COUNTER_LOCKED: u32 = 0xFFFFFFFF;
|
||||
|
||||
|
|
@ -1094,7 +1094,7 @@ impl<'a> LoweringContext<'a> {
|
|||
impl_trait_node_id,
|
||||
DefPathData::ImplTrait,
|
||||
ExpnId::root(),
|
||||
DUMMY_SP
|
||||
c.span,
|
||||
);
|
||||
|
||||
self.with_dyn_type_scope(false, |this| {
|
||||
|
|
@ -1102,7 +1102,7 @@ impl<'a> LoweringContext<'a> {
|
|||
&Ty {
|
||||
id: this.sess.next_node_id(),
|
||||
node: TyKind::ImplTrait(impl_trait_node_id, bounds.clone()),
|
||||
span: DUMMY_SP,
|
||||
span: c.span,
|
||||
},
|
||||
itctx,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -127,8 +127,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
) -> InferOk<'tcx, (T, OpaqueTypeMap<'tcx>)> {
|
||||
debug!(
|
||||
"instantiate_opaque_types(value={:?}, parent_def_id={:?}, body_id={:?}, \
|
||||
param_env={:?})",
|
||||
value, parent_def_id, body_id, param_env,
|
||||
param_env={:?}, value_span={:?})",
|
||||
value, parent_def_id, body_id, param_env, value_span,
|
||||
);
|
||||
let mut instantiator = Instantiator {
|
||||
infcx: self,
|
||||
|
|
@ -1111,6 +1111,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
|
|||
return opaque_defn.concrete_ty;
|
||||
}
|
||||
let span = tcx.def_span(def_id);
|
||||
debug!("fold_opaque_ty {:?} {:?}", self.value_span, span);
|
||||
let ty_var = infcx
|
||||
.next_ty_var(TypeVariableOrigin { kind: TypeVariableOriginKind::TypeInference, span });
|
||||
|
||||
|
|
|
|||
|
|
@ -248,10 +248,10 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
|
|||
/// This is always inlined, despite its size, because it has a single
|
||||
/// callsite and it is called *very* frequently.
|
||||
#[inline(always)]
|
||||
fn process_obligation(&mut self,
|
||||
pending_obligation: &mut Self::Obligation)
|
||||
-> ProcessResult<Self::Obligation, Self::Error>
|
||||
{
|
||||
fn process_obligation(
|
||||
&mut self,
|
||||
pending_obligation: &mut Self::Obligation,
|
||||
) -> ProcessResult<Self::Obligation, Self::Error> {
|
||||
// if we were stalled on some unresolved variables, first check
|
||||
// whether any of them have been resolved; if not, don't bother
|
||||
// doing more work yet
|
||||
|
|
@ -277,7 +277,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
|
|||
self.selcx.infcx().resolve_vars_if_possible(&obligation.predicate);
|
||||
}
|
||||
|
||||
debug!("process_obligation: obligation = {:?}", obligation);
|
||||
debug!("process_obligation: obligation = {:?} cause = {:?}", obligation, obligation.cause);
|
||||
|
||||
match obligation.predicate {
|
||||
ty::Predicate::Trait(ref data) => {
|
||||
|
|
@ -425,10 +425,13 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
|
|||
}
|
||||
|
||||
ty::Predicate::WellFormed(ty) => {
|
||||
match ty::wf::obligations(self.selcx.infcx(),
|
||||
match ty::wf::obligations(
|
||||
self.selcx.infcx(),
|
||||
obligation.param_env,
|
||||
obligation.cause.body_id,
|
||||
ty, obligation.cause.span) {
|
||||
ty,
|
||||
obligation.cause.span,
|
||||
) {
|
||||
None => {
|
||||
pending_obligation.stalled_on = vec![ty];
|
||||
ProcessResult::Unchanged
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue