Add helper to create the trait ref for a lang item
This commit is contained in:
parent
25c4760b5d
commit
ad57f88d3f
10 changed files with 51 additions and 66 deletions
|
@ -60,10 +60,10 @@ impl<'tcx> Bounds<'tcx> {
|
|||
{
|
||||
// If it could be sized, and is, add the `Sized` predicate.
|
||||
let sized_predicate = self.implicitly_sized.and_then(|span| {
|
||||
tcx.lang_items().sized_trait().map(move |sized| {
|
||||
let trait_ref = ty::Binder::dummy(tcx.mk_trait_ref(sized, param_ty, []));
|
||||
(trait_ref.without_const().to_predicate(tcx), span)
|
||||
})
|
||||
// FIXME: use tcx.at(span).mk_trait_ref(LangItem::Sized) here? This may make no-core code harder to write.
|
||||
let sized = tcx.lang_items().sized_trait()?;
|
||||
let trait_ref = ty::Binder::dummy(tcx.mk_trait_ref(sized, param_ty, []));
|
||||
Some((trait_ref.without_const().to_predicate(tcx), span))
|
||||
});
|
||||
|
||||
let region_preds = self.region_bounds.iter().map(move |&(region_bound, span)| {
|
||||
|
|
|
@ -1722,7 +1722,7 @@ fn receiver_is_valid<'tcx>(
|
|||
// The first type is `receiver_ty`, which we know its not equal to `self_ty`; skip it.
|
||||
autoderef.next();
|
||||
|
||||
let receiver_trait_def_id = tcx.require_lang_item(LangItem::Receiver, None);
|
||||
let receiver_trait_def_id = tcx.require_lang_item(LangItem::Receiver, Some(span));
|
||||
|
||||
// Keep dereferencing `receiver_ty` until we get to `self_ty`.
|
||||
loop {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue