rustc_error: make ErrorReported impossible to construct

There are a few places were we have to construct it, though, and a few
places that are more invasive to change. To do this, we create a
constructor with a long obvious name.
This commit is contained in:
mark 2022-01-22 18:49:12 -06:00
parent 461e807801
commit bb8d4307eb
104 changed files with 705 additions and 550 deletions

View file

@ -1997,7 +1997,7 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
Vec::new(),
&[],
);
db.emit()
db.emit();
},
);
}

View file

@ -3143,10 +3143,12 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
for bound in lifetime_i.bounds {
match bound {
hir::GenericBound::Outlives(ref lt) => match lt.name {
hir::LifetimeName::Underscore => self.tcx.sess.delay_span_bug(
lt.span,
"use of `'_` in illegal place, but not caught by lowering",
),
hir::LifetimeName::Underscore => {
self.tcx.sess.delay_span_bug(
lt.span,
"use of `'_` in illegal place, but not caught by lowering",
);
}
hir::LifetimeName::Static => {
self.insert_lifetime(lt, Region::Static);
self.tcx
@ -3172,7 +3174,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
lt.span,
"lowering generated `ImplicitObjectLifetimeDefault` \
outside of an object type",
)
);
}
hir::LifetimeName::Error => {
// No need to do anything, error already reported.