-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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: "cannot lex source_file
without source" with integration test
#85955
Comments
@XAMPPRocky I've tried reproducing on linux:
where |
@apiraino D'oh, I forgot to include the command. You need to run |
ok I think nailed it to megacommit e1ff91f from PR #83813 searched nightlies: from nightly-2021-05-01 to nightly-2021-06-02 bisected with cargo-bisect-rustc v0.6.0Host triple: x86_64-unknown-linux-gnu $ cat test.sh $ cargo bisect-rustc --start=2021-05-01 --script=./test.sh --regress ice |
Here's a smaller example: Three files are needed as for now: build.rsfn main() {
std::fs::write(
&std::path::Path::new(&std::env::var_os("OUT_DIR").unwrap()).join("crash.rs"),
"pub struct A;",
)
.unwrap();
} src/lib.rsinclude!(concat!(env!("OUT_DIR"), "/", "crash.rs")); tests/crash.rsextern crate abc; // abc must be replaced by the name of the crate to test (e.g. the name in the Cargo.toml file)
include!(concat!(env!("OUT_DIR"), "/", "crash.rs")); afterwards Here's a small script that does it for you: Bash script for settings up the testcase#!/bin/bash
cat << BLOCK > Cargo.toml
[package]
name = "abc"
version = "0.1.0"
edition = "2018"
BLOCK
mkdir -p src tests
cat << BLOCK > build.rs
fn main() {
std::fs::write(
&std::path::Path::new(&std::env::var_os("OUT_DIR").unwrap()).join("crash.rs"),
"pub struct A;",
)
.unwrap();
}
BLOCK
cat << BLOCK > src/lib.rs
include!(concat!(env!("OUT_DIR"), "/", "crash.rs"));
BLOCK
cat << BLOCK > tests/crash.rs
extern crate abc;
include!(concat!(env!("OUT_DIR"), "/", "crash.rs"));
BLOCK
cargo test |
@hellow554 Thank you for reducing it! I've moved that to the top of the issue. |
Issue: rust-lang/rust#85955
Assigning priority as discussed in the Zulip thread of the Prioritization Working Group. @rustbot label -I-prioritize +P-medium |
source_file
without source" when using tonic-build
source_file
without source" with integration test
The underlying problem is that the same source file is first imported from the upstream crate (with I'm not sure yet what the best solution for this is. Updating the |
Hit by this too. |
If you attempt to
include!
a file in both the library and an external integration test that links to the library (this is important because if there is noextern crate
oruse
statements, the ICE does not happen), it causes an ICE in the latest nightly. This ICE is not present in stable or beta.build.rs
src/lib.rs
tests/crash.rs
Command
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: