Skip to content

Commit 9a59541

Browse files
committed
Tweak multiple allocators error
1 parent 00fe97a commit 9a59541

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/librustc_metadata/creader.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,9 @@ impl<'a> CrateLoader<'a> {
698698
let has_global_allocator = match &*global_allocator_spans(krate) {
699699
[span1, span2, ..] => {
700700
self.sess.struct_span_err(*span2, "cannot define multiple global allocators")
701-
.span_note(*span1, "the previous global allocator is defined here").emit();
701+
.span_label(*span2, "cannot define a new global allocator")
702+
.span_label(*span1, "previous global allocator is defined here")
703+
.emit();
702704
true
703705
}
704706
spans => !spans.is_empty()
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
error: cannot define multiple global allocators
22
--> $DIR/two-allocators.rs:6:1
33
|
4-
LL | static B: System = System;
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
6-
|
7-
note: the previous global allocator is defined here
8-
--> $DIR/two-allocators.rs:4:1
9-
|
104
LL | static A: System = System;
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
5+
| -------------------------- previous global allocator is defined here
6+
LL | #[global_allocator]
7+
LL | static B: System = System;
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot define a new global allocator
129

1310
error: aborting due to previous error
1411

0 commit comments

Comments
 (0)