Skip to content

Documentation or example for the allocator not working #97

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
huntc opened this issue Oct 8, 2020 · 3 comments · Fixed by #98
Closed

Documentation or example for the allocator not working #97

huntc opened this issue Oct 8, 2020 · 3 comments · Fixed by #98

Comments

@huntc
Copy link

huntc commented Oct 8, 2020

The documentation appears to be out of date. If I follow the steps then, to build the allocator example, I get the following error:

% cargo build --example allocator         
   Compiling typenum v1.12.0
   Compiling version_check v0.9.2
   Compiling semver-parser v0.7.0
   Compiling proc-macro2 v1.0.24
   Compiling unicode-xid v0.2.1
   Compiling cortex-m v0.6.3
   Compiling syn v1.0.42
   Compiling stable_deref_trait v1.2.0
   Compiling vcell v0.1.2
   Compiling cortex-m-semihosting v0.3.5
   Compiling volatile-register v0.1.2
   Compiling bitfield v0.13.2
   Compiling cortex-m-rt v0.6.13
   Compiling test v0.1.0 (/Users/huntc/Desktop/test/test)
   Compiling r0 v0.2.2
   Compiling linked_list_allocator v0.6.6
error[E0554]: `#![feature]` may not be used on the stable release channel
 --> /Users/huntc/.cargo/registry/src/github.lhy31512.workers.dev-1ecc6299db9ec823/linked_list_allocator-0.6.6/src/lib.rs:1:1
  |
1 | #![feature(const_fn)]
  | ^^^^^^^^^^^^^^^^^^^^^
...

If I try with the nightly:

huntc@Christophers-MacBook-Pro test % cargo +nightly build --example allocator
   Compiling typenum v1.12.0
   Compiling semver-parser v0.7.0
   Compiling version_check v0.9.2
   Compiling proc-macro2 v1.0.24
   Compiling unicode-xid v0.2.1
   Compiling cortex-m v0.6.3
   Compiling syn v1.0.42
   Compiling stable_deref_trait v1.2.0
   Compiling vcell v0.1.2
   Compiling cortex-m-semihosting v0.3.5
   Compiling volatile-register v0.1.2
   Compiling cortex-m-rt v0.6.13
   Compiling bitfield v0.13.2
   Compiling linked_list_allocator v0.6.6
   Compiling test v0.1.0 (/Users/huntc/Desktop/test/test)
   Compiling r0 v0.2.2
error[E0432]: unresolved import `alloc::alloc::AllocErr`
  --> /Users/huntc/.cargo/registry/src/github.lhy31512.workers.dev-1ecc6299db9ec823/linked_list_allocator-0.6.6/src/lib.rs:14:30
   |
14 | use alloc::alloc::{AllocRef, AllocErr, Layout};
   |                              ^^^^^^^^
   |                              |
   |                              no `AllocErr` in `alloc`
   |                              help: a similar name exists in the module: `AllocError`
...

Any pointers no how to see that the allocator example is able to be built? Is the documentation/example out of date?

@thalesfragoso
Copy link
Member

Hmm, could you try updating this line to 0.4.0:

# alloc-cortex-m = "0.3.5"

@huntc
Copy link
Author

huntc commented Oct 11, 2020

Thanks @thalesfragoso . I did that, but then receive:

% cargo build --example allocator
   Compiling linked_list_allocator v0.8.6
   Compiling typenum v1.12.0
   Compiling semver v0.9.0
   Compiling generic-array v0.14.4
   Compiling proc-macro2 v1.0.24
   Compiling cortex-m v0.6.3
   Compiling syn v1.0.42
   Compiling cortex-m-rt v0.6.13
error[E0554]: `#![feature]` may not be used on the stable release channel
 --> /Users/huntc/.cargo/registry/src/github.lhy31512.workers.dev-1ecc6299db9ec823/linked_list_allocator-0.8.6/src/lib.rs:1:1
  |
1 | #![feature(const_mut_refs)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0554`.
error: could not compile `linked_list_allocator`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

With nightly:

 % cargo +nightly build --example allocator
   Compiling semver-parser v0.7.0
   Compiling version_check v0.9.2
   Compiling cortex-m v0.6.3
   Compiling proc-macro2 v1.0.24
   Compiling stable_deref_trait v1.2.0
   Compiling unicode-xid v0.2.1
   Compiling syn v1.0.42
   Compiling vcell v0.1.2
   Compiling bitfield v0.13.2
   Compiling cortex-m-rt v0.6.13
   Compiling cortex-m-semihosting v0.3.5
   Compiling linked_list_allocator v0.8.6
   Compiling test v0.1.0 (/Users/huntc/Desktop/test/test)
   Compiling r0 v0.2.2
   Compiling panic-halt v0.2.0
   Compiling volatile-register v0.2.0
   Compiling semver v0.9.0
   Compiling generic-array v0.14.4
   Compiling rustc_version v0.2.3
   Compiling bare-metal v0.2.5
   Compiling quote v1.0.7
   Compiling generic-array v0.12.3
   Compiling generic-array v0.13.2
   Compiling as-slice v0.1.4
   Compiling aligned v0.3.4
   Compiling alloc-cortex-m v0.4.0
   Compiling cortex-m-rt-macros v0.1.8
error[E0433]: failed to resolve: use of undeclared crate or module `debug`
  --> examples/allocator.rs:46:5
   |
46 |     debug::exit(debug::EXIT_SUCCESS);
   |     ^^^^^ use of undeclared crate or module `debug`

error[E0433]: failed to resolve: use of undeclared crate or module `debug`
  --> examples/allocator.rs:46:17
   |
46 |     debug::exit(debug::EXIT_SUCCESS);
   |                 ^^^^^ use of undeclared crate or module `debug`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0433`.
error: could not compile `test`

@huntc
Copy link
Author

huntc commented Oct 13, 2020

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants