diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-02-20 09:36:28 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-02-21 10:35:54 +1100 |
| commit | 2903bbbc156fb9707b43038af6723844fd4ccf29 (patch) | |
| tree | 390101b18fd0e9ef81ab70d788653e96b991f8e5 /compiler/rustc_trait_selection/src | |
| parent | 010f3944e0f0baac8d738da49772fd06acd3701b (diff) | |
| download | rust-2903bbbc156fb9707b43038af6723844fd4ccf29.tar.gz rust-2903bbbc156fb9707b43038af6723844fd4ccf29.zip | |
Convert `bug`s back to `delayed_bug`s.
This commit undoes some of the previous commit's mechanical changes, based on human judgment.
Diffstat (limited to 'compiler/rustc_trait_selection/src')
4 files changed, 10 insertions, 10 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs index 79f423756fd..189e1ba54bc 100644 --- a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs +++ b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs @@ -62,11 +62,10 @@ pub fn is_const_evaluatable<'tcx>( match unexpanded_ct.kind() { ty::ConstKind::Expr(_) => { - // njn: ? - // FIXME(generic_const_exprs): we have a `ConstKind::Expr` which is fully concrete, - // but currently it is not possible to evaluate `ConstKind::Expr` so we are unable - // to tell if it is evaluatable or not. For now we just ICE until this is - // implemented. + // FIXME(generic_const_exprs): we have a fully concrete `ConstKind::Expr`, but + // haven't implemented evaluating `ConstKind::Expr` yet, so we are unable to tell + // if it is evaluatable or not. As this is unreachable for now, we can simple ICE + // here. tcx.dcx().span_bug(span, "evaluating `ConstKind::Expr` is not currently supported"); } ty::ConstKind::Unevaluated(uv) => { diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs index 43f709352a2..cac53796747 100644 --- a/compiler/rustc_trait_selection/src/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/mod.rs @@ -172,6 +172,8 @@ fn do_normalize_predicates<'tcx>( // the normalized predicates. let errors = infcx.resolve_regions(&outlives_env); if !errors.is_empty() { + // @lcnr: Let's still ICE here for now. I want a test case + // for that. tcx.dcx().span_bug( span, format!("failed region resolution while normalizing {elaborated_env:?}: {errors:?}"), diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index dc5b62fbd1c..f8de19043e1 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -647,9 +647,7 @@ pub fn compute_inherent_assoc_ty_args<'a, 'b, 'tcx>( Err(_) => { tcx.dcx().span_bug( cause.span, - format!( - "{self_ty:?} was a subtype of {impl_ty:?} during selection but now it is not" - ), + format!("{self_ty:?} was equal to {impl_ty:?} during selection but now it is not"), ); } } @@ -1190,10 +1188,11 @@ fn assemble_candidates_from_impls<'cx, 'tcx>( ImplSource::Builtin(BuiltinImplSource::TraitUpcasting { .. }, _) | ImplSource::Builtin(BuiltinImplSource::TupleUnsizing, _) => { // These traits have no associated types. - selcx.tcx().dcx().span_bug( + selcx.tcx().dcx().span_delayed_bug( obligation.cause.span, format!("Cannot project an associated type from `{impl_source:?}`"), ); + return Err(()) } }; diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs index a8d9b0f42d9..d533e69a4fa 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs @@ -82,7 +82,7 @@ where let value = infcx.commit_if_ok(|_| { let ocx = ObligationCtxt::new(infcx); let value = op(&ocx).map_err(|_| { - infcx.dcx().span_bug(span, format!("error performing operation: {name}")) + infcx.dcx().span_delayed_bug(span, format!("error performing operation: {name}")) })?; let errors = ocx.select_all_or_error(); if errors.is_empty() { |
