Skip to content
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

cargo test fails #11

Open
john-parton opened this issue Jul 14, 2023 · 0 comments
Open

cargo test fails #11

john-parton opened this issue Jul 14, 2023 · 0 comments

Comments

@john-parton
Copy link

Running cargo test on my machine produces the following output:

error: cannot find macro `println` in this scope
    --> src/lib.rs:3238:9
     |
3238 |         println!("{:?}", decoded);
     |         ^^^^^^^

error[E0412]: cannot find type `String` in this scope
    --> src/lib.rs:3248:28
     |
3248 |                 .collect::<String>();
     |                            ^^^^^^ not found in this scope
     |
help: you might be missing a type parameter
     |
3242 |     fn check<String>(input: &str, encoding: &'static Encoding) {
     |             ++++++++

error[E0599]: no method named `decode_without_bom_handling` found for reference `&encoding_rs::Encoding` in the current scope
    --> src/lib.rs:3237:32
     |
3237 |         let (decoded, _) = enc.decode_without_bom_handling(bytes);
     |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: there is a method with a similar name: `new_decoder_without_bom_handling`

error[E0599]: no method named `encode` found for reference `&'static encoding_rs::Encoding` in the current scope
    --> src/lib.rs:3249:22
     |
3249 |             encoding.encode(&orthographic)
     |                      ^^^^^^ help: there is a method with a similar name: `new_encoder`

error[E0599]: no method named `encode` found for reference `&'static encoding_rs::Encoding` in the current scope
    --> src/lib.rs:3251:22
     |
3251 |             encoding.encode(input)
     |                      ^^^^^^ help: there is a method with a similar name: `new_encoder`

error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
    --> src/lib.rs:3244:14
     |
3244 |         let (bytes, _, _) = if encoding == WINDOWS_1258 {
     |              ^^^^^ doesn't have a size known at compile-time
     |
     = help: the trait `Sized` is not implemented for `[u8]`
     = note: all local variables must have a statically known size
     = help: unsized locals are gated as an unstable feature

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3645:21
     |
3645 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3655:21
     |
3655 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3665:21
     |
3665 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3675:21
     |
3675 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3685:21
     |
3685 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3695:21
     |
3695 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3705:21
     |
3705 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3715:21
     |
3715 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3725:21
     |
3725 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3735:21
     |
3735 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3745:21
     |
3745 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3755:21
     |
3755 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3765:21
     |
3765 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3775:21
     |
3775 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3785:21
     |
3785 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3795:21
     |
3795 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3805:21
     |
3805 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3815:21
     |
3815 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3825:21
     |
3825 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3835:21
     |
3835 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3845:21
     |
3845 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

error[E0433]: failed to resolve: use of undeclared type `Vec`
    --> src/lib.rs:3855:21
     |
3855 |         let mut v = Vec::new();
     |                     ^^^ use of undeclared type `Vec`

Some errors have detailed explanations: E0277, E0412, E0433, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `chardetng` (lib test) due to 28 previous errors

There are three kinds of errors

  1. String and Vec are not imported because the crate is nostd. It's easy to import them in the tests mod
  2. println! doesn't work for the same reason, but I believe that code can just be removed
  3. Several of the encoding_rs functions require the alloc feature. I'm not sure how to fix those.
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

No branches or pull requests

1 participant