add a HACK to allow stdarch migration

This commit is contained in:
Ralf Jung 2024-10-08 19:03:35 +02:00
parent 16b9bb744d
commit 36dda4571d
3 changed files with 9 additions and 21 deletions

View File

@ -189,6 +189,9 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
&& let Some(fn_sig) = fn_sig
&& const_stab.is_const_stable()
&& !stab.is_some_and(|(s, _)| s.is_stable())
// FIXME: we skip this check targets until
// <https://github.com/rust-lang/stdarch/pull/1654> propagates.
&& false
{
self.tcx
.dcx()

View File

@ -47,15 +47,16 @@ pub const fn foobar() {}
pub const fn barfoo() {}
// `rustc_const_stable` also requires the function to be stable.
// FIXME: these are disabled until <https://github.com/rust-lang/stdarch/pull/1654> propagates.
#[rustc_const_stable(feature = "barfoo_const", since = "1.0.0")]
const fn barfoo_unmarked() {}
//~^ ERROR can only be applied to functions that are declared `#[stable]`
// FIXME disabled ERROR can only be applied to functions that are declared `#[stable]`
#[unstable(feature = "unstable", issue = "none")]
#[rustc_const_stable(feature = "barfoo_const", since = "1.0.0")]
pub const fn barfoo_unstable() {}
//~^ ERROR can only be applied to functions that are declared `#[stable]`
// FIXME disabled ERROR can only be applied to functions that are declared `#[stable]`
// `#[rustc_const_stable_indirect]` also requires a const fn
#[rustc_const_stable_indirect]

View File

@ -70,33 +70,17 @@ help: make the function or method const
LL | pub extern "C" fn foo_c() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: attribute `#[rustc_const_stable]` can only be applied to functions that are declared `#[stable]`
--> $DIR/rustc-const-stability-require-const.rs:52:1
|
LL | #[rustc_const_stable(feature = "barfoo_const", since = "1.0.0")]
| ---------------------------------------------------------------- attribute specified here
LL | const fn barfoo_unmarked() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: attribute `#[rustc_const_stable]` can only be applied to functions that are declared `#[stable]`
--> $DIR/rustc-const-stability-require-const.rs:57:1
|
LL | #[rustc_const_stable(feature = "barfoo_const", since = "1.0.0")]
| ---------------------------------------------------------------- attribute specified here
LL | pub const fn barfoo_unstable() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: attributes `#[rustc_const_unstable]`, `#[rustc_const_stable]` and `#[rustc_const_stable_indirect]` require the function or method to be `const`
--> $DIR/rustc-const-stability-require-const.rs:63:1
--> $DIR/rustc-const-stability-require-const.rs:64:1
|
LL | pub fn not_a_const_fn() {}
| ^^^^^^^^^^^^^^^^^^^^^^^
|
help: make the function or method const
--> $DIR/rustc-const-stability-require-const.rs:63:1
--> $DIR/rustc-const-stability-require-const.rs:64:1
|
LL | pub fn not_a_const_fn() {}
| ^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 9 previous errors
error: aborting due to 7 previous errors