mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
Fix "unstable in stable" error
The "otherwise" note is printed before the suggestion currently.
This commit is contained in:
parent
782a595d7c
commit
ce50939952
@ -33,7 +33,12 @@ pub fn non_const<O: NonConstOp>(ccx: &ConstCx<'_, '_>, op: O, span: Span) -> boo
|
||||
concat!(r#"#[rustc_const_unstable(feature = "...", issue = "...")]"#, '\n').to_owned(),
|
||||
Applicability::HasPlaceholders,
|
||||
)
|
||||
.note("otherwise `#[allow_internal_unstable]` can be used to bypass stability checks")
|
||||
.span_suggestion(
|
||||
ccx.body.span,
|
||||
"otherwise `#[allow_internal_unstable]` can be used to bypass stability checks",
|
||||
format!("#[allow_internal_unstable({})]", gate),
|
||||
Applicability:: MaybeIncorrect,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,14 @@ error: const-stable function cannot use `#[feature(const_fn_fn_ptr_basics)]`
|
||||
LL | const fn error(_: fn()) {}
|
||||
| ^
|
||||
|
|
||||
= note: otherwise `#[allow_internal_unstable]` can be used to bypass stability checks
|
||||
help: if it is not part of the public API, make this function unstably const
|
||||
|
|
||||
LL | #[rustc_const_unstable(feature = "...", issue = "...")]
|
||||
|
|
||||
help: otherwise `#[allow_internal_unstable]` can be used to bypass stability checks
|
||||
|
|
||||
LL | #[allow_internal_unstable(const_fn_fn_ptr_basics)]
|
||||
|
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -20,11 +20,14 @@ error: const-stable function cannot use `#[feature(const_fn_floating_point_arith
|
||||
LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 }
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: otherwise `#[allow_internal_unstable]` can be used to bypass stability checks
|
||||
help: if it is not part of the public API, make this function unstably const
|
||||
|
|
||||
LL | #[rustc_const_unstable(feature = "...", issue = "...")]
|
||||
|
|
||||
help: otherwise `#[allow_internal_unstable]` can be used to bypass stability checks
|
||||
|
|
||||
LL | #[allow_internal_unstable(const_fn_floating_point_arithmetic)]
|
||||
|
|
||||
|
||||
error: `foo2_gated` is not yet stable as a const fn
|
||||
--> $DIR/min_const_fn_libstd_stability.rs:39:32
|
||||
|
@ -20,11 +20,14 @@ error: const-stable function cannot use `#[feature(const_fn_floating_point_arith
|
||||
LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 }
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: otherwise `#[allow_internal_unstable]` can be used to bypass stability checks
|
||||
help: if it is not part of the public API, make this function unstably const
|
||||
|
|
||||
LL | #[rustc_const_unstable(feature = "...", issue = "...")]
|
||||
|
|
||||
help: otherwise `#[allow_internal_unstable]` can be used to bypass stability checks
|
||||
|
|
||||
LL | #[allow_internal_unstable(const_fn_floating_point_arithmetic)]
|
||||
|
|
||||
|
||||
error: `foo2_gated` is not yet stable as a const fn
|
||||
--> $DIR/min_const_unsafe_fn_libstd_stability.rs:39:48
|
||||
|
Loading…
Reference in New Issue
Block a user