mirror of https://github.com/rust-lang/rust.git
Add lang item for Future::Output
This commit is contained in:
parent
7f11d6f4bf
commit
a9c7e024c0
|
@ -238,6 +238,7 @@ language_item_table! {
|
||||||
Iterator, sym::iterator, iterator_trait, Target::Trait, GenericRequirement::Exact(0);
|
Iterator, sym::iterator, iterator_trait, Target::Trait, GenericRequirement::Exact(0);
|
||||||
FusedIterator, sym::fused_iterator, fused_iterator_trait, Target::Trait, GenericRequirement::Exact(0);
|
FusedIterator, sym::fused_iterator, fused_iterator_trait, Target::Trait, GenericRequirement::Exact(0);
|
||||||
Future, sym::future_trait, future_trait, Target::Trait, GenericRequirement::Exact(0);
|
Future, sym::future_trait, future_trait, Target::Trait, GenericRequirement::Exact(0);
|
||||||
|
FutureOutput, sym::future_output, future_output, Target::AssocTy, GenericRequirement::Exact(0);
|
||||||
AsyncIterator, sym::async_iterator, async_iterator_trait, Target::Trait, GenericRequirement::Exact(0);
|
AsyncIterator, sym::async_iterator, async_iterator_trait, Target::Trait, GenericRequirement::Exact(0);
|
||||||
|
|
||||||
CoroutineState, sym::coroutine_state, coroutine_state, Target::Enum, GenericRequirement::None;
|
CoroutineState, sym::coroutine_state, coroutine_state, Target::Enum, GenericRequirement::None;
|
||||||
|
|
|
@ -1478,7 +1478,7 @@ pub fn suggest_impl_trait<'tcx>(
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
infcx.tcx.lang_items().future_trait(),
|
infcx.tcx.lang_items().future_trait(),
|
||||||
infcx.tcx.get_diagnostic_item(sym::FutureOutput),
|
infcx.tcx.lang_items().future_output(),
|
||||||
format_as_assoc,
|
format_as_assoc,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
|
|
@ -210,7 +210,6 @@ symbols! {
|
||||||
FsPermissions,
|
FsPermissions,
|
||||||
FusedIterator,
|
FusedIterator,
|
||||||
Future,
|
Future,
|
||||||
FutureOutput,
|
|
||||||
GlobalAlloc,
|
GlobalAlloc,
|
||||||
Hash,
|
Hash,
|
||||||
HashMap,
|
HashMap,
|
||||||
|
@ -914,6 +913,7 @@ symbols! {
|
||||||
fundamental,
|
fundamental,
|
||||||
fused_iterator,
|
fused_iterator,
|
||||||
future,
|
future,
|
||||||
|
future_output,
|
||||||
future_trait,
|
future_trait,
|
||||||
gdb_script_file,
|
gdb_script_file,
|
||||||
ge,
|
ge,
|
||||||
|
|
|
@ -454,12 +454,7 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_async_callable<'tc
|
||||||
.rebind(ty::TraitRef::new(tcx, future_trait_def_id, [sig.output()]))
|
.rebind(ty::TraitRef::new(tcx, future_trait_def_id, [sig.output()]))
|
||||||
.upcast(tcx),
|
.upcast(tcx),
|
||||||
];
|
];
|
||||||
let future_output_def_id = tcx
|
let future_output_def_id = tcx.require_lang_item(LangItem::FutureOutput, None);
|
||||||
.associated_items(future_trait_def_id)
|
|
||||||
.filter_by_name_unhygienic(sym::Output)
|
|
||||||
.next()
|
|
||||||
.unwrap()
|
|
||||||
.def_id;
|
|
||||||
let future_output_ty = Ty::new_projection(tcx, future_output_def_id, [sig.output()]);
|
let future_output_ty = Ty::new_projection(tcx, future_output_def_id, [sig.output()]);
|
||||||
Ok((
|
Ok((
|
||||||
bound_sig.rebind(AsyncCallableRelevantTypes {
|
bound_sig.rebind(AsyncCallableRelevantTypes {
|
||||||
|
@ -510,12 +505,7 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_async_callable<'tc
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let future_output_def_id = tcx
|
let future_output_def_id = tcx.require_lang_item(LangItem::FutureOutput, None);
|
||||||
.associated_items(future_trait_def_id)
|
|
||||||
.filter_by_name_unhygienic(sym::Output)
|
|
||||||
.next()
|
|
||||||
.unwrap()
|
|
||||||
.def_id;
|
|
||||||
let future_output_ty = Ty::new_projection(tcx, future_output_def_id, [sig.output()]);
|
let future_output_ty = Ty::new_projection(tcx, future_output_def_id, [sig.output()]);
|
||||||
Ok((
|
Ok((
|
||||||
bound_sig.rebind(AsyncCallableRelevantTypes {
|
bound_sig.rebind(AsyncCallableRelevantTypes {
|
||||||
|
|
|
@ -1880,13 +1880,7 @@ fn confirm_async_closure_candidate<'cx, 'tcx>(
|
||||||
let term = match item_name {
|
let term = match item_name {
|
||||||
sym::CallOnceFuture | sym::CallRefFuture => sig.output(),
|
sym::CallOnceFuture | sym::CallRefFuture => sig.output(),
|
||||||
sym::Output => {
|
sym::Output => {
|
||||||
let future_trait_def_id = tcx.require_lang_item(LangItem::Future, None);
|
let future_output_def_id = tcx.require_lang_item(LangItem::FutureOutput, None);
|
||||||
let future_output_def_id = tcx
|
|
||||||
.associated_items(future_trait_def_id)
|
|
||||||
.filter_by_name_unhygienic(sym::Output)
|
|
||||||
.next()
|
|
||||||
.unwrap()
|
|
||||||
.def_id;
|
|
||||||
Ty::new_projection(tcx, future_output_def_id, [sig.output()])
|
Ty::new_projection(tcx, future_output_def_id, [sig.output()])
|
||||||
}
|
}
|
||||||
name => bug!("no such associated type: {name}"),
|
name => bug!("no such associated type: {name}"),
|
||||||
|
@ -1919,13 +1913,7 @@ fn confirm_async_closure_candidate<'cx, 'tcx>(
|
||||||
let term = match item_name {
|
let term = match item_name {
|
||||||
sym::CallOnceFuture | sym::CallRefFuture => sig.output(),
|
sym::CallOnceFuture | sym::CallRefFuture => sig.output(),
|
||||||
sym::Output => {
|
sym::Output => {
|
||||||
let future_trait_def_id = tcx.require_lang_item(LangItem::Future, None);
|
let future_output_def_id = tcx.require_lang_item(LangItem::FutureOutput, None);
|
||||||
let future_output_def_id = tcx
|
|
||||||
.associated_items(future_trait_def_id)
|
|
||||||
.filter_by_name_unhygienic(sym::Output)
|
|
||||||
.next()
|
|
||||||
.unwrap()
|
|
||||||
.def_id;
|
|
||||||
Ty::new_projection(tcx, future_output_def_id, [sig.output()])
|
Ty::new_projection(tcx, future_output_def_id, [sig.output()])
|
||||||
}
|
}
|
||||||
name => bug!("no such associated type: {name}"),
|
name => bug!("no such associated type: {name}"),
|
||||||
|
|
|
@ -35,7 +35,7 @@ use crate::task::{Context, Poll};
|
||||||
pub trait Future {
|
pub trait Future {
|
||||||
/// The type of value produced on completion.
|
/// The type of value produced on completion.
|
||||||
#[stable(feature = "futures_api", since = "1.36.0")]
|
#[stable(feature = "futures_api", since = "1.36.0")]
|
||||||
#[rustc_diagnostic_item = "FutureOutput"]
|
#[cfg_attr(not(bootstrap), lang = "future_output")]
|
||||||
type Output;
|
type Output;
|
||||||
|
|
||||||
/// Attempt to resolve the future to a final value, registering
|
/// Attempt to resolve the future to a final value, registering
|
||||||
|
|
Loading…
Reference in New Issue