]> git.lizzy.rs Git - rust.git/blob - tests/incremental/issue-92163-missing-sourcefile/issue_92163_main.rs
Merge commit '1480cea393d0cee195e59949eabdfbcf1230f7f9' into clippyup
[rust.git] / tests / incremental / issue-92163-missing-sourcefile / issue_92163_main.rs
1 // aux-build:first_crate.rs
2 // aux-build:second_crate.rs
3 // revisions:rpass1 rpass2
4
5 // Regression test for issue #92163
6 // Under certain circumstances, we may end up trying to
7 // decode a foreign `Span` from the incremental cache, without previously
8 // having imported the `SourceFile`s from the owning crate. This can happen
9 // if the `Span` comes from a transitive dependency (so we never try to resolve
10 // items from the crate during expansion/resolution).
11 //
12 // Previously, this would result in an ICE, since we would not have loaded
13 // the corresponding `SourceFile` for the `StableSourceFileId` we decoded.
14 // This test verifies that the decoding of a foreign `Span` will always
15 // try to import the `SourceFile`s from the foreign crate, instead of
16 // relying on that having already happened during expansion.
17
18 extern crate second_crate;
19
20 pub struct Outer;
21
22 impl Outer {
23     pub fn use_it() {
24         // This returns `first_crate::Foo`, causing
25         // us to encode the `AdtDef `first_crate::Foo` (along with its `Span`s)
26         // into the query cache for the `TypeckResults` for this function.
27         second_crate::make_it();
28     }
29 }
30
31 fn main() {}