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

[bug] debian test failure #185

Closed
werdahias opened this issue Sep 7, 2022 · 5 comments
Closed

[bug] debian test failure #185

werdahias opened this issue Sep 7, 2022 · 5 comments

Comments

@werdahias
Copy link

Hi, I recently package your crate for debian. The tests fail though:

error[E0433]: failed to resolve: use of undeclared crate or module `salvo`
 --> examples/salvo.rs:2:5
  |
2 | use salvo::prelude::*;
  |     ^^^^^ use of undeclared crate or module `salvo`

error[E0433]: failed to resolve: use of undeclared crate or module `salvo`
 --> examples/salvo.rs:1:5
  |
1 | use salvo::http::{header, StatusCode};
  |     ^^^^^ use of undeclared crate or module `salvo`

error[E0432]: unresolved imports `salvo::http::header`, `salvo::http::StatusCode`
 --> examples/salvo.rs:1:19
  |
1 | use salvo::http::{header, StatusCode};
  |                   ^^^^^^  ^^^^^^^^^^

error[E0433]: failed to resolve: use of undeclared crate or module `tokio`
 --> examples/salvo.rs:4:3
  |
4 | #[tokio::main]
  |   ^^^^^ use of undeclared crate or module `tokio`

error: cannot find attribute `fn_handler` in this scope
  --> examples/salvo.rs:19:3
   |
19 | #[fn_handler]
   |   ^^^^^^^^^^

error[E0433]: failed to resolve: use of undeclared type `Router`
 --> examples/salvo.rs:6:16
  |
6 |   let router = Router::new()
  |                ^^^^^^ use of undeclared type `Router`

error[E0433]: failed to resolve: use of undeclared type `Router`
 --> examples/salvo.rs:7:11
  |
7 |     .push(Router::with_path("dist/<**>").get(static_embed))
  |           ^^^^^^ use of undeclared type `Router`

error[E0433]: failed to resolve: use of undeclared type `Router`
 --> examples/salvo.rs:8:11
  |
8 |     .push(Router::with_path("/<**>").get(static_embed));
  |           ^^^^^^ use of undeclared type `Router`

error[E0433]: failed to resolve: use of undeclared type `Server`
  --> examples/salvo.rs:11:3
   |
11 |   Server::new(listener).serve(router).await;
   |   ^^^^^^ use of undeclared type `Server`

error[E0433]: failed to resolve: use of undeclared crate or module `hex`
  --> examples/salvo.rs:28:18
   |
28 |       let hash = hex::encode(content.metadata.sha256_hash());
   |                  ^^^ use of undeclared crate or module `hex`

error[E0433]: failed to resolve: use of undeclared crate or module `header`
  --> examples/salvo.rs:32:14
   |
32 |         .get(header::IF_NONE_MATCH)
   |              ^^^^^^ use of undeclared crate or module `header`

error[E0433]: failed to resolve: use of undeclared type `StatusCode`
  --> examples/salvo.rs:36:29
   |
36 |         res.set_status_code(StatusCode::NOT_MODIFIED);
   |                             ^^^^^^^^^^ use of undeclared type `StatusCode`

error[E0433]: failed to resolve: use of undeclared crate or module `mime_guess`
  --> examples/salvo.rs:42:18
   |
42 |       let mime = mime_guess::from_path(path).first_or_octet_stream();
   |                  ^^^^^^^^^^ use of undeclared crate or module `mime_guess`

error[E0433]: failed to resolve: use of undeclared crate or module `header`
  --> examples/salvo.rs:43:32
   |
43 |       res.headers_mut().insert(header::ETAG, hash.parse().unwrap());
   |                                ^^^^^^ use of undeclared crate or module `header`

error[E0433]: failed to resolve: use of undeclared type `StatusCode`
  --> examples/salvo.rs:46:33
   |
46 |     None => res.set_status_code(StatusCode::NOT_FOUND),
   |                                 ^^^^^^^^^^ use of undeclared type `StatusCode`

error[E0433]: failed to resolve: use of undeclared type `TcpListener`
  --> examples/salvo.rs:10:18
   |
10 |   let listener = TcpListener::bind("127.0.0.1:3000");
   |                  ^^^^^^^^^^^ not found in this scope
   |
help: consider importing this struct
   |
1  | use std::net::TcpListener;
   |

error[E0412]: cannot find type `Request` in this scope
  --> examples/salvo.rs:20:33
   |
20 | async fn static_embed(req: &mut Request, res: &mut Response) {
   |                                 ^^^^^^^ not found in this scope

error[E0412]: cannot find type `Response` in this scope
  --> examples/salvo.rs:20:52
   |
20 | async fn static_embed(req: &mut Request, res: &mut Response) {
   |                                                    ^^^^^^^^ not found in this scope

This is caused by salvo, axum, actix-web, include-flate, poem, rocket and warp not yet available in debian. Would you consider disabling the example/ tests? I'd really appreciate it.

@AzureMarker
Copy link
Collaborator

AzureMarker commented Sep 7, 2022

What command are you using to compile the crate? You don't need to compile the tests/examples.

@werdahias
Copy link
Author

this is the autopkgtest, which test the crate with all features enabled/disabled. I patched out the dependencies mentioned above. The issue is still the same with 6.4.1.

@AzureMarker
Copy link
Collaborator

Not all features available in Cargo.toml are intended to be used by a library user. Due to how examples work in Cargo, we need a feature to enable certain dependencies only in example code. Please do not try to compile a build intended for packaging with the example-specific features enabled.

@werdahias
Copy link
Author

I patched out the examples in Cargo.toml I don't know why the autopkgtest fails still

@AzureMarker
Copy link
Collaborator

The example declarations aren't required for cargo to recognize the examples. They just add more details (ex. required features).

I'm going to close this issue since it's not a problem with the library (the configuration is working as expected).

@AzureMarker AzureMarker closed this as not planned Won't fix, can't repro, duplicate, stale Sep 18, 2022
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

2 participants