Commit 9f80591
committed
resolve: report duplicate module definitions
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>1 parent 3b126e4 commit 9f80591
File tree
2 files changed
+27
-13
lines changed- src
- librustc/middle
- test/compile-fail
2 files changed
+27
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
104 | 112 | | |
105 | 113 | | |
106 | 114 | | |
| |||
759 | 767 | | |
760 | 768 | | |
761 | 769 | | |
762 | | - | |
| 770 | + | |
763 | 771 | | |
764 | | - | |
765 | | - | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
766 | 776 | | |
767 | 777 | | |
768 | 778 | | |
| |||
993 | 1003 | | |
994 | 1004 | | |
995 | 1005 | | |
996 | | - | |
| 1006 | + | |
997 | 1007 | | |
998 | 1008 | | |
999 | | - | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
1000 | 1012 | | |
1001 | 1013 | | |
1002 | 1014 | | |
1003 | 1015 | | |
1004 | 1016 | | |
1005 | | - | |
| 1017 | + | |
1006 | 1018 | | |
1007 | 1019 | | |
1008 | 1020 | | |
1009 | 1021 | | |
1010 | | - | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
1011 | 1025 | | |
1012 | 1026 | | |
1013 | 1027 | | |
| |||
1016 | 1030 | | |
1017 | 1031 | | |
1018 | 1032 | | |
1019 | | - | |
| 1033 | + | |
1020 | 1034 | | |
1021 | 1035 | | |
1022 | 1036 | | |
1023 | | - | |
| 1037 | + | |
1024 | 1038 | | |
1025 | 1039 | | |
1026 | 1040 | | |
1027 | 1041 | | |
1028 | 1042 | | |
1029 | 1043 | | |
1030 | | - | |
| 1044 | + | |
1031 | 1045 | | |
1032 | 1046 | | |
1033 | 1047 | | |
1034 | 1048 | | |
1035 | 1049 | | |
1036 | | - | |
| 1050 | + | |
1037 | 1051 | | |
1038 | 1052 | | |
1039 | 1053 | | |
1040 | 1054 | | |
1041 | 1055 | | |
1042 | 1056 | | |
1043 | | - | |
| 1057 | + | |
1044 | 1058 | | |
1045 | 1059 | | |
1046 | 1060 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
0 commit comments