-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make tykind::error bear a proof and delay span bug
- Loading branch information
Showing
67 changed files
with
323 additions
and
251 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
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
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 |
---|---|---|
@@ -1,32 +1,33 @@ | ||
use crate::ty::{self, AdtSizedConstraint, Ty, TyCtxt}; | ||
|
||
use rustc_errors::ErrorProof; | ||
use rustc_span::symbol::Symbol; | ||
|
||
pub(super) trait Value<'tcx>: Sized { | ||
fn from_cycle_error(tcx: TyCtxt<'tcx>) -> Self; | ||
fn from_cycle_error(tcx: TyCtxt<'tcx>, proof: ErrorProof) -> Self; | ||
} | ||
|
||
impl<'tcx, T> Value<'tcx> for T { | ||
default fn from_cycle_error(tcx: TyCtxt<'tcx>) -> T { | ||
default fn from_cycle_error(tcx: TyCtxt<'tcx>, _: ErrorProof) -> T { | ||
tcx.sess.abort_if_errors(); | ||
bug!("Value::from_cycle_error called without errors"); | ||
} | ||
} | ||
|
||
impl<'tcx> Value<'tcx> for Ty<'tcx> { | ||
fn from_cycle_error(tcx: TyCtxt<'tcx>) -> Ty<'tcx> { | ||
tcx.types.err | ||
fn from_cycle_error(tcx: TyCtxt<'tcx>, proof: ErrorProof) -> Ty<'tcx> { | ||
tcx.err(proof) | ||
} | ||
} | ||
|
||
impl<'tcx> Value<'tcx> for ty::SymbolName { | ||
fn from_cycle_error(_: TyCtxt<'tcx>) -> Self { | ||
fn from_cycle_error(_: TyCtxt<'tcx>, _: ErrorProof) -> Self { | ||
ty::SymbolName { name: Symbol::intern("<error>") } | ||
} | ||
} | ||
|
||
impl<'tcx> Value<'tcx> for AdtSizedConstraint<'tcx> { | ||
fn from_cycle_error(tcx: TyCtxt<'tcx>) -> Self { | ||
AdtSizedConstraint(tcx.intern_type_list(&[tcx.types.err])) | ||
fn from_cycle_error(tcx: TyCtxt<'tcx>, proof: ErrorProof) -> Self { | ||
AdtSizedConstraint(tcx.intern_type_list(&[tcx.err(proof)])) | ||
} | ||
} |
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
Oops, something went wrong.