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 @@ -5103,11 +5103,13 @@ impl<'a> Resolver<'a> {
5103
5103
if let (
5104
5104
Ok ( snippet) ,
5105
5105
NameBindingKind :: Import { directive, ..} ,
5106
- _dummy @ false ,
5106
+ false ,
5107
+ false ,
5107
5108
) = (
5108
5109
cm. span_to_snippet ( binding. span ) ,
5109
5110
binding. kind . clone ( ) ,
5110
5111
binding. span . is_dummy ( ) ,
5112
+ binding. span . ctxt ( ) . outer ( ) . expn_info ( ) . is_some ( ) ,
5111
5113
) {
5112
5114
let suggested_name = if name. as_str ( ) . chars ( ) . next ( ) . unwrap ( ) . is_uppercase ( ) {
5113
5115
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