Skip to content

Commit 261f8a3

Browse files
committed
duplicate_macro_exports -> error
1 parent 29b777b commit 261f8a3

File tree

8 files changed

+9
-61
lines changed

8 files changed

+9
-61
lines changed

src/librustc/lint/builtin.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,6 @@ declare_lint! {
255255
"detects labels that are never used"
256256
}
257257

258-
declare_lint! {
259-
pub DUPLICATE_MACRO_EXPORTS,
260-
Deny,
261-
"detects duplicate macro exports"
262-
}
263-
264258
declare_lint! {
265259
pub INTRA_DOC_LINK_RESOLUTION_FAILURE,
266260
Warn,
@@ -402,7 +396,6 @@ declare_lint_pass! {
402396
ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
403397
UNSTABLE_NAME_COLLISIONS,
404398
IRREFUTABLE_LET_PATTERNS,
405-
DUPLICATE_MACRO_EXPORTS,
406399
INTRA_DOC_LINK_RESOLUTION_FAILURE,
407400
MISSING_DOC_CODE_EXAMPLES,
408401
PRIVATE_DOC_TESTS,
@@ -427,7 +420,6 @@ pub enum BuiltinLintDiagnostics {
427420
Normal,
428421
BareTraitObject(Span, /* is_global */ bool),
429422
AbsPathWithModule(Span),
430-
DuplicatedMacroExports(ast::Ident, Span, Span),
431423
ProcMacroDeriveResolutionFallback(Span),
432424
MacroExpandedMacroExportsAccessedByAbsolutePaths(Span),
433425
ElidedLifetimesInPaths(usize, Span, bool, Span, String),
@@ -510,10 +502,6 @@ impl BuiltinLintDiagnostics {
510502
};
511503
db.span_suggestion(span, "use `crate`", sugg, app);
512504
}
513-
BuiltinLintDiagnostics::DuplicatedMacroExports(ident, earlier_span, later_span) => {
514-
db.span_label(later_span, format!("`{}` already exported", ident));
515-
db.span_note(earlier_span, "previous macro export is now shadowed");
516-
}
517505
BuiltinLintDiagnostics::ProcMacroDeriveResolutionFallback(span) => {
518506
db.span_label(span, "names from parent modules are not \
519507
accessible without an explicit import");

src/librustc_lint/lib.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,6 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
311311
reference: "issue #35203 <https://github.com/rust-lang/rust/issues/35203>",
312312
edition: None,
313313
},
314-
FutureIncompatibleInfo {
315-
id: LintId::of(DUPLICATE_MACRO_EXPORTS),
316-
reference: "issue #35896 <https://github.com/rust-lang/rust/issues/35896>",
317-
edition: Some(Edition::Edition2018),
318-
},
319314
FutureIncompatibleInfo {
320315
id: LintId::of(KEYWORD_IDENTS),
321316
reference: "issue #49716 <https://github.com/rust-lang/rust/issues/49716>",
@@ -470,6 +465,8 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
470465
"converted into hard error, see https://github.com/rust-lang/rust/issues/36247");
471466
store.register_removed("parenthesized_params_in_types_and_modules",
472467
"converted into hard error, see https://github.com/rust-lang/rust/issues/42238");
468+
store.register_removed("duplicate_macro_exports",
469+
"converted into hard error, see https://github.com/rust-lang/rust/issues/35896");
473470
}
474471

475472
pub fn register_internals(store: &mut lint::LintStore, sess: Option<&Session>) {

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;
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::{self, Ident, Name, NodeId, CRATE_NODE_ID};
26+
use syntax::ast::{self, Ident, Name, NodeId};
3127
use syntax::ext::hygiene::ExpnId;
3228
use syntax::symbol::kw;
3329
use syntax::util::lev_distance::find_best_match_for_name;
@@ -537,13 +533,13 @@ impl<'a> Resolver<'a> {
537533
if let (&NameBindingKind::Res(_, true), &NameBindingKind::Res(_, true)) =
538534
(&old_binding.kind, &binding.kind) {
539535

540-
this.session.buffer_lint_with_diagnostic(
541-
DUPLICATE_MACRO_EXPORTS,
542-
CRATE_NODE_ID,
536+
this.session.struct_span_err(
543537
binding.span,
544538
&format!("a macro named `{}` has already been exported", ident),
545-
BuiltinLintDiagnostics::DuplicatedMacroExports(
546-
ident, old_binding.span, binding.span));
539+
)
540+
.span_label(binding.span, format!("`{}` already exported", ident))
541+
.span_note(old_binding.span, "previous macro export is now shadowed")
542+
.emit();
547543

548544
resolution.binding = Some(binding);
549545
} 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)