use crate::require_c_abi_if_c_variadic;
use rustc_ast::TraitObjectSyntax;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
-use rustc_errors::{struct_span_err, Applicability, ErrorReported, FatalError};
+use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, ErrorReported, FatalError};
use rustc_hir as hir;
use rustc_hir::def::{CtorOf, DefKind, Namespace, Res};
use rustc_hir::def_id::{DefId, LocalDefId};
let r = match tcx.named_region(lifetime.hir_id) {
Some(rl::Region::Static) => tcx.lifetimes.re_static,
- Some(rl::Region::LateBound(debruijn, index, def_id, _)) => {
+ Some(rl::Region::LateBound(debruijn, index, def_id)) => {
let name = lifetime_name(def_id.expect_local());
let br = ty::BoundRegion {
var: ty::BoundVar::from_u32(index),
tcx.mk_region(ty::ReLateBound(debruijn, br))
}
- Some(rl::Region::EarlyBound(index, id, _)) => {
+ Some(rl::Region::EarlyBound(index, id)) => {
let name = lifetime_name(id.expect_local());
tcx.mk_region(ty::ReEarlyBound(ty::EarlyBoundRegion { def_id: id, index, name }))
}
(_, Res::SelfTy { trait_: Some(_), alias_to: Some((impl_def_id, _)) }) => {
// `Self` in an impl of a trait -- we have a concrete self type and a
// trait reference.
- let trait_ref = match tcx.impl_trait_ref(impl_def_id) {
- Some(trait_ref) => trait_ref,
- None => {
- // A cycle error occurred, most likely.
- return Err(ErrorReported);
- }
+ let Some(trait_ref) = tcx.impl_trait_ref(impl_def_id) else {
+ // A cycle error occurred, most likely.
+ return Err(ErrorReported);
};
self.one_bound_for_assoc_type(
&self,
constrained_regions: FxHashSet<ty::BoundRegionKind>,
referenced_regions: FxHashSet<ty::BoundRegionKind>,
- generate_err: impl Fn(&str) -> rustc_errors::DiagnosticBuilder<'tcx>,
+ generate_err: impl Fn(&str) -> DiagnosticBuilder<'tcx, ErrorReported>,
) {
for br in referenced_regions.difference(&constrained_regions) {
let br_name = match *br {