SelectionContext,
SelectionError,
ObjectSafetyViolation,
+ Overflow,
};
use errors::DiagnosticBuilder;
predicate: ty::Predicate::Trait(predicate),
.. obligation.clone()
};
- let mut selcx = SelectionContext::new(self);
- if selcx.evaluate_obligation(&unit_obligation) {
+ if self.predicate_may_hold(&unit_obligation) {
err.note("the trait is implemented for `()`. \
Possibly this error has been caused by changes to \
Rust's type-inference algorithm \
}
err.struct_error(self.tcx, span, "constant expression")
}
+
+ Overflow => {
+ bug!("overflow should be handled before the `report_selection_error` path");
+ }
};
self.note_obligation_cause(&mut err, obligation);
err.emit();
.count();
let mut trait_type = trait_ref.self_ty();
- let mut selcx = SelectionContext::new(self);
for refs_remaining in 0..refs_number {
if let ty::TypeVariants::TyRef(_, ty::TypeAndMut{ ty: t_type, mutbl: _ }) =
obligation.param_env,
new_trait_ref.to_predicate());
- if selcx.evaluate_obligation(&new_obligation) {
+ if self.predicate_may_hold(&new_obligation) {
let sp = self.tcx.sess.codemap()
.span_take_while(span, |c| c.is_whitespace() || *c == '&');
ArgKind::Arg(format!("{}", field.name), "_".to_string())
}).collect::<Vec<_>>())
}
+ hir::map::NodeStructCtor(ref variant_data) => {
+ (self.tcx.sess.codemap().def_span(self.tcx.hir.span(variant_data.id())),
+ variant_data.fields()
+ .iter().map(|_| ArgKind::Arg("_".to_owned(), "_".to_owned()))
+ .collect())
+ }
_ => panic!("non-FnLike node found: {:?}", node),
}
}
tcx.mk_infer(ty::TyVar(ty::TyVid { index: 0 })),
false,
hir::Unsafety::Normal,
- ::syntax::abi::Abi::Rust
+ ::rustc_target::spec::abi::Abi::Rust
)
} else {
tcx.mk_fn_sig(
tcx.mk_infer(ty::TyVar(ty::TyVid { index: 0 })),
false,
hir::Unsafety::Normal,
- ::syntax::abi::Abi::Rust
+ ::rustc_target::spec::abi::Abi::Rust
)
};
format!("{}", ty::Binder::bind(sig))
cleaned_pred.to_predicate()
);
- selcx.evaluate_obligation(&obligation)
+ self.predicate_may_hold(&obligation)
})
}