Skip to content

Commit 8c30e81

Browse files
committed
[WIP] Tweaks for crater
1 parent 12fb620 commit 8c30e81

10 files changed

Lines changed: 50 additions & 134 deletions

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4745,7 +4745,7 @@ declare_lint! {
47454745
///
47464746
/// [future-incompatible]: ../index.md#future-incompatible-lints
47474747
pub AMBIGUOUS_IMPORT_VISIBILITIES,
4748-
Warn,
4748+
Deny,
47494749
"detects certain glob imports that require reporting an ambiguity error",
47504750
@future_incompatible = FutureIncompatibleInfo {
47514751
reason: fcw!(FutureReleaseError #149145),

compiler/rustc_resolve/src/ident.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -925,16 +925,18 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
925925
None
926926
};
927927

928-
self.ambiguity_errors.push(AmbiguityError {
929-
kind,
930-
ambig_vis,
931-
ident: ident.orig(orig_ident_span),
932-
b1: innermost_decl,
933-
b2: decl,
934-
scope1: innermost_scope,
935-
scope2: scope,
936-
warning,
937-
});
928+
if ambig_vis.is_none() {
929+
self.ambiguity_errors.push(AmbiguityError {
930+
kind,
931+
ambig_vis,
932+
ident: ident.orig(orig_ident_span),
933+
b1: innermost_decl,
934+
b2: decl,
935+
scope1: innermost_scope,
936+
scope2: scope,
937+
warning,
938+
});
939+
}
938940
return true;
939941
}
940942
}

tests/ui/imports/ambiguous-import-visibility-globglob.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//@ check-pass
2-
31
mod m {
42
pub struct S {}
53
}
@@ -10,10 +8,10 @@ mod min_vis_first {
108
pub use crate::m::*;
119

1210
pub use self::S as S1;
13-
//~^ WARN ambiguous import visibility
11+
//~^ ERROR ambiguous import visibility
1412
//~| WARN this was previously accepted
1513
pub(crate) use self::S as S2;
16-
//~^ WARN ambiguous import visibility
14+
//~^ ERROR ambiguous import visibility
1715
//~| WARN this was previously accepted
1816
use self::S as S3; // OK
1917
}
@@ -24,10 +22,10 @@ mod mid_vis_first {
2422
pub use crate::m::*;
2523

2624
pub use self::S as S1;
27-
//~^ WARN ambiguous import visibility
25+
//~^ ERROR ambiguous import visibility
2826
//~| WARN this was previously accepted
2927
pub(crate) use self::S as S2;
30-
//~^ WARN ambiguous import visibility
28+
//~^ ERROR ambiguous import visibility
3129
//~| WARN this was previously accepted
3230
use self::S as S3; // OK
3331
}
@@ -38,10 +36,10 @@ mod max_vis_first {
3836
pub(crate) use crate::m::*;
3937

4038
pub use self::S as S1;
41-
//~^ WARN ambiguous import visibility
39+
//~^ ERROR ambiguous import visibility
4240
//~| WARN this was previously accepted
4341
pub(crate) use self::S as S2;
44-
//~^ WARN ambiguous import visibility
42+
//~^ ERROR ambiguous import visibility
4543
//~| WARN this was previously accepted
4644
use self::S as S3; // OK
4745
}
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,135 +1,135 @@
1-
warning: ambiguous import visibility: pub or pub(in crate::min_vis_first)
2-
--> $DIR/ambiguous-import-visibility-globglob.rs:12:19
1+
error: ambiguous import visibility: pub or pub(in crate::min_vis_first)
2+
--> $DIR/ambiguous-import-visibility-globglob.rs:10:19
33
|
44
LL | pub use self::S as S1;
55
| ^
66
|
77
= note: ambiguous because of multiple glob imports of a name in the same module
88
note: `S` could refer to the struct imported here
9-
--> $DIR/ambiguous-import-visibility-globglob.rs:10:13
9+
--> $DIR/ambiguous-import-visibility-globglob.rs:8:13
1010
|
1111
LL | pub use crate::m::*;
1212
| ^^^^^^^^^^^
1313
= help: consider adding an explicit import of `S` to disambiguate
1414
note: `S` could also refer to the struct imported here
15-
--> $DIR/ambiguous-import-visibility-globglob.rs:8:9
15+
--> $DIR/ambiguous-import-visibility-globglob.rs:6:9
1616
|
1717
LL | use crate::m::*;
1818
| ^^^^^^^^^^^
1919
= help: consider adding an explicit import of `S` to disambiguate
2020
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2121
= note: for more information, see issue #149145 <https://github.com/rust-lang/rust/issues/149145>
22-
= note: `#[warn(ambiguous_import_visibilities)]` (part of `#[warn(future_incompatible)]`) on by default
22+
= note: `#[deny(ambiguous_import_visibilities)]` (part of `#[deny(future_incompatible)]`) on by default
2323

24-
warning: ambiguous import visibility: pub(crate) or pub(in crate::min_vis_first)
25-
--> $DIR/ambiguous-import-visibility-globglob.rs:15:26
24+
error: ambiguous import visibility: pub(crate) or pub(in crate::min_vis_first)
25+
--> $DIR/ambiguous-import-visibility-globglob.rs:13:26
2626
|
2727
LL | pub(crate) use self::S as S2;
2828
| ^
2929
|
3030
= note: ambiguous because of multiple glob imports of a name in the same module
3131
note: `S` could refer to the struct imported here
32-
--> $DIR/ambiguous-import-visibility-globglob.rs:10:13
32+
--> $DIR/ambiguous-import-visibility-globglob.rs:8:13
3333
|
3434
LL | pub use crate::m::*;
3535
| ^^^^^^^^^^^
3636
= help: consider adding an explicit import of `S` to disambiguate
3737
note: `S` could also refer to the struct imported here
38-
--> $DIR/ambiguous-import-visibility-globglob.rs:8:9
38+
--> $DIR/ambiguous-import-visibility-globglob.rs:6:9
3939
|
4040
LL | use crate::m::*;
4141
| ^^^^^^^^^^^
4242
= help: consider adding an explicit import of `S` to disambiguate
4343
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
4444
= note: for more information, see issue #149145 <https://github.com/rust-lang/rust/issues/149145>
4545

46-
warning: ambiguous import visibility: pub or pub(in crate::mid_vis_first)
47-
--> $DIR/ambiguous-import-visibility-globglob.rs:26:19
46+
error: ambiguous import visibility: pub or pub(in crate::mid_vis_first)
47+
--> $DIR/ambiguous-import-visibility-globglob.rs:24:19
4848
|
4949
LL | pub use self::S as S1;
5050
| ^
5151
|
5252
= note: ambiguous because of multiple glob imports of a name in the same module
5353
note: `S` could refer to the struct imported here
54-
--> $DIR/ambiguous-import-visibility-globglob.rs:24:13
54+
--> $DIR/ambiguous-import-visibility-globglob.rs:22:13
5555
|
5656
LL | pub use crate::m::*;
5757
| ^^^^^^^^^^^
5858
= help: consider adding an explicit import of `S` to disambiguate
5959
note: `S` could also refer to the struct imported here
60-
--> $DIR/ambiguous-import-visibility-globglob.rs:23:9
60+
--> $DIR/ambiguous-import-visibility-globglob.rs:21:9
6161
|
6262
LL | use crate::m::*;
6363
| ^^^^^^^^^^^
6464
= help: consider adding an explicit import of `S` to disambiguate
6565
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
6666
= note: for more information, see issue #149145 <https://github.com/rust-lang/rust/issues/149145>
6767

68-
warning: ambiguous import visibility: pub(crate) or pub(in crate::mid_vis_first)
69-
--> $DIR/ambiguous-import-visibility-globglob.rs:29:26
68+
error: ambiguous import visibility: pub(crate) or pub(in crate::mid_vis_first)
69+
--> $DIR/ambiguous-import-visibility-globglob.rs:27:26
7070
|
7171
LL | pub(crate) use self::S as S2;
7272
| ^
7373
|
7474
= note: ambiguous because of multiple glob imports of a name in the same module
7575
note: `S` could refer to the struct imported here
76-
--> $DIR/ambiguous-import-visibility-globglob.rs:24:13
76+
--> $DIR/ambiguous-import-visibility-globglob.rs:22:13
7777
|
7878
LL | pub use crate::m::*;
7979
| ^^^^^^^^^^^
8080
= help: consider adding an explicit import of `S` to disambiguate
8181
note: `S` could also refer to the struct imported here
82-
--> $DIR/ambiguous-import-visibility-globglob.rs:23:9
82+
--> $DIR/ambiguous-import-visibility-globglob.rs:21:9
8383
|
8484
LL | use crate::m::*;
8585
| ^^^^^^^^^^^
8686
= help: consider adding an explicit import of `S` to disambiguate
8787
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8888
= note: for more information, see issue #149145 <https://github.com/rust-lang/rust/issues/149145>
8989

90-
warning: ambiguous import visibility: pub or pub(in crate::max_vis_first)
91-
--> $DIR/ambiguous-import-visibility-globglob.rs:40:19
90+
error: ambiguous import visibility: pub or pub(in crate::max_vis_first)
91+
--> $DIR/ambiguous-import-visibility-globglob.rs:38:19
9292
|
9393
LL | pub use self::S as S1;
9494
| ^
9595
|
9696
= note: ambiguous because of multiple glob imports of a name in the same module
9797
note: `S` could refer to the struct imported here
98-
--> $DIR/ambiguous-import-visibility-globglob.rs:36:13
98+
--> $DIR/ambiguous-import-visibility-globglob.rs:34:13
9999
|
100100
LL | pub use crate::m::*;
101101
| ^^^^^^^^^^^
102102
= help: consider adding an explicit import of `S` to disambiguate
103103
note: `S` could also refer to the struct imported here
104-
--> $DIR/ambiguous-import-visibility-globglob.rs:37:9
104+
--> $DIR/ambiguous-import-visibility-globglob.rs:35:9
105105
|
106106
LL | use crate::m::*;
107107
| ^^^^^^^^^^^
108108
= help: consider adding an explicit import of `S` to disambiguate
109109
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
110110
= note: for more information, see issue #149145 <https://github.com/rust-lang/rust/issues/149145>
111111

112-
warning: ambiguous import visibility: pub(crate) or pub(in crate::max_vis_first)
113-
--> $DIR/ambiguous-import-visibility-globglob.rs:43:26
112+
error: ambiguous import visibility: pub(crate) or pub(in crate::max_vis_first)
113+
--> $DIR/ambiguous-import-visibility-globglob.rs:41:26
114114
|
115115
LL | pub(crate) use self::S as S2;
116116
| ^
117117
|
118118
= note: ambiguous because of multiple glob imports of a name in the same module
119119
note: `S` could refer to the struct imported here
120-
--> $DIR/ambiguous-import-visibility-globglob.rs:36:13
120+
--> $DIR/ambiguous-import-visibility-globglob.rs:34:13
121121
|
122122
LL | pub use crate::m::*;
123123
| ^^^^^^^^^^^
124124
= help: consider adding an explicit import of `S` to disambiguate
125125
note: `S` could also refer to the struct imported here
126-
--> $DIR/ambiguous-import-visibility-globglob.rs:37:9
126+
--> $DIR/ambiguous-import-visibility-globglob.rs:35:9
127127
|
128128
LL | use crate::m::*;
129129
| ^^^^^^^^^^^
130130
= help: consider adding an explicit import of `S` to disambiguate
131131
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
132132
= note: for more information, see issue #149145 <https://github.com/rust-lang/rust/issues/149145>
133133

134-
warning: 6 warnings emitted
134+
error: aborting due to 6 previous errors
135135

tests/ui/imports/ambiguous-import-visibility-macro.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ globbing! {} // this imports the same `RustEmbed` macro with `pub` visibility
1414

1515
pub trait RustEmbed {}
1616

17-
pub use RustEmbed as Embed; //~ WARN ambiguous import visibility
18-
//~| WARN this was previously accepted
17+
pub use RustEmbed as Embed;
18+
1919
fn main() {}

tests/ui/imports/ambiguous-import-visibility-macro.stderr

Lines changed: 0 additions & 29 deletions
This file was deleted.

tests/ui/imports/ambiguous-import-visibility-module.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ mod reexport {
1515
pub use m::*;
1616
mac!();
1717

18-
pub use S as Z; //~ WARN ambiguous import visibility
19-
//~| WARN this was previously accepted
18+
pub use S as Z;
2019
}
2120

2221
fn main() {

tests/ui/imports/ambiguous-import-visibility-module.stderr

Lines changed: 0 additions & 29 deletions
This file was deleted.

tests/ui/imports/ambiguous-import-visibility.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ pub use same_res_ambigious_extern_macro::*;
99

1010
pub trait RustEmbed {}
1111

12-
pub use RustEmbed as Embed; //~ WARN ambiguous import visibility
13-
//~| WARN this was previously accepted
12+
pub use RustEmbed as Embed;
13+
1414
fn main() {}

tests/ui/imports/ambiguous-import-visibility.stderr

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)