File tree 4 files changed +56
-1
lines changed
4 files changed +56
-1
lines changed Original file line number Diff line number Diff line change @@ -5147,11 +5147,13 @@ impl<'a> Resolver<'a> {
5147
5147
if let (
5148
5148
Ok ( snippet) ,
5149
5149
NameBindingKind :: Import { directive, ..} ,
5150
- _dummy @ false ,
5150
+ false ,
5151
+ false ,
5151
5152
) = (
5152
5153
cm. span_to_snippet ( binding. span ) ,
5153
5154
binding. kind . clone ( ) ,
5154
5155
binding. span . is_dummy ( ) ,
5156
+ binding. span . ctxt ( ) . outer ( ) . expn_info ( ) . is_some ( ) ,
5155
5157
) {
5156
5158
let suggested_name = if name. as_str ( ) . chars ( ) . next ( ) . unwrap ( ) . is_uppercase ( ) {
5157
5159
format ! ( "Other{}" , name)
Original file line number Diff line number Diff line change
1
+ macro_rules! import {
2
+ ( $( $name: ident) ,* ) => {
3
+ $(
4
+ mod $name;
5
+ pub use self :: $name;
6
+ //~^ ERROR the name `issue_56411` is defined multiple times
7
+ //~| ERROR `issue_56411` is private, and cannot be re-exported
8
+
9
+ ) *
10
+ }
11
+ }
12
+
13
+ import ! ( issue_56411) ;
14
+
15
+ fn main ( ) {
16
+ println ! ( "Hello, world!" ) ;
17
+ }
Original file line number Diff line number Diff line change
1
+ error[E0255]: the name `issue_56411` is defined multiple times
2
+ --> $DIR/issue-56411.rs:5:21
3
+ |
4
+ LL | mod $name;
5
+ | ---------- previous definition of the module `issue_56411` here
6
+ LL | pub use self::$name;
7
+ | ^^^^^^^^^^^
8
+ | |
9
+ | `issue_56411` reimported here
10
+ | you can use `as` to change the binding name of the import
11
+ ...
12
+ LL | import!(issue_56411);
13
+ | --------------------- in this macro invocation
14
+ |
15
+ = note: `issue_56411` must be defined only once in the type namespace of this module
16
+
17
+ error[E0365]: `issue_56411` is private, and cannot be re-exported
18
+ --> $DIR/issue-56411.rs:5:21
19
+ |
20
+ LL | pub use self::$name;
21
+ | ^^^^^^^^^^^ re-export of private `issue_56411`
22
+ ...
23
+ LL | import!(issue_56411);
24
+ | --------------------- in this macro invocation
25
+ |
26
+ = note: consider declaring type or module `issue_56411` with `pub`
27
+
28
+ error: aborting due to 2 previous errors
29
+
30
+ Some errors occurred: E0255, E0365.
31
+ For more information about an error, try `rustc --explain E0255`.
Original file line number Diff line number Diff line change
1
+ // compile-pass
2
+
3
+ struct T { }
4
+
5
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments