|
| 1 | +// The generated test harness code contains spans with a dummy location, |
| 2 | +// but a non-dummy SyntaxContext. Previously, the incremental cache was encoding |
| 3 | +// these spans as a full span (with a source file index), instead of skipping |
| 4 | +// the encoding of the location information. If the file gest moved, the hash |
| 5 | +// of the span will be unchanged (since it has a dummy location), so the incr |
| 6 | +// cache would end up try to load a non-existent file using the previously |
| 7 | +// enccoded source file id. |
| 8 | +// This test reproduces the steps that used to trigger this bug, and checks |
| 9 | +// for successful compilation. |
| 10 | +// See https://github.com/rust-lang/rust/issues/83112 |
| 11 | + |
| 12 | +//@ ignore-none |
| 13 | +// Reason: no-std is not supported |
| 14 | +//@ ignore-nvptx64-nvidia-cuda |
| 15 | +// FIXME: can't find crate for 'std' |
| 16 | + |
| 17 | +use run_make_support::{fs_wrapper, rust_lib_name, rustc}; |
| 18 | + |
| 19 | +fn main() { |
| 20 | + fs_wrapper::create_dir("incr"); |
| 21 | + fs_wrapper::create_dir("src"); |
| 22 | + fs_wrapper::create_dir("src/mydir"); |
| 23 | + fs_wrapper::copy("main.rs", "src/main.rs"); |
| 24 | + rustc().input("src/main.rs").incremental("incr").arg("--test").run(); |
| 25 | + fs_wrapper::rename("src/main.rs", "src/mydir/main.rs"); |
| 26 | + rustc().input("src/mydir/main.rs").incremental("incr").arg("--test").run(); |
| 27 | +} |
0 commit comments