mirror of https://github.com/rust-lang/rust.git
add EarlyBinder::no_bound_vars
This commit is contained in:
parent
c2414dfaa4
commit
ab40ba2fb1
|
@ -46,7 +46,7 @@ pub(crate) fn maybe_create_entry_wrapper(
|
|||
is_main_fn: bool,
|
||||
sigpipe: u8,
|
||||
) {
|
||||
let main_ret_ty = tcx.fn_sig(rust_main_def_id).subst_identity().output();
|
||||
let main_ret_ty = tcx.fn_sig(rust_main_def_id).no_bound_vars().unwrap().output();
|
||||
// Given that `main()` has no arguments,
|
||||
// then its return type cannot have
|
||||
// late-bound regions, since late-bound
|
||||
|
|
|
@ -436,7 +436,7 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
|||
cx.type_func(&[], cx.type_int())
|
||||
};
|
||||
|
||||
let main_ret_ty = cx.tcx().fn_sig(rust_main_def_id).subst_identity().output();
|
||||
let main_ret_ty = cx.tcx().fn_sig(rust_main_def_id).no_bound_vars().unwrap().output();
|
||||
// Given that `main()` has no arguments,
|
||||
// then its return type cannot have
|
||||
// late-bound regions, since late-bound
|
||||
|
|
|
@ -758,6 +758,11 @@ impl<'tcx, T: TypeFoldable<'tcx>> ty::EarlyBinder<T> {
|
|||
pub fn subst_identity(self) -> T {
|
||||
self.0
|
||||
}
|
||||
|
||||
/// Returns the inner value, but only if it contains no bound vars.
|
||||
pub fn no_bound_vars(self) -> Option<T> {
|
||||
if !self.0.needs_subst() { Some(self.0) } else { None }
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1296,7 +1296,7 @@ impl<'v> RootCollector<'_, 'v> {
|
|||
};
|
||||
|
||||
let start_def_id = self.tcx.require_lang_item(LangItem::Start, None);
|
||||
let main_ret_ty = self.tcx.fn_sig(main_def_id).subst_identity().output();
|
||||
let main_ret_ty = self.tcx.fn_sig(main_def_id).no_bound_vars().unwrap().output();
|
||||
|
||||
// Given that `main()` has no arguments,
|
||||
// then its return type cannot have
|
||||
|
|
|
@ -357,7 +357,7 @@ pub fn create_ecx<'mir, 'tcx: 'mir>(
|
|||
match entry_type {
|
||||
EntryFnType::Main { .. } => {
|
||||
let start_id = tcx.lang_items().start_fn().unwrap();
|
||||
let main_ret_ty = tcx.fn_sig(entry_id).subst_identity().output();
|
||||
let main_ret_ty = tcx.fn_sig(entry_id).no_bound_vars().unwrap().output();
|
||||
let main_ret_ty = main_ret_ty.no_bound_vars().unwrap();
|
||||
let start_instance = ty::Instance::resolve(
|
||||
tcx,
|
||||
|
|
Loading…
Reference in New Issue