mirror of
https://github.com/rust-lang/rust.git
synced 2026-07-25 09:01:37 -04:00
Reuse cached layout from PostAnalysis when possible.
This commit is contained in:
@@ -66,6 +66,24 @@ fn layout_of<'tcx>(
|
||||
return tcx.layout_of(typing_env.as_query_input(ty));
|
||||
}
|
||||
|
||||
match typing_env.typing_mode() {
|
||||
ty::TypingMode::Codegen => {
|
||||
let with_postanalysis =
|
||||
ty::TypingEnv::new(typing_env.param_env, ty::TypingMode::PostAnalysis);
|
||||
let res = tcx.layout_of(with_postanalysis.as_query_input(ty));
|
||||
match res {
|
||||
Err(LayoutError::TooGeneric(_)) => {}
|
||||
_ => return res,
|
||||
};
|
||||
}
|
||||
ty::TypingMode::Coherence
|
||||
| ty::TypingMode::Analysis { .. }
|
||||
| ty::TypingMode::Borrowck { .. }
|
||||
| ty::TypingMode::PostBorrowckAnalysis { .. }
|
||||
| ty::TypingMode::ErasedNotCoherence(_)
|
||||
| ty::TypingMode::PostAnalysis => {}
|
||||
}
|
||||
|
||||
let cx = LayoutCx::new(tcx, typing_env);
|
||||
|
||||
let layout = layout_of_uncached(&cx, ty)?;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//~ ERROR overflow evaluating the requirement `&mut Self: DispatchFromDyn<&mut RustaceansAreAwesome>
|
||||
//~ ERROR queries overflow the depth limit!
|
||||
//~| HELP consider increasing the recursion limit
|
||||
//@ build-fail
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
error[E0275]: overflow evaluating the requirement `&mut Self: DispatchFromDyn<&mut RustaceansAreAwesome>`
|
||||
error: queries overflow the depth limit!
|
||||
|
|
||||
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`zero_overflow`)
|
||||
= note: query depth increased by 2 when computing layout of `isize`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0275`.
|
||||
|
||||
Reference in New Issue
Block a user