Skip to content

facet-core: Doesn't compile without the alloc feature #2197

@tyilo

Description

@tyilo
$ cd /tmp
$ cargo new facet-core-test
$ cd facet-core-test
$ cargo add facet-core --no-default-features
$ cargo run
   Compiling autocfg v1.5.1
   Compiling impls v1.0.3
   Compiling const-fnv1a-hash v1.1.0
   Compiling facet-core v0.46.5
error[E0433]: cannot find module or crate `alloc` in this scope
 --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/types/shape/shape_builder.rs:1:5
  |
1 | use alloc::alloc::Layout;
  |     ^^^^^ use of unresolved module or unlinked crate `alloc`
  |
  = help: add `extern crate alloc` to use the `alloc` crate

error[E0433]: cannot find module or crate `alloc` in this scope
 --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/impls/core/duration.rs:1:5
  |
1 | use alloc::string::String;
  |     ^^^^^ use of unresolved module or unlinked crate `alloc`
  |
  = help: add `extern crate alloc` to use the `alloc` crate

error[E0433]: cannot find module or crate `alloc` in this scope
 --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/types/vtable.rs:6:5
  |
6 | use alloc::string::String;
  |     ^^^^^ use of unresolved module or unlinked crate `alloc`
  |
  = help: add `extern crate alloc` to use the `alloc` crate

error[E0433]: cannot find module or crate `alloc` in this scope
  --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/types/builtins.rs:41:5
   |
41 | use alloc::boxed::Box;
   |     ^^^^^ use of unresolved module or unlinked crate `alloc`
   |
   = help: add `extern crate alloc` to use the `alloc` crate

error[E0432]: unresolved imports `crate::FormatProxy`, `crate::OpaqueAdapterDef`, `crate::ProxyDef`
   --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/types/shape/shape_builder.rs:4:49
    |
  4 |     Attr, ConstParam, ConstTypeId, DeclId, Def, FormatProxy, MarkerTraits, OpaqueAdapterDef,
    |                                                 ^^^^^^^^^^^                ^^^^^^^^^^^^^^^^ no `OpaqueAdapterDef` in the root
    |                                                 |
    |                                                 no `FormatProxy` in the root
  5 |     ProxyDef, Shape, ShapeFlags, ShapeLayout, Type, TypeNameFn, TypeOps, TypeOpsDirect,
    |     ^^^^^^^^ no `ProxyDef` in the root
    |
note: found an item that was configured out
   --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/types/ty/proxy.rs:118:12
    |
116 | #[cfg(feature = "alloc")]
    |       ----------------- the item is gated behind the `alloc` feature
117 | #[derive(Clone, Copy, Debug)]
118 | pub struct FormatProxy {
    |            ^^^^^^^^^^^
note: found an item that was configured out
   --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/types/ty/opaque_adapter.rs:74:12
    |
 72 | #[cfg(feature = "alloc")]
    |       ----------------- the item is gated behind the `alloc` feature
 73 | #[derive(Clone, Copy)]
 74 | pub struct OpaqueAdapterDef {
    |            ^^^^^^^^^^^^^^^^
note: found an item that was configured out
   --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/types/ty/proxy.rs:66:12
    |
 64 | #[cfg(feature = "alloc")]
    |       ----------------- the item is gated behind the `alloc` feature
 65 | #[derive(Clone, Copy)]
 66 | pub struct ProxyDef {
    |            ^^^^^^^^

error[E0432]: unresolved import `crate::ProxyDef`
  --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/impls/core/duration.rs:5:29
   |
 5 |     Def, Facet, OxPtrConst, ProxyDef, PtrConst, PtrMut, PtrUninit, Shape, ShapeBuilder, Type,
   |                             ^^^^^^^^ no `ProxyDef` in the root
   |
note: found an item that was configured out
  --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/types/ty/proxy.rs:66:12
   |
64 | #[cfg(feature = "alloc")]
   |       ----------------- the item is gated behind the `alloc` feature
65 | #[derive(Clone, Copy)]
66 | pub struct ProxyDef {
   |            ^^^^^^^^

error[E0433]: cannot find module or crate `alloc` in this scope
    --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/types/shape.rs:1018:28
     |
1018 |     ) -> Option<Result<(), alloc::string::String>> {
     |                            ^^^^^ use of unresolved module or unlinked crate `alloc`
     |
     = help: add `extern crate alloc` to use the `alloc` crate

error[E0433]: cannot find module or crate `alloc` in this scope
    --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/types/shape.rs:1113:39
     |
1113 |     ) -> Option<Result<crate::PtrMut, alloc::string::String>> {
     |                                       ^^^^^ use of unresolved module or unlinked crate `alloc`
     |
     = help: add `extern crate alloc` to use the `alloc` crate

error[E0433]: cannot find module or crate `alloc` in this scope
   --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/types/builtins.rs:654:21
    |
654 |                     alloc::alloc::dealloc(ptr, layout);
    |                     ^^^^^ use of unresolved module or unlinked crate `alloc`
    |
    = help: add `extern crate alloc` to use the `alloc` crate

error[E0433]: cannot find module or crate `alloc` in this scope
   --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/types/ty/field.rs:353:65
    |
353 | pub type ValidatorFn = unsafe fn(value: PtrConst) -> Result<(), alloc::string::String>;
    |                                                                 ^^^^^ use of unresolved module or unlinked crate `alloc`
    |
    = help: add `extern crate alloc` to use the `alloc` crate

error[E0433]: cannot find module or crate `alloc` in this scope
   --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/types/error.rs:102:12
    |
102 |     Failed(alloc::borrow::Cow<'static, str>),
    |            ^^^^^ use of unresolved module or unlinked crate `alloc`
    |
    = help: add `extern crate alloc` to use the `alloc` crate

error[E0433]: cannot find module or crate `alloc` in this scope
   --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/types/error.rs:119:13
    |
119 |     Generic(alloc::string::String),
    |             ^^^^^ use of unresolved module or unlinked crate `alloc`
    |
    = help: add `extern crate alloc` to use the `alloc` crate

error[E0560]: struct `types::shape::Shape` has no field named `proxy`
  --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/types/shape/shape_builder.rs:46:5
   |
46 |     proxy: None,
   |     ^^^^^ `types::shape::Shape` does not have this field
   |
   = note: all struct fields are already assigned

error[E0560]: struct `types::shape::Shape` has no field named `format_proxies`
  --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/types/shape/shape_builder.rs:47:5
   |
47 |     format_proxies: &[],
   |     ^^^^^^^^^^^^^^ `types::shape::Shape` does not have this field
   |
   = note: all struct fields are already assigned

error[E0560]: struct `types::shape::Shape` has no field named `opaque_adapter`
  --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/types/shape/shape_builder.rs:48:5
   |
48 |     opaque_adapter: None,
   |     ^^^^^^^^^^^^^^ `types::shape::Shape` does not have this field
   |
   = note: all struct fields are already assigned

error[E0609]: no field `proxy` on type `types::shape::Shape`
   --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/types/shape/shape_builder.rs:350:20
    |
350 |         self.shape.proxy = Some(proxy);
    |                    ^^^^^ unknown field
    |
    = note: available fields are: `id`, `decl_id`, `layout`, `vtable`, `type_ops` ... and 21 others

error[E0609]: no field `format_proxies` on type `types::shape::Shape`
   --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/types/shape/shape_builder.rs:361:20
    |
361 |         self.shape.format_proxies = proxies;
    |                    ^^^^^^^^^^^^^^ unknown field
    |
    = note: available fields are: `id`, `decl_id`, `layout`, `vtable`, `type_ops` ... and 21 others

error[E0609]: no field `opaque_adapter` on type `types::shape::Shape`
   --> /home/tyilo/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/facet-core-0.46.5/src/types/shape/shape_builder.rs:368:20
    |
368 |         self.shape.opaque_adapter = Some(adapter);
    |                    ^^^^^^^^^^^^^^ unknown field
    |
    = note: available fields are: `id`, `decl_id`, `layout`, `vtable`, `type_ops` ... and 21 others

Some errors have detailed explanations: E0432, E0433, E0560, E0609.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `facet-core` (lib) due to 18 previous errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions