Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace all std with alloc except for std::error::Error #59

Merged
merged 6 commits into from
Jul 8, 2019

Conversation

nabijaczleweli
Copy link
Owner

With only one hiccup!

Closes #58

#[macro_export]
macro_rules! try_copy {
($res:expr) => {{
use std::borrow::Cow;
use $crate::alloc::borrow::Cow; // TODO: There *has* to be a better way of doing this, right? (also below)
Copy link
Owner Author

@nabijaczleweli nabijaczleweli Jul 5, 2019

Choose a reason for hiding this comment

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

Is there a better way of doing this? Nothing I'd thought of worked :v

Choose a reason for hiding this comment

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

::alloc::borrow?

Copy link
Collaborator

@Enet4 Enet4 left a comment

Choose a reason for hiding this comment

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

This needs to pass when built with only the alloc feature, so we can start with that.

  1. Remember that Vec needs to be imported manually with alloc.
#[cfg(feature = "alloc")]
use alloc::vec::Vec;
  1. no_std with alloc already provides core, so the extern crate must be conditioned on std rather than alloc
#[cfg(feature = "std")]
extern crate core;
  1. The tests need to define a global allocator under these conditions. This might require a nightly toolchain.

…d no_std{,+alloc} build systems to Sublime project

Coulda sworn this built for me but maybe I fucked up the switches

Ref: #59
@nabijaczleweli
Copy link
Owner Author

Ah, yeah, I must've used the wrong arguments when testing previously.

The doctests say error now, too, and before any of them get compiled, but they still pass, so false negative?

@nabijaczleweli nabijaczleweli requested a review from Enet4 July 8, 2019 13:57
@nabijaczleweli
Copy link
Owner Author

Confirmed false negative

@nabijaczleweli nabijaczleweli merged commit 87b757e into master Jul 8, 2019
@nabijaczleweli nabijaczleweli deleted the 58-alloc branch July 8, 2019 14:27
@nabijaczleweli
Copy link
Owner Author

Released in v0.11.0-rc.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace std uses with alloc
3 participants