Rollup merge of #125750 - compiler-errors:expect, r=lcnr
Align `Term` methods with `GenericArg` methods, add `Term::expect_*` * `Term::ty` -> `Term::as_type`. * `Term::ct` -> `Term::as_const`. * Adds `Term::expect_type` and `Term::expect_const`, and uses them in favor of `.ty().unwrap()`, etc. I could also shorten these to `as_ty` and then do `GenericArg::as_ty` as well, but I do think the `as_` is important to signal that this is a conversion method, and not a getter, like `Const::ty` is. r? types
This commit is contained in:
commit
b477f89041
23 changed files with 46 additions and 36 deletions
|
@ -726,7 +726,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ReplaceProjectionWith<'_, 'tcx> {
|
|||
)
|
||||
.expect("expected to be able to unify goal projection with dyn's projection"),
|
||||
);
|
||||
proj.term.ty().unwrap()
|
||||
proj.term.expect_type()
|
||||
} else {
|
||||
ty.super_fold_with(self)
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
|
|||
) -> QueryResult<'tcx> {
|
||||
let tcx = self.interner();
|
||||
let opaque_ty = goal.predicate.alias;
|
||||
let expected = goal.predicate.term.ty().expect("no such thing as an opaque const");
|
||||
let expected = goal.predicate.term.as_type().expect("no such thing as an opaque const");
|
||||
|
||||
match (goal.param_env.reveal(), self.solver_mode()) {
|
||||
(Reveal::UserFacing, SolverMode::Normal) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue