Closed
Description
Related to, but not a duplicate of #52144.
use headers::SetCookie;
fn main() {
let _ = SetCookie(vec![]);
}
[package]
name = "e0423-test"
version = "0.1.0"
edition = "2018"
[dependencies]
headers = "0.2.0"
Checking e0423-test v0.1.0 (/home/grayshade/e0423-test)
error[E0423]: expected function, found struct `SetCookie`
--> src/main.rs:4:13
|
4 | let _ = SetCookie(vec![]);
| ^^^^^^^^^ did you mean `SetCookie { /* fields */ }`?
error: aborting due to previous error
Interestingly, the following code:
mod cookie {
pub struct HeaderValue;
pub struct SetCookie(Vec<HeaderValue>);
}
use cookie::SetCookie;
fn main() {
let _ = SetCookie(vec![]);
}
Gives a better, but still confusing error message:
error[E0423]: expected function, found struct `SetCookie`
--> src/main.rs:10:13
|
10 | let _ = SetCookie(vec![]);
| ^^^^^^^^^ constructor is not visible here due to private fields
help: possible better candidate is found in another module, you can import it into scope
|
7 | use crate::cookie::SetCookie;
|
error: aborting due to previous error
Tested in rustc 1.34.0-nightly (c1c3c4e95 2019-01-29)
.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsCategory: An issue proposing an enhancement or a PR with one.Diagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: An error or lint that needs small tweaks.Relevant to the compiler team, which will review and decide on the PR/issue.