|
1 | 1 | use log::trace;
|
2 | 2 | use rustc_hir::def_id::LOCAL_CRATE;
|
| 3 | +use rustc_middle::ty::TyCtxt; |
3 | 4 | use rustc_span::Symbol;
|
4 | 5 |
|
5 | 6 | use crate::{
|
6 | 7 | Args, BevyCtxt, DEF_PATHS_BMS_FROM_SCRIPT, DEF_PATHS_BMS_INTO_SCRIPT,
|
7 | 8 | DEF_PATHS_GET_TYPE_REGISTRATION, DEF_PATHS_REFLECT, STD_SOURCE_TRAITS,
|
8 | 9 | };
|
9 | 10 |
|
| 11 | +fn dump_traits(tcx: &TyCtxt) -> String{ |
| 12 | + let mut buffer = String::new(); |
| 13 | + for t in tcx.all_traits() { |
| 14 | + buffer.push_str(&tcx.def_path_str(t)); |
| 15 | + } |
| 16 | + buffer |
| 17 | +} |
| 18 | + |
10 | 19 | /// Finds and caches relevant traits, if they cannot be found throws an ICE
|
11 | 20 | pub(crate) fn cache_traits(ctxt: &mut BevyCtxt<'_>, _args: &Args) -> bool {
|
12 | 21 | let tcx = &ctxt.tcx;
|
@@ -35,15 +44,17 @@ pub(crate) fn cache_traits(ctxt: &mut BevyCtxt<'_>, _args: &Args) -> bool {
|
35 | 44 |
|
36 | 45 | if !ctxt.cached_traits.has_all_bms_traits() {
|
37 | 46 | panic!(
|
38 |
| - "Could not find all bms traits in crate: {}", |
39 |
| - tcx.crate_name(LOCAL_CRATE) |
| 47 | + "Could not find all bms traits in crate: {}. Available traits: {}", |
| 48 | + tcx.crate_name(LOCAL_CRATE), |
| 49 | + dump_traits(tcx) |
40 | 50 | )
|
41 | 51 | }
|
42 | 52 |
|
43 | 53 | if !ctxt.cached_traits.has_all_bevy_traits() {
|
44 | 54 | panic!(
|
45 |
| - "Could not find all reflect traits in crate: {}, did bootstrapping go wrong?", |
46 |
| - tcx.crate_name(LOCAL_CRATE) |
| 55 | + "Could not find all reflect traits in crate: {}, did bootstrapping go wrong?. Available traits: {}", |
| 56 | + tcx.crate_name(LOCAL_CRATE), |
| 57 | + dump_traits(tcx) |
47 | 58 | )
|
48 | 59 | }
|
49 | 60 |
|
|
0 commit comments