Skip to content

Commit

Permalink
rustc: Add long diagnostics for E0170
Browse files Browse the repository at this point in the history
  • Loading branch information
lambda-fairy authored and steveklabnik committed Apr 17, 2015
1 parent aaf92f0 commit 77e8ddf
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/librustc/diagnostics.rs
Expand Up @@ -191,6 +191,32 @@ loop {
}
"##,

E0170: r##"
Enum variants are qualified by default. For example, given this type:
enum Method {
GET,
POST
}
you would match it using:
match m {
Method::GET => ...
Method::POST => ...
}
If you don't qualify the names, the code will bind new variables named "GET" and
"POST" instead. This behavior is likely not what you want, so rustc warns when
that happens.
Qualified names are good practice, and most code works well with them. But if
you prefer them unqualified, you can import the variants into scope:
use Method::*;
enum Method { GET, POST }
"##,

E0297: r##"
Patterns used to bind names must be irrefutable. That is, they must guarantee
that a name will be extracted in all cases. Instead of pattern matching the
Expand Down Expand Up @@ -296,7 +322,6 @@ register_diagnostics! {
E0137,
E0138,
E0139,
E0170,
E0261, // use of undeclared lifetime name
E0262, // illegal lifetime parameter name
E0263, // lifetime name declared twice in same scope
Expand Down

0 comments on commit 77e8ddf

Please sign in to comment.