Skip to content

make_static!() does not work anymore since rustc nightly-2024-06-13 #16

Closed
@aurelj

Description

@aurelj

make_static!() does not work anymore since rustc nightly-2024-06-13 or more precisely since this commit:
rust-lang/rust@02c7a59

Here is the detailed error I get when compiling with RUSTFLAGS="-Zmacro-backtrace":

error: item does not constrain `T::{opaque#0}`, but has it in its signature
   --> devel/embedded/static-cell/src/lib.rs:239:16
    |
234 | macro_rules! make_static {
    | ------------------------
    | |
    | in this expansion of `make_static!` (#1)
    | in this expansion of `$crate::make_static!` (#2)
235 |     ($val:expr) => ($crate::make_static!($val, ));
    |                     ---------------------------- in this macro invocation (#2)
...
239 |         static STATIC_CELL: $crate::StaticCell<T> = $crate::StaticCell::new();
    |                ^^^^^^^^^^^
    |
   ::: src/main.rs:133:24
    |
133 |     let merge_buffer = make_static!([0; 4096]);
    |                        ----------------------- in this macro invocation (#1)
    |
    = note: consider moving the opaque type's declaration and defining uses into a separate module
note: this opaque type is in the signature
   --> devel/embedded/static-cell/src/lib.rs:237:18
    |
234 | macro_rules! make_static {
    | ------------------------
    | |
    | in this expansion of `make_static!` (#1)
    | in this expansion of `$crate::make_static!` (#2)
235 |     ($val:expr) => ($crate::make_static!($val, ));
    |                     ---------------------------- in this macro invocation (#2)
236 |     ($val:expr, $(#[$m:meta])*) => {{
237 |         type T = impl ::core::marker::Sized;
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
   ::: src/main.rs:133:24
    |
133 |     let merge_buffer = make_static!([0; 4096]);
    |                        ----------------------- in this macro invocation (#1)

It seems the TAIT trick currently used in make_static!() is not allowed anymore. I tried to find an alternative without success.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions