Stream: t-compiler/help

Topic: space-separated lists


tmandry (Mar 14 2019 at 19:47, on Zulip):

I'm looking at adding a -Z allow-features=x,y,z command-line flag to the compiler, and it looks like all the list options like this are space-separated

tmandry (Mar 14 2019 at 19:48, on Zulip):

unfortunately, I can't figure out a way to put a space inside a command line option in my test compile-flags

tmandry (Mar 14 2019 at 19:49, on Zulip):

so my question is..
1. is space-separated the right format for an option like this?
2. how the heck do I test this?

tmandry (Mar 14 2019 at 19:50, on Zulip):

note that if I specify the option more than once, it overwrites the list rather than appending

tmandry (Mar 14 2019 at 19:50, on Zulip):

here's my PR: #59169

simulacrum (Mar 14 2019 at 20:25, on Zulip):

@tmandry I think @Pietro Albini added a flag that lets you specify arbitrary crate-level attributes

simulacrum (Mar 14 2019 at 20:25, on Zulip):

so it might be worth just using that instead? I forget the name though

simulacrum (Mar 14 2019 at 20:26, on Zulip):

crate-attrs perhaps?

Pietro Albini (Mar 14 2019 at 20:26, on Zulip):

I think -Zcrate-attr

simulacrum (Mar 14 2019 at 20:27, on Zulip):

Oh, I misinterpreted what the flag does

simulacrum (Mar 14 2019 at 20:28, on Zulip):

I would maybe think about reworking the flag to be a crate attribute since that's easier to test etc and then just rely on -Z crate-attrs to actually specify it from build systems and the like

tmandry (Mar 14 2019 at 20:58, on Zulip):

hmm, adding it as a crate attribute seems more potentially controversial

tmandry (Mar 14 2019 at 20:58, on Zulip):

would that require an RFC?

tmandry (Mar 14 2019 at 21:12, on Zulip):

@simulacrum ^

simulacrum (Mar 14 2019 at 21:12, on Zulip):

I think as long as it's unstable I wouldn't expect it to be

simulacrum (Mar 14 2019 at 21:13, on Zulip):

So one other thing that I might suggest is to perhaps use something like syn to parse your crates and implement this as a tidy-style rule?

simulacrum (Mar 14 2019 at 21:16, on Zulip):

@tmandry But in terms of -Z argument I'd personally feel better about comma-sep (features can't have commas in them so should be fairly easy to implement)

tmandry (Mar 14 2019 at 21:21, on Zulip):

comma-separated should be easy to test and is what I would have expected personally

tmandry (Mar 14 2019 at 21:22, on Zulip):

I just didn't go that route because I couldn't find any other comma-separated options :)

simulacrum (Mar 14 2019 at 21:23, on Zulip):

Heh

simulacrum (Mar 14 2019 at 21:23, on Zulip):

@tmandry I think that might be partially because we just don't have many options

simulacrum (Mar 14 2019 at 21:24, on Zulip):

OTOH, you could also do "only one feature per option" and then just all the options are joined together (additive)

centril (Mar 14 2019 at 21:34, on Zulip):

Features are never stable so I would expect the -Z flag to also never be stable

centril (Mar 14 2019 at 21:34, on Zulip):

(features == the gating mechanism itself and the names we assign in #![feature(<name>)])

tmandry (Mar 14 2019 at 21:50, on Zulip):

okay, I think I'll make it comma-separated then

tmandry (Mar 14 2019 at 21:50, on Zulip):

related issue: how do I run the error-index.md doctests

tmandry (Mar 14 2019 at 21:51, on Zulip):

I can never remember

Last update: Nov 11 2019 at 22:35UTC