Skip to content

Commit 4a0626e

Browse files
authored
Rollup merge of rust-lang#106714 - Ezrashaw:remove-e0490, r=davidtwco
remove unreachable error code `E0490` AFAIK, the untested and undocumented error code `E0490` is now unreachable, it was from the days of the original borrow checker. cc `@GuillaumeGomez` rust-lang#61137
2 parents 8351d2c + 02005e9 commit 4a0626e

File tree

6 files changed

+6
-67
lines changed

6 files changed

+6
-67
lines changed

compiler/rustc_error_codes/src/error_codes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ E0791: include_str!("./error_codes/E0791.md"),
618618
// E0487, // unsafe use of destructor: destructor might be called while...
619619
// E0488, // lifetime of variable does not enclose its declaration
620620
// E0489, // type/lifetime parameter not in scope here
621-
E0490, // a value of type `..` is borrowed for too long
621+
// E0490, // removed: unreachable
622622
E0523, // two dependencies have same (crate-name, disambiguator) but different SVH
623623
// E0526, // shuffle indices are not constant
624624
// E0540, // multiple rustc_deprecated attributes

compiler/rustc_error_messages/locales/en-US/infer.ftl

-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ infer_subtype_2 = ...so that {$requirement ->
101101
infer_reborrow = ...so that reference does not outlive borrowed content
102102
infer_reborrow_upvar = ...so that closure can access `{$name}`
103103
infer_relate_object_bound = ...so that it can be closed over into an object
104-
infer_data_borrowed = ...so that the type `{$name}` is not borrowed for too long
105104
infer_reference_outlives_referent = ...so that the reference type `{$name}` does not outlive the data it points at
106105
infer_relate_param_bound = ...so that the type `{$name}` will meet its required lifetime bounds{$continues ->
107106
[true] ...

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

-35
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,6 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
2929
RegionOriginNote::Plain { span, msg: fluent::infer_relate_object_bound }
3030
.add_to_diagnostic(err);
3131
}
32-
infer::DataBorrowed(ty, span) => {
33-
RegionOriginNote::WithName {
34-
span,
35-
msg: fluent::infer_data_borrowed,
36-
name: &self.ty_to_string(ty),
37-
continues: false,
38-
}
39-
.add_to_diagnostic(err);
40-
}
4132
infer::ReferenceOutlivesReferent(ty, span) => {
4233
RegionOriginNote::WithName {
4334
span,
@@ -227,32 +218,6 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
227218
);
228219
err
229220
}
230-
infer::DataBorrowed(ty, span) => {
231-
let mut err = struct_span_err!(
232-
self.tcx.sess,
233-
span,
234-
E0490,
235-
"a value of type `{}` is borrowed for too long",
236-
self.ty_to_string(ty)
237-
);
238-
note_and_explain_region(
239-
self.tcx,
240-
&mut err,
241-
"the type is valid for ",
242-
sub,
243-
"",
244-
None,
245-
);
246-
note_and_explain_region(
247-
self.tcx,
248-
&mut err,
249-
"but the borrow lasts for ",
250-
sup,
251-
"",
252-
None,
253-
);
254-
err
255-
}
256221
infer::ReferenceOutlivesReferent(ty, span) => {
257222
let mut err = struct_span_err!(
258223
self.tcx.sess,

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

+3-22
Original file line numberDiff line numberDiff line change
@@ -702,26 +702,8 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
702702
// Obtain the spans for all the places that can
703703
// influence the constraints on this value for
704704
// richer diagnostics in `static_impl_trait`.
705-
let influences: Vec<Span> = self
706-
.data
707-
.constraints
708-
.iter()
709-
.filter_map(|(constraint, origin)| match (constraint, origin) {
710-
(
711-
Constraint::VarSubVar(_, sup),
712-
SubregionOrigin::DataBorrowed(_, sp),
713-
) if sup == &node_vid => Some(*sp),
714-
_ => None,
715-
})
716-
.collect();
717-
718-
self.collect_error_for_expanding_node(
719-
graph,
720-
&mut dup_vec,
721-
node_vid,
722-
errors,
723-
influences,
724-
);
705+
706+
self.collect_error_for_expanding_node(graph, &mut dup_vec, node_vid, errors);
725707
}
726708
}
727709
}
@@ -775,7 +757,6 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
775757
dup_vec: &mut IndexVec<RegionVid, Option<RegionVid>>,
776758
node_idx: RegionVid,
777759
errors: &mut Vec<RegionResolutionError<'tcx>>,
778-
influences: Vec<Span>,
779760
) {
780761
// Errors in expanding nodes result from a lower-bound that is
781762
// not contained by an upper-bound.
@@ -830,7 +811,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
830811
lower_bound.region,
831812
upper_bound.origin.clone(),
832813
upper_bound.region,
833-
influences,
814+
vec![],
834815
));
835816
return;
836817
}

compiler/rustc_infer/src/infer/mod.rs

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

413-
/// Data with type `Ty<'tcx>` was borrowed
414-
DataBorrowed(Ty<'tcx>, Span),
415-
416413
/// (&'a &'b T) where a >= b
417414
ReferenceOutlivesReferent(Ty<'tcx>, Span),
418415

@@ -1978,7 +1975,6 @@ impl<'tcx> SubregionOrigin<'tcx> {
19781975
RelateParamBound(a, ..) => a,
19791976
RelateRegionParamBound(a) => a,
19801977
Reborrow(a) => a,
1981-
DataBorrowed(_, a) => a,
19821978
ReferenceOutlivesReferent(_, a) => a,
19831979
CompareImplItemObligation { span, .. } => span,
19841980
AscribeUserTypeProvePredicate(span) => span,

src/tools/tidy/src/error_codes.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@ const IGNORE_DOCTEST_CHECK: &[&str] =
3131
&["E0208", "E0464", "E0570", "E0601", "E0602", "E0640", "E0717"];
3232

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

3937
macro_rules! verbose_print {
4038
($verbose:expr, $($fmt:tt)*) => {

0 commit comments

Comments
 (0)