rust-lang / rust-lang/rust-playground

Set `incremental = true` for builds that don't output LLVM IR

Open
#710 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.4k
Forks
268
Avg merge
3h 2m
Merged PRs (30d)
6

Description

@kangalioo, @danielhenrymantilla and I have been trying to figure out how to use the playground to run procedural macros, for a Discord bot. The code so far looks like this:

fn main(){let _=std::process::Command::new("/bin/bash").args(&["-c", r##"
set -euo pipefail
cat >>Cargo.toml <<EOF
    [lib]
    proc-macro = true
EOF
cat >src/lib.rs <<EOF
    use proc_macro::TokenStream;

    #[proc_macro]
    pub fn foo(input: TokenStream) -> TokenStream {
        quote::ToTokens::into_token_stream(syn::parse_macro_input!(input as syn::Item)).into()
    }
EOF
cat >src/main.rs <<EOF
    ::playground::foo!(fn main() {});
EOF

cargo run --offline
"##]).status();}

However, this doesn't work because all the dependencies used in the playground get rebuilt and the process gets timed out. This happens because incremental = false is enabled for all builds, a change made in #259 to fix the output of the "Show LLVM IR" command. If incremental = false was disabled for all builds except those "Show LLVM IR" ones, this code would work.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the build configuration that sets incremental compilation and the code path for the “Show LLVM IR” command. Compare those build modes, then verify that ordinary builds use incremental compilation without changing the LLVM IR output; test the procedural-macro scenario described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.