Skip to content

Commit fb53299

Browse files
No output allowed
1 parent 1cfd47f commit fb53299

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ struct LoweringContext<'a, 'hir> {
129129
/// NodeIds that are lowered inside the current HIR owner.
130130
node_id_to_local_id: NodeMap<hir::ItemLocalId>,
131131

132+
allow_fn_once_output: Lrc<[Symbol]>,
132133
allow_try_trait: Lrc<[Symbol]>,
133134
allow_gen_future: Lrc<[Symbol]>,
134135
allow_async_iterator: Lrc<[Symbol]>,
@@ -177,6 +178,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
177178
current_item: None,
178179
impl_trait_defs: Vec::new(),
179180
impl_trait_bounds: Vec::new(),
181+
allow_fn_once_output: [sym::fn_traits].into(),
180182
allow_try_trait: [sym::try_trait_v2, sym::yeet_desugar_details].into(),
181183
allow_gen_future: if tcx.features().async_fn_track_caller {
182184
[sym::gen_future, sym::closure_track_caller].into()

compiler/rustc_ast_lowering/src/path.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -440,14 +440,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
440440

441441
// If we have a bound like `async Fn() -> T`, make sure that we mark the
442442
// `Output = T` associated type bound with the right feature gates.
443-
let mut output_span = output_ty.span;
444-
if let Some(bound_modifier_allowed_features) = bound_modifier_allowed_features {
445-
output_span = self.mark_span_with_reason(
446-
DesugaringKind::BoundModifier,
447-
output_span,
448-
Some(bound_modifier_allowed_features),
449-
);
450-
}
443+
let output_span = self.mark_span_with_reason(
444+
DesugaringKind::BoundModifier,
445+
output_ty.span,
446+
Some(bound_modifier_allowed_features.unwrap_or_else(|| self.allow_fn_once_output.clone())),
447+
);
451448
let constraint = self.assoc_ty_binding(sym::Output, output_span, output_ty);
452449

453450
(

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,7 @@ symbols! {
898898
fn_once_output,
899899
fn_ptr_addr,
900900
fn_ptr_trait,
901+
fn_traits,
901902
forbid,
902903
forget,
903904
format,

library/core/src/ops/function.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@ pub trait FnMut<Args: Tuple>: FnOnce<Args> {
242242
pub trait FnOnce<Args: Tuple> {
243243
/// The returned type after the call operator is used.
244244
#[lang = "fn_once_output"]
245-
#[stable(feature = "fn_once_output", since = "1.12.0")]
245+
#[cfg_attr(bootstrap, stable(feature = "fn_once_output", since = "1.12.0"))]
246+
#[cfg_attr(not(bootstrap), unstable(feature = "fn_traits", issue = "29625"))]
246247
type Output;
247248

248249
/// Performs the call operation.

0 commit comments

Comments
 (0)