Skip to content

Conversation

@SimonSapin
Copy link
Contributor

Don’t mention #[default_lib_allocator] (which is an implementation detail irrelevant to most users) and instead suggest using #[global_allocator], which is often the correct fix.

Don’t mention `#[default_lib_allocator]` (which is an implementation detail
irrelevant to most users) and instead suggest using `#[global_allocator]`,
which is often the correct fix.
@rust-highfive
Copy link
Contributor

r? @estebank

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 19, 2018
@hanna-kruppe
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 19, 2018

📌 Commit d2fe6c4 has been approved by rkruppe

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 19, 2018
@@ -0,0 +1,4 @@
error: no global memory allocator found but one is required; link to std or add #[global_allocator] to a static item that implements the GlobalAlloc trait.

error: aborting due to previous error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick
I'm not really happy with this output. I would prefer something closer to the following, but I'm not sure we can at that stage:

error: no global memory allocator found but one is required
note: link to `std` or add `#[global_allocator]` to a static item that implements the `GlobalAlloc` trait
note: for more information visit <BOOK 2.0 LINK>

error: aborting due to previous error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do I output a note from this code?

As to including an URL, the closest we have at the moment is https://doc.rust-lang.org/nightly/std/alloc/index.html#the-global_allocator-attribute but as you can see it includes /nightly, since this change has not reached stable yet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have too look at this, but honestly I would not block on the perfect output precisely because it's nightly. Let's just remember to revise this before stabilizing.

@bors
Copy link
Collaborator

bors commented Jun 19, 2018

⌛ Testing commit d2fe6c4 with merge ac8d1f7...

bors added a commit that referenced this pull request Jun 19, 2018
Update the error message for a missing global allocator

Don’t mention `#[default_lib_allocator]` (which is an implementation detail irrelevant to most users) and  instead suggest using `#[global_allocator]`, which is often the correct fix.
@bors
Copy link
Collaborator

bors commented Jun 20, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: rkruppe
Pushing ac8d1f7 to master...

@bors bors merged commit d2fe6c4 into rust-lang:master Jun 20, 2018
@SimonSapin SimonSapin deleted the missing-alloc branch June 20, 2018 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants