Skip to content

Commit 8e27c4f

Browse files
committed
duplicate_macro_exports -> error
1 parent b54c578 commit 8e27c4f

File tree

8 files changed

+9
-60
lines changed

8 files changed

+9
-60
lines changed

src/librustc/lint/builtin.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -331,16 +331,6 @@ declare_lint! {
331331
"detects labels that are never used"
332332
}
333333

334-
declare_lint! {
335-
pub DUPLICATE_MACRO_EXPORTS,
336-
Deny,
337-
"detects duplicate macro exports",
338-
@future_incompatible = FutureIncompatibleInfo {
339-
reference: "issue #35896 <https://github.com/rust-lang/rust/issues/35896>",
340-
edition: Some(Edition::Edition2018),
341-
};
342-
}
343-
344334
declare_lint! {
345335
pub INTRA_DOC_LINK_RESOLUTION_FAILURE,
346336
Warn,
@@ -533,7 +523,6 @@ declare_lint_pass! {
533523
ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
534524
UNSTABLE_NAME_COLLISIONS,
535525
IRREFUTABLE_LET_PATTERNS,
536-
DUPLICATE_MACRO_EXPORTS,
537526
INTRA_DOC_LINK_RESOLUTION_FAILURE,
538527
MISSING_DOC_CODE_EXAMPLES,
539528
PRIVATE_DOC_TESTS,
@@ -559,7 +548,6 @@ pub enum BuiltinLintDiagnostics {
559548
Normal,
560549
BareTraitObject(Span, /* is_global */ bool),
561550
AbsPathWithModule(Span),
562-
DuplicatedMacroExports(ast::Ident, Span, Span),
563551
ProcMacroDeriveResolutionFallback(Span),
564552
MacroExpandedMacroExportsAccessedByAbsolutePaths(Span),
565553
ElidedLifetimesInPaths(usize, Span, bool, Span, String),
@@ -642,10 +630,6 @@ impl BuiltinLintDiagnostics {
642630
};
643631
db.span_suggestion(span, "use `crate`", sugg, app);
644632
}
645-
BuiltinLintDiagnostics::DuplicatedMacroExports(ident, earlier_span, later_span) => {
646-
db.span_label(later_span, format!("`{}` already exported", ident));
647-
db.span_note(earlier_span, "previous macro export is now shadowed");
648-
}
649633
BuiltinLintDiagnostics::ProcMacroDeriveResolutionFallback(span) => {
650634
db.span_label(span, "names from parent modules are not \
651635
accessible without an explicit import");

src/librustc_lint/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,8 @@ fn register_builtins(store: &mut lint::LintStore, no_interleave_lints: bool) {
342342
"converted into hard error, see https://github.com/rust-lang/rust/issues/36247");
343343
store.register_removed("parenthesized_params_in_types_and_modules",
344344
"converted into hard error, see https://github.com/rust-lang/rust/issues/42238");
345+
store.register_removed("duplicate_macro_exports",
346+
"converted into hard error, see https://github.com/rust-lang/rust/issues/35896");
345347
}
346348

347349
fn register_internals(store: &mut lint::LintStore) {

src/librustc_resolve/resolve_imports.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,14 @@ use errors::{Applicability, pluralize};
1616
use rustc_data_structures::ptr_key::PtrKey;
1717
use rustc::ty;
1818
use rustc::lint::builtin::BuiltinLintDiagnostics;
19-
use rustc::lint::builtin::{
20-
DUPLICATE_MACRO_EXPORTS,
21-
PUB_USE_OF_PRIVATE_EXTERN_CRATE,
22-
UNUSED_IMPORTS,
23-
};
19+
use rustc::lint::builtin::{PUB_USE_OF_PRIVATE_EXTERN_CRATE, UNUSED_IMPORTS};
2420
use rustc::hir::def_id::DefId;
2521
use rustc::hir::def::{self, PartialRes, Export};
2622
use rustc::session::DiagnosticMessageId;
2723
use rustc::util::nodemap::FxHashSet;
2824
use rustc::{bug, span_bug};
2925

30-
use syntax::ast::{Ident, Name, NodeId, CRATE_NODE_ID};
26+
use syntax::ast::{Ident, Name, NodeId};
3127
use syntax::symbol::kw;
3228
use syntax::util::lev_distance::find_best_match_for_name;
3329
use syntax::{struct_span_err, unwrap_or};
@@ -496,13 +492,13 @@ impl<'a> Resolver<'a> {
496492
if let (&NameBindingKind::Res(_, true), &NameBindingKind::Res(_, true)) =
497493
(&old_binding.kind, &binding.kind) {
498494

499-
this.lint_buffer.buffer_lint_with_diagnostic(
500-
DUPLICATE_MACRO_EXPORTS,
501-
CRATE_NODE_ID,
495+
this.session.struct_span_err(
502496
binding.span,
503497
&format!("a macro named `{}` has already been exported", key.ident),
504-
BuiltinLintDiagnostics::DuplicatedMacroExports(
505-
key.ident, old_binding.span, binding.span));
498+
)
499+
.span_label(binding.span, format!("`{}` already exported", key.ident))
500+
.span_note(old_binding.span, "previous macro export is now shadowed")
501+
.emit();
506502

507503
resolution.binding = Some(binding);
508504
} else {

src/test/ui/issues/auxiliary/issue-38715-modern.rs

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

src/test/ui/issues/auxiliary/issue-38715.rs

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

src/test/ui/issues/issue-38715-rpass.rs

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

src/test/ui/issues/issue-38715.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ macro_rules! foo { ($i:ident) => {} }
33

44
#[macro_export]
55
macro_rules! foo { () => {} } //~ ERROR a macro named `foo` has already been exported
6-
//~| WARN this was previously accepted
76

87
fn main() {}

src/test/ui/issues/issue-38715.stderr

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ error: a macro named `foo` has already been exported
44
LL | macro_rules! foo { () => {} }
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `foo` already exported
66
|
7-
= note: `#[deny(duplicate_macro_exports)]` on by default
8-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
9-
= note: for more information, see issue #35896 <https://github.com/rust-lang/rust/issues/35896>
107
note: previous macro export is now shadowed
118
--> $DIR/issue-38715.rs:2:1
129
|

0 commit comments

Comments
 (0)