提交 9a595417 编写于 作者: E Esteban Küber

Tweak multiple allocators error

上级 00fe97ad
......@@ -698,7 +698,9 @@ fn inject_allocator_crate(&mut self, krate: &ast::Crate) {
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()
......
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册