-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Description
static DATA:&'static [&'static str] = ["my string"];
fn main() { }
The error message seems to confuse lifetime with size:
error: mismatched types:
expected `&'static [&'static str]`
but found `[&'static str, .. 1]`
([] storage differs: expected &'static but found 1)
Also note the extra space after &'static
.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
alexcrichton commentedon Mar 18, 2014
Closing as working as intended
The right hand side has type
[&'static str, ..1]
which will normally coerce to a&'static [&'static str]
in code, but in statics there is no coercion. The right hand side will have to be&["my string"]
to work.jruderman commentedon Mar 19, 2014
The error message could use some improvement.
ftxqxd commentedon Oct 4, 2014
The given test case now compiles. Can this be closed, or is there some other case where coercion doesn’t occur?
alexcrichton commentedon Oct 6, 2014
Flagging as needstest
auto merge of #18099 : jakub-/rust/fixed-issues, r=alexcrichton
Auto merge of rust-lang#9249 - JohnTitor:book-prefer-checkout-v3, r=f…