Repository navigation
Nightly Rust hangs forever with a simple 2-line dotenv_codegen and println! #62167
Copy link
Copy link
Closed
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.
Description
The offending code is just a dotenv macro inside a println! macro:
fn main() {
println!("{}", dotenv!("AWS_ATHENA_DB").to_string());
println!(dotenv!("AWS_ATHENA_DB").to_string());
}Just clone the following repository and run cargo build:
https://github.com/brainstorm/dotenv-codegen-rustc-hang
Stays on Building forever:
$ cargo build --verbose
Fresh unicode-xid v0.1.0
Fresh cc v1.0.37
Fresh rustc-demangle v0.1.15
Fresh lazy_static v1.3.0
Fresh ucd-util v0.1.3
Fresh cfg-if v0.1.9
Fresh utf8-ranges v1.0.3
Fresh proc-macro2 v0.4.30
Fresh thread_local v0.3.6
Fresh regex-syntax v0.6.7
Fresh quote v0.6.12
Fresh libc v0.2.58
Fresh memchr v2.2.0
Fresh syn v0.15.38
Fresh backtrace-sys v0.1.29
Fresh aho-corasick v0.7.3
Fresh synstructure v0.10.2
Fresh backtrace v0.3.32
Fresh regex v1.1.7
Fresh proc-macro-hack v0.5.7
Fresh failure_derive v0.1.5
Fresh failure v0.1.5
Fresh dotenv v0.14.1
Fresh dotenv_codegen_implementation v0.14.1
Fresh dotenv_codegen v0.14.1
Compiling dotenv-codegen-rustc-hang v0.1.0 (/home/limsadmin/.rvalls/dotenv-codegen-rustc-hang)
Running `rustc --edition=2018 --crate-name dotenv_codegen_rustc_hang src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=8547a0ee33801234 -C extra-filename=-8547a0ee33801234 --out-dir /home/limsadmin/.rvalls/dotenv-codegen-rustc-hang/target/debug/deps -C incremental=/home/limsadmin/.rvalls/dotenv-codegen-rustc-hang/target/debug/incremental -L dependency=/home/limsadmin/.rvalls/dotenv-codegen-rustc-hang/target/debug/deps --extern dotenv_codegen=/home/limsadmin/.rvalls/dotenv-codegen-rustc-hang/target/debug/deps/libdotenv_codegen-f886d4c0e76d6020.rlib`
Building [======================================================> ] 39/40: dotenv-codegen-rustc-hang(bin)Meta
rustc 1.37.0-nightly (d3e2cec29 2019-06-26)
binary: rustc
commit-hash: d3e2cec29225a46298ec4ebf082f34ebd7cfeecf
commit-date: 2019-06-26
host: x86_64-unknown-linux-gnu
release: 1.37.0-nightly
LLVM version: 8.0Reacted by pancake
Metadata
Metadata
Assignees
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.
Activity
oli-obk commentedon Jun 27, 2019
unnominating, I'm guessing it's a
dotenvproblem and not a rustc problem. The compilation probably hangs forever because thedotenvproc macro blocks or goes into an infinite loopjonas-schievink commentedon Jun 27, 2019
What's
AWS_ATHENA_DBset to when building?lukaslueg commentedon Jun 27, 2019
librustc_driver hangs while joining on a thread stuck as
brainstorm commentedon Jun 27, 2019
@jonas-schievink The
AWS_ATHENA_DBis just "foo", from.envfile:https://github.com/brainstorm/dotenv-codegen-rustc-hang/blob/master/.env
brainstorm commentedon Jul 3, 2019
@oli-obk After poking around it for a few minutes, it seems like https://github.com/dtolnay/proc-macro-hack, a dotenv dependency, is the culprit instead of dotenv-rs/dotenv#22... but in any case, shouldn't
rustc's macro processor (plugin?) be more resilient and timeout/fail or handle this more gracefully instead of hanging forever?dtolnay commentedon Jul 3, 2019
Closing as a duplicate of #44692. @oli-obk -- I believe this is indeed a rustc bug.