Skip to content

Commit 93c0d8d

Browse files
committed
remove unreachable error code E0313
1 parent e5d46a5 commit 93c0d8d

File tree

5 files changed

+3
-46
lines changed

5 files changed

+3
-46
lines changed

compiler/rustc_error_codes/src/error_codes.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,7 @@ E0791: include_str!("./error_codes/E0791.md"),
579579
// E0300, // unexpanded macro
580580
// E0304, // expected signed integer constant
581581
// E0305, // expected constant
582-
E0313, // lifetime of borrowed pointer outlives lifetime of captured
583-
// variable
582+
// E0313, // removed: found unreachable
584583
// E0314, // closure outlives stack frame
585584
// E0315, // cannot invoke closure outside of its lifetime
586585
// E0319, // trait impls for defaulted traits allowed just for structs/enums

compiler/rustc_infer/src/infer/error_reporting/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-filelength
21
//! Error Reporting Code for the inference engine
32
//!
43
//! Because of the way inference, and in particular region inference,

compiler/rustc_infer/src/infer/error_reporting/note.rs

-37
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,6 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
2525
infer::Reborrow(span) => {
2626
RegionOriginNote::Plain { span, msg: fluent::infer_reborrow }.add_to_diagnostic(err)
2727
}
28-
infer::ReborrowUpvar(span, ref upvar_id) => {
29-
let var_name = self.tcx.hir().name(upvar_id.var_path.hir_id);
30-
RegionOriginNote::WithName {
31-
span,
32-
msg: fluent::infer_reborrow,
33-
name: &var_name.to_string(),
34-
continues: false,
35-
}
36-
.add_to_diagnostic(err);
37-
}
3828
infer::RelateObjectBound(span) => {
3929
RegionOriginNote::Plain { span, msg: fluent::infer_relate_object_bound }
4030
.add_to_diagnostic(err);
@@ -162,33 +152,6 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
162152
);
163153
err
164154
}
165-
infer::ReborrowUpvar(span, ref upvar_id) => {
166-
let var_name = self.tcx.hir().name(upvar_id.var_path.hir_id);
167-
let mut err = struct_span_err!(
168-
self.tcx.sess,
169-
span,
170-
E0313,
171-
"lifetime of borrowed pointer outlives lifetime of captured variable `{}`...",
172-
var_name
173-
);
174-
note_and_explain_region(
175-
self.tcx,
176-
&mut err,
177-
"...the borrowed pointer is valid for ",
178-
sub,
179-
"...",
180-
None,
181-
);
182-
note_and_explain_region(
183-
self.tcx,
184-
&mut err,
185-
&format!("...but `{}` is only valid for ", var_name),
186-
sup,
187-
"",
188-
None,
189-
);
190-
err
191-
}
192155
infer::RelateObjectBound(span) => {
193156
let mut err = struct_span_err!(
194157
self.tcx.sess,

compiler/rustc_infer/src/infer/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,6 @@ pub enum SubregionOrigin<'tcx> {
409409
/// Creating a pointer `b` to contents of another reference
410410
Reborrow(Span),
411411

412-
/// Creating a pointer `b` to contents of an upvar
413-
ReborrowUpvar(Span, ty::UpvarId),
414-
415412
/// Data with type `Ty<'tcx>` was borrowed
416413
DataBorrowed(Ty<'tcx>, Span),
417414

@@ -1954,7 +1951,6 @@ impl<'tcx> SubregionOrigin<'tcx> {
19541951
RelateParamBound(a, ..) => a,
19551952
RelateRegionParamBound(a) => a,
19561953
Reborrow(a) => a,
1957-
ReborrowUpvar(a, _) => a,
19581954
DataBorrowed(_, a) => a,
19591955
ReferenceOutlivesReferent(_, a) => a,
19601956
CompareImplItemObligation { span, .. } => span,

src/tools/tidy/src/error_codes.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ const IGNORE_DOCTEST_CHECK: &[&str] = &["E0464", "E0570", "E0601", "E0602"];
3333

3434
// Error codes that don't yet have a UI test. This list will eventually be removed.
3535
const IGNORE_UI_TEST_CHECK: &[&str] = &[
36-
"E0313", "E0461", "E0465", "E0476", "E0490", "E0514", "E0523", "E0554", "E0640", "E0717",
37-
"E0729", "E0789",
36+
"E0461", "E0465", "E0476", "E0490", "E0514", "E0523", "E0554", "E0640", "E0717", "E0729",
37+
"E0789",
3838
];
3939

4040
macro_rules! verbose_print {

0 commit comments

Comments
 (0)