rust/compiler
bors 984a6bf9c1 Auto merge of #92175 - Aaron1011:fix-missing-source-file, r=cjgillot
Import `SourceFile`s from crate before decoding foreign `Span`

Fixes #92163
Fixes #92014

When writing to the incremental cache, we encode all `Span`s
we encounter, regardless of whether or not their `SourceFile`
comes from the local crate, or from a foreign crate.

When we decode a `Span`, we use the `StableSourceFileId` we encoded
to locate the matching `SourceFile` in the current session. If this
id corresponds to a `SourceFile` from another crate, then we need to
have already imported that `SourceFile` into our current session.

This usually happens automatically during resolution / macro expansion,
when we try to resolve definitions from other crates. In certain cases,
however, we may try to load a `Span` from a transitive dependency
without having ever imported the `SourceFile`s from that crate, leading
to an ICE.

This PR fixes the issue by enconding the `SourceFile`'s `CrateNum`
when we encode a `Span`. During decoding, we call `imported_source_files()`
when we encounter a foreign `CrateNum`, which ensure that all
`SourceFile`s from that crate are imported into the current session.
2021-12-31 16:38:23 +00:00
..
rustc Remove useless #[global_allocator] from rustc and rustdoc. 2021-12-23 17:23:21 +11:00
rustc_apfloat
rustc_arena
rustc_ast Rollup merge of #91519 - petrochenkov:cratexp2, r=Aaron1011 2021-12-30 13:12:33 +01:00
rustc_ast_lowering Tighten span when suggesting lifetime on path 2021-12-27 23:34:52 -08:00
rustc_ast_passes Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk 2021-12-19 09:31:37 +00:00
rustc_ast_pretty Move equal sign back into head ibox 2021-12-29 12:26:50 -08:00
rustc_attr
rustc_borrowck Refactor variance diagnostics to work with more types 2021-12-29 18:53:40 -05:00
rustc_builtin_macros rustc_builtin_macros: make asm mod public for rustfmt 2021-12-21 11:52:40 -06:00
rustc_codegen_cranelift Merge commit '97e504549371d7640cf011d266e3c17394fdddac' into sync_cg_clif-2021-12-20 2021-12-20 18:56:35 +01:00
rustc_codegen_gcc Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk 2021-12-19 09:31:37 +00:00
rustc_codegen_llvm Auto merge of #91125 - eskarn:llvm-passes-plugin-support, r=nagisa 2021-12-30 02:53:09 +00:00
rustc_codegen_ssa Auto merge of #91125 - eskarn:llvm-passes-plugin-support, r=nagisa 2021-12-30 02:53:09 +00:00
rustc_const_eval Auto merge of #91342 - RalfJung:fn-abi, r=eddyb,oli-obk 2021-12-24 04:59:05 +00:00
rustc_data_structures Auto merge of #92130 - Kobzol:stable-hash-str, r=cjgillot 2021-12-28 01:04:33 +00:00
rustc_driver Upgrade tracing-subscriber 2021-12-22 10:47:36 -06:00
rustc_error_codes docs(error-codes): Add long error explanation for E0227 2021-12-28 15:46:20 +03:00
rustc_errors
rustc_expand Rollup merge of #91519 - petrochenkov:cratexp2, r=Aaron1011 2021-12-30 13:12:33 +01:00
rustc_feature
rustc_fs_util
rustc_graphviz
rustc_hir Remove PartialOrd and Ord from LocalDefId 2021-12-22 10:50:57 -06:00
rustc_hir_pretty Print space after formal generic params in fn type 2021-12-28 12:56:55 -08:00
rustc_incremental Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk 2021-12-19 09:31:37 +00:00
rustc_index Require Ord for rustc_index::SparseBitSet::last_set_in 2021-12-22 10:50:57 -06:00
rustc_infer Refactor variance diagnostics to work with more types 2021-12-29 18:53:40 -05:00
rustc_interface Auto merge of #88354 - Jmc18134:hint-space-pauth-opt, r=nagisa 2021-12-29 22:35:11 +00:00
rustc_lexer
rustc_lint Rollup merge of #91770 - TaKO8Ki:suggest-adding-cfg-test, r=joshtriplett 2021-12-21 08:33:39 +01:00
rustc_lint_defs Rollup merge of #91770 - TaKO8Ki:suggest-adding-cfg-test, r=joshtriplett 2021-12-21 08:33:39 +01:00
rustc_llvm
rustc_macros
rustc_metadata Auto merge of #92175 - Aaron1011:fix-missing-source-file, r=cjgillot 2021-12-31 16:38:23 +00:00
rustc_middle Refactor variance diagnostics to work with more types 2021-12-29 18:53:40 -05:00
rustc_mir_build Store a DefId instead of an AdtDef in AggregateKind::Adt 2021-12-22 14:36:34 -05:00
rustc_mir_dataflow
rustc_mir_transform Auto merge of #91342 - RalfJung:fn-abi, r=eddyb,oli-obk 2021-12-24 04:59:05 +00:00
rustc_monomorphize Rollup merge of #91895 - pitaj:91867-monomorphize, r=Aaron1011 2021-12-19 17:38:34 +01:00
rustc_parse Parse and suggest moving where clauses after equals for type aliases 2021-12-28 14:20:15 -05:00
rustc_parse_format
rustc_passes Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk 2021-12-19 09:31:37 +00:00
rustc_plugin_impl
rustc_privacy Rollup merge of #90586 - jswrenn:relax-privacy-lints, r=petrochenkov 2021-12-27 21:42:25 +01:00
rustc_query_impl Import SourceFiles from crate before decoding foreign Span 2021-12-23 12:56:12 -05:00
rustc_query_system
rustc_resolve Rollup merge of #92237 - compiler-errors:issue-92100, r=cjgillot 2021-12-29 10:17:10 +01:00
rustc_save_analysis Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk 2021-12-19 09:31:37 +00:00
rustc_serialize
rustc_session Auto merge of #92175 - Aaron1011:fix-missing-source-file, r=cjgillot 2021-12-31 16:38:23 +00:00
rustc_span Remove PartialOrd and Ord from LocalDefId 2021-12-22 10:50:57 -06:00
rustc_symbol_mangling Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk 2021-12-19 09:31:37 +00:00
rustc_target Auto merge of #92099 - matthiaskrgr:rollup-4gwv67m, r=matthiaskrgr 2021-12-19 12:36:56 +00:00
rustc_trait_selection Auto merge of #92244 - petrochenkov:alltraits, r=cjgillot 2021-12-29 19:22:33 +00:00
rustc_traits Auto merge of #91929 - anuvratsingh:remove_in_band_lifetimes_compiler_rustc_traits, r=jackh726 2021-12-31 05:08:24 +00:00
rustc_ty_utils Use a const ParamEnv when in default_method_body_is_const 2021-12-17 20:42:48 +08:00
rustc_type_ir
rustc_typeck rustc_metadata: Encode list of all crate's traits into metadata 2021-12-28 19:31:51 +08:00