]> git.lizzy.rs Git - rust.git/commitdiff
Tweak multiple allocators error
authorEsteban Küber <esteban@kuber.com.ar>
Mon, 25 Nov 2019 20:27:50 +0000 (12:27 -0800)
committerEsteban Küber <esteban@kuber.com.ar>
Mon, 25 Nov 2019 21:30:48 +0000 (13:30 -0800)
src/librustc_metadata/creader.rs
src/test/ui/allocator/two-allocators.stderr

index a721e381b4e9971ef560a7e374d4daea9d29d73c..7b54b98cbc13ccf031e6df75871a29ca75ad2c87 100644 (file)
@@ -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()
index ed0aa13eb8078e6bce1bace25afc41b5c8d7d210..35d9f0f42f00164fcbdd7f30fd4bcb5f6425687d 100644 (file)
@@ -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