diff options
| author | bors <bors@rust-lang.org> | 2024-01-22 15:40:27 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-01-22 15:40:27 +0000 |
| commit | 021861aea8de20c76c7411eb8ada7e8235e3d9b5 (patch) | |
| tree | a61eb57277652fd10b5449f0c513dcfdba2cb29f /compiler/rustc_hir_analysis | |
| parent | 30662530506ed29ea29191798cb2ab8aa1249023 (diff) | |
| parent | 44e44f49d6acd8f9cf013f775fad88ea6788816b (diff) | |
| download | rust-021861aea8de20c76c7411eb8ada7e8235e3d9b5.tar.gz rust-021861aea8de20c76c7411eb8ada7e8235e3d9b5.zip | |
Auto merge of #120239 - matthiaskrgr:rollup-vqjn6ot, r=matthiaskrgr
Rollup of 9 pull requests
Successful merges:
- #118578 (core: introduce split_at{,_mut}_checked)
- #119369 (exclude unexported macro bindings from extern crate)
- #119408 (xous: misc fixes + add network support)
- #119943 (std::net: bind update for using backlog as `-1` too.)
- #119948 (Make `unsafe_op_in_unsafe_fn` migrated in edition 2024)
- #119999 (remote-test: use u64 to represent file size)
- #120152 (add help message for `exclusive_range_pattern` error)
- #120213 (Don't actually make bound ty/const for RTN)
- #120225 (Fix -Zremap-path-scope typo)
Failed merges:
- #119972 (Add `ErrCode`)
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_hir_analysis')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/astconv/bounds.rs | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/compiler/rustc_hir_analysis/src/astconv/bounds.rs b/compiler/rustc_hir_analysis/src/astconv/bounds.rs index 401efff9242..3aad510f366 100644 --- a/compiler/rustc_hir_analysis/src/astconv/bounds.rs +++ b/compiler/rustc_hir_analysis/src/astconv/bounds.rs @@ -329,7 +329,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ { } let projection_ty = if let ty::AssocKind::Fn = assoc_kind { - let mut emitted_bad_param_err = false; + let mut emitted_bad_param_err = None; // If we have an method return type bound, then we need to substitute // the method's early bound params with suitable late-bound params. let mut num_bound_vars = candidate.bound_vars().len(); @@ -346,46 +346,30 @@ impl<'tcx> dyn AstConv<'tcx> + '_ { ) .into(), ty::GenericParamDefKind::Type { .. } => { - if !emitted_bad_param_err { + let guar = *emitted_bad_param_err.get_or_insert_with(|| { tcx.dcx().emit_err( crate::errors::ReturnTypeNotationIllegalParam::Type { span: path_span, param_span: tcx.def_span(param.def_id), }, - ); - emitted_bad_param_err = true; - } - Ty::new_bound( - tcx, - ty::INNERMOST, - ty::BoundTy { - var: ty::BoundVar::from_usize(num_bound_vars), - kind: ty::BoundTyKind::Param(param.def_id, param.name), - }, - ) - .into() + ) + }); + Ty::new_error(tcx, guar).into() } ty::GenericParamDefKind::Const { .. } => { - if !emitted_bad_param_err { + let guar = *emitted_bad_param_err.get_or_insert_with(|| { tcx.dcx().emit_err( crate::errors::ReturnTypeNotationIllegalParam::Const { span: path_span, param_span: tcx.def_span(param.def_id), }, - ); - emitted_bad_param_err = true; - } + ) + }); let ty = tcx .type_of(param.def_id) .no_bound_vars() .expect("ct params cannot have early bound vars"); - ty::Const::new_bound( - tcx, - ty::INNERMOST, - ty::BoundVar::from_usize(num_bound_vars), - ty, - ) - .into() + ty::Const::new_error(tcx, guar, ty).into() } }; num_bound_vars += 1; |
