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

Add a way to pass custom rustc flags #446

Open
oli-obk opened this issue Dec 11, 2018 · 4 comments
Open

Add a way to pass custom rustc flags #446

oli-obk opened this issue Dec 11, 2018 · 4 comments
Labels
enhancement Something new the playground could do help wanted Not immediately going to be prioritized — ask for mentoring instructions!

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Dec 11, 2018

The playground is often used for experimenting with features and/or creating minimal repros for feature requests and bugs. It would be great if we could make full use of the compiler by also being able to specify arbitrary flags.

My personal motivation is -Zunleash-the-miri-inside-of-you, which takes the brakes off the const evaluator and allows demonstrating why we are doing some things the way we are (because other ways are unsound or incoherent or ...).

@shepmaster shepmaster added enhancement Something new the playground could do help wanted Not immediately going to be prioritized — ask for mentoring instructions! labels Dec 11, 2018
@shepmaster
Copy link
Member

I think that @lqd might have had a prototype for this at some point. I remember that we had some light concerns around any options that could do "bad things" to the running process, but there's so many options and people keep adding them (eyes @oli-obk suspiciously) that it's difficult to know what works.

It would also be nice to have a list of them and a sentence of "documentation". If you have to open the terminal to figure out the exact name, it's a lot less useful. These can be used to populate an autocomplete/helper like thing.

Notably, any rustflags will also need to be added to the URL for sharing purposes.

@RalfJung
Copy link
Member

RalfJung commented Aug 8, 2020

I was imagining that flags could be controlled by a comment in the file, similar to ui tests. Like, if the first line is

// compile-flags: FLAGS

then those will be passed to rustc/miri/...
That would also mean we do not need a separate mechanism for sharing them in the URL, as they are shared with the code.

I think that @lqd might have had a prototype for this at some point. I remember that we had some light concerns around any options that could do "bad things" to the running process, but there's so many options and people keep adding them (eyes @oli-obk suspiciously) that it's difficult to know what works.

Given that playground already runs arbitrary code put in my the user, I cannot imagine anything beyond that that flags could achieve. You have to have it all sandboxed anyway.

@saethlin
Copy link
Member

I'm hacking together a prototype implementation of this. It works pretty well to set MIRIFLAGS by just adding a --env to the Docker invocation.

But when I try to set RUSTFLAGS, a build command attempts to recompile the playground crate which has an incredible number of dependencies (which is the point). Tossing in PLAYGROUND_NO_DEPENDENCIES=true when I set RUSTFLAGS works, but seems pretty heavy-handed.

Does anyone have better ideas? @shepmaster ?

@RalfJung
Copy link
Member

Indeed RUSTFLAGS affects all crates, not just the current one. The semantically more correct option here would be to pass the flags via cargo rustc, I think, but that is probably harder to fit into the existing infrastructure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something new the playground could do help wanted Not immediately going to be prioritized — ask for mentoring instructions!
Projects
None yet
Development

No branches or pull requests

4 participants