Fix#7322.
I started out with a band-aid approach to special-case the duplicate module error using `is_duplicate_module`, but thought this would be better in the long term.
add_child() is responsible for reporting errors about type, value, and
module duplicate definitions. Although it checks for all three, it uses
namespace_to_str() to convert a Namespace value into a string before
printing an error like:
error: duplicate definition of type `foo`
^^^^
note: first definition of type foo here:
^^^^
Unfortunately, this string can only be one of "type" or
"value" (corresponding to TypeNS and ValueNS respectively), and it
reports duplicate modules as duplicate types.
To alleviate the problem, define a special NamespaceError enum to define
more specialized errors, and use it instead of attempting to reuse the
Namespace enum.
Reported-by: Corey Richardson <corey@octayn.net>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
I removed the `static-method-test.rs` test because it was heavily based
on `BaseIter` and there are plenty of other more complex uses of static
methods anyway.
Minimally fixes#7017, we were overwriting the result and thus ignoring attributes before the last.
csearch::get_item_attrs and decoder::get_item_attrs should probably also be changed to each_item_attrs using the for protocol, but that's just a minor performance/style issue.
There are two distinct kinds of bad-for-loops to check for with two
distinct error messages. The current bad-for-loop.rs does not make this
clear, so rewrite it into bad-for-loop{,-2}.rs. The two failing
prototypes are:
fn quux(_: &fn(&int) -> int) -> bool { true }
fn quux(_: &fn(&int) -> bool) -> () { }
Note that the second one runs fine in rust-0.6 (the latest release), and
only fails with a rust built from `incoming`.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Closes#5090 by using the excellent new generic deriving code
Promotes the unreachable code attribute to a lint attribute (instead of always being a warning)
Fixes some edge cases when creating hashmaps/hashsets and also when consuming them. (fixes#5998)