Skip to content

Commit

Permalink
Tweak multiple allocators error
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Nov 25, 2019
1 parent 00fe97a commit 9a59541
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/librustc_metadata/creader.rs
Expand Up @@ -698,7 +698,9 @@ impl<'a> CrateLoader<'a> {
let has_global_allocator = match &*global_allocator_spans(krate) {
[span1, span2, ..] => {
self.sess.struct_span_err(*span2, "cannot define multiple global allocators")
.span_note(*span1, "the previous global allocator is defined here").emit();
.span_label(*span2, "cannot define a new global allocator")
.span_label(*span1, "previous global allocator is defined here")
.emit();
true
}
spans => !spans.is_empty()
Expand Down
11 changes: 4 additions & 7 deletions src/test/ui/allocator/two-allocators.stderr
@@ -1,14 +1,11 @@
error: cannot define multiple global allocators
--> $DIR/two-allocators.rs:6:1
|
LL | static B: System = System;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the previous global allocator is defined here
--> $DIR/two-allocators.rs:4:1
|
LL | static A: System = System;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
| -------------------------- previous global allocator is defined here
LL | #[global_allocator]
LL | static B: System = System;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot define a new global allocator

error: aborting due to previous error

0 comments on commit 9a59541

Please sign in to comment.