@@ -24,38 +24,17 @@ use crate::errors::{
24
24
use crate :: layout_sanity_check:: sanity_check_layout;
25
25
26
26
pub fn provide ( providers : & mut Providers ) {
27
- * providers = Providers { layout_of , ..* providers } ;
27
+ * providers = Providers { layout_of_raw , ..* providers } ;
28
28
}
29
29
30
30
#[ instrument( skip( tcx, query) , level = "debug" ) ]
31
- fn layout_of < ' tcx > (
31
+ fn layout_of_raw < ' tcx > (
32
32
tcx : TyCtxt < ' tcx > ,
33
33
query : ty:: ParamEnvAnd < ' tcx , Ty < ' tcx > > ,
34
34
) -> Result < TyAndLayout < ' tcx > , & ' tcx LayoutError < ' tcx > > {
35
35
let ( param_env, ty) = query. into_parts ( ) ;
36
36
debug ! ( ?ty) ;
37
37
38
- let param_env = param_env. with_reveal_all_normalized ( tcx) ;
39
- let unnormalized_ty = ty;
40
-
41
- // FIXME: We might want to have two different versions of `layout_of`:
42
- // One that can be called after typecheck has completed and can use
43
- // `normalize_erasing_regions` here and another one that can be called
44
- // before typecheck has completed and uses `try_normalize_erasing_regions`.
45
- let ty = match tcx. try_normalize_erasing_regions ( param_env, ty) {
46
- Ok ( t) => t,
47
- Err ( normalization_error) => {
48
- return Err ( tcx
49
- . arena
50
- . alloc ( LayoutError :: NormalizationFailure ( ty, normalization_error) ) ) ;
51
- }
52
- } ;
53
-
54
- if ty != unnormalized_ty {
55
- // Ensure this layout is also cached for the normalized type.
56
- return tcx. layout_of ( param_env. and ( ty) ) ;
57
- }
58
-
59
38
let cx = LayoutCx { tcx, param_env } ;
60
39
61
40
let layout = layout_of_uncached ( & cx, ty) ?;
0 commit comments