Stream: general

Topic: Nightly features in macros


RalfJ (Nov 05 2019 at 10:22, on Zulip):

Is there any way to use nightly features in macros without making the users add feature flags to their crate? libstd has allow_internal_unstable for that, but is that intended to also work for user crates?
See https://github.com/Gilnaa/memoffset/pull/31

oli (Nov 05 2019 at 10:29, on Zulip):

yea, you should be able to add feature flags to your crate to be able to add allow_internal_unstable to your macro. Users of your macro will then not need the feature gates

oli (Nov 05 2019 at 10:32, on Zulip):

hmm... can't get it to work though: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=53f7565667c2d5d82923915a969f6aa6

oli (Nov 05 2019 at 10:32, on Zulip):

maybe it only works cross crate?

RalfJ (Nov 05 2019 at 12:46, on Zulip):

it fails for doctests in the PR mentioned above

RalfJ (Nov 05 2019 at 12:46, on Zulip):

that's cross-crate

RalfJ (Nov 05 2019 at 12:46, on Zulip):

I think it might only work for libstd?

Amanieu (Nov 05 2019 at 12:59, on Zulip):

I think it's just const support that doesn't work with allow_internal_unstable.

Laurențiu Nicola (Nov 05 2019 at 13:18, on Zulip):

(deleted)

RalfJ (Nov 06 2019 at 15:37, on Zulip):

@Amanieu is there something const needs to do for that? @oli ?

oli (Nov 06 2019 at 15:38, on Zulip):

heh

oli (Nov 06 2019 at 15:38, on Zulip):

I thought you were talking about macros?

RalfJ (Nov 06 2019 at 15:39, on Zulip):

macros generating consts

RalfJ (Nov 06 2019 at 15:39, on Zulip):

See https://github.com/Gilnaa/memoffset/pull/31

oli (Nov 06 2019 at 15:43, on Zulip):

yea, idk why that isn't working

oli (Nov 06 2019 at 15:43, on Zulip):

the spans should still know about the macro expansion

oli (Nov 06 2019 at 15:43, on Zulip):

and thus about the allow_internal_unstable

Last update: Nov 20 2019 at 12:45UTC