-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #101303 - jyn514:jnelson/handle-cycle-enum, r=cjgillot
Make `HandleCycleError` an enum instead of a macro-generated closure Helps with #96524. Based on #100943 to avoid merge conflicts, so it looks larger than it is (only the last commit is relevant). cc https://rust-lang.zulipchat.com/#narrow/stream/241847-t-compiler.2Fwg-incr-comp/topic/Moving.20.60Value.60.20to.20rustc_query_system.20.2396524 r? `@cjgillot`
- Loading branch information
Showing
9 changed files
with
86 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,6 +96,7 @@ pub mod mir; | |
pub mod thir; | ||
pub mod traits; | ||
pub mod ty; | ||
mod values; | ||
|
||
pub mod util { | ||
pub mod bug; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use crate::dep_graph::DepContext; | ||
|
||
pub trait Value<CTX: DepContext>: Sized { | ||
fn from_cycle_error(tcx: CTX) -> Self; | ||
} | ||
|
||
impl<CTX: DepContext, T> Value<CTX> for T { | ||
default fn from_cycle_error(tcx: CTX) -> T { | ||
tcx.sess().abort_if_errors(); | ||
// Ideally we would use `bug!` here. But bug! is only defined in rustc_middle, and it's | ||
// non-trivial to define it earlier. | ||
panic!("Value::from_cycle_error called without errors"); | ||
} | ||
} |