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

ICE having include! in code from stdin when calling rustc #63900

Closed
andjo403 opened this issue Aug 25, 2019 · 2 comments · Fixed by #65603
Closed

ICE having include! in code from stdin when calling rustc #63900

andjo403 opened this issue Aug 25, 2019 · 2 comments · Fixed by #65603
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ I-needs-decision Issue: In need of a decision. T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@andjo403
Copy link
Contributor

to reproduce the fault this can be used:
echo 'include!("auxiliary/empty.rs"); pub fn main(){}' | rustc -

will result in this ICE:

thread 'rustc' panicked at 'cannot resolve relative path in non-file source ', src/libsyntax/ext/source_util.rs:189:22 note: Run with RUST_BACKTRACE=1 environment variable to display a backtrace. error: internal compiler error: unexpected panic note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports note: rustc 1.36.0 (a53f9df 2019-07-03) running on x86_64-unknown-linux-gnu

the question is what is the path that shall be used when the code is from stdin maybe some temp file name in the currrent working dir.

@jonas-schievink jonas-schievink added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 25, 2019
@Mark-Simulacrum Mark-Simulacrum self-assigned this Aug 25, 2019
@Mark-Simulacrum Mark-Simulacrum removed their assignment Sep 2, 2019
@Mark-Simulacrum Mark-Simulacrum added I-needs-decision Issue: In need of a decision. T-lang Relevant to the language team, which will review and decide on the PR/issue. and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 2, 2019
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Oct 15, 2019
@mystor
Copy link
Contributor

mystor commented Oct 19, 2019

This ICE also occurs when using include_bytes! and include_str!, which makes sense as they use the same mechanism under the hood (include, include_str, include_bytes). The mechanism is also used by #[doc(include="x")], meaning it also ICEs.

$ echo 'include_str!("x");' | rustc -
thread 'rustc' panicked at 'cannot resolve relative path in non-file source `<anon>`'
$ echo 'include_bytes!("x");' | rustc -
thread 'rustc' panicked at 'cannot resolve relative path in non-file source `<anon>`'
$ echo '#![feature(external_doc)] #![doc(include="x")]' | rustc -
thread 'rustc' panicked at 'cannot resolve relative path in non-file source `<anon>`'

@mystor
Copy link
Contributor

mystor commented Oct 19, 2019

While poking at this I also noticed that mod foo; items are silently ignored, and filed #65601.

Centril added a commit to Centril/rust that referenced this issue Oct 20, 2019
…nkov

Avoid ICE when include! is used by stdin crate

This should hopefully also eliminate the ICE when using `include_bytes!`, `include_str!` and `#[doc(include = "...")]` with a stdio input.

I couldn't see a clear way to write a compile-fail test using compiletest with a stdio input, so I haven't written any tests for this change.

Fixes rust-lang#63900
@bors bors closed this as completed in 9be0bd8 Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ I-needs-decision Issue: In need of a decision. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants