Skip to content

Commit 153f01e

Browse files
committed
Remove the infer_static_outlives_requirements feature
1 parent d8f0765 commit 153f01e

File tree

4 files changed

+10
-19
lines changed

4 files changed

+10
-19
lines changed

compiler/rustc_feature/src/active.rs

-2
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,6 @@ declare_features! (
411411
(active, if_let_guard, "1.47.0", Some(51114), None),
412412
/// Allows using imported `main` function
413413
(active, imported_main, "1.53.0", Some(28937), None),
414-
/// Allows inferring `'static` outlives requirements (RFC 2093).
415-
(active, infer_static_outlives_requirements, "1.26.0", Some(54185), None),
416414
/// Allows associated types in inherent impls.
417415
(incomplete, inherent_associated_types, "1.52.0", Some(8995), None),
418416
/// Allow anonymous constants from an inline `const` block

compiler/rustc_feature/src/removed.rs

+3
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ declare_features! (
109109
/// Allows in-band quantification of lifetime bindings (e.g., `fn foo(x: &'a u8) -> &'a u8`).
110110
(removed, in_band_lifetimes, "1.23.0", Some(44524), None,
111111
Some("removed due to unsolved ergonomic questions and added lifetime resolution complexity")),
112+
/// Allows inferring `'static` outlives requirements (RFC 2093).
113+
(removed, infer_static_outlives_requirements, "1.63.0", Some(54185), None,
114+
Some("removed as it caused some confusion and discussion was inactive for years")),
112115
/// Lazily evaluate constants. This allows constants to depend on type parameters.
113116
(removed, lazy_normalization_consts, "1.46.0", Some(72219), None, Some("superseded by `generic_const_exprs`")),
114117
/// Allows using the `#[link_args]` attribute.

compiler/rustc_lint/src/builtin.rs

+2-11
Original file line numberDiff line numberDiff line change
@@ -2113,7 +2113,6 @@ impl ExplicitOutlivesRequirements {
21132113
tcx: TyCtxt<'tcx>,
21142114
bounds: &hir::GenericBounds<'_>,
21152115
inferred_outlives: &[ty::Region<'tcx>],
2116-
infer_static: bool,
21172116
) -> Vec<(usize, Span)> {
21182117
use rustc_middle::middle::resolve_lifetime::Region;
21192118

@@ -2123,9 +2122,6 @@ impl ExplicitOutlivesRequirements {
21232122
.filter_map(|(i, bound)| {
21242123
if let hir::GenericBound::Outlives(lifetime) = bound {
21252124
let is_inferred = match tcx.named_region(lifetime.hir_id) {
2126-
Some(Region::Static) if infer_static => {
2127-
inferred_outlives.iter().any(|r| matches!(**r, ty::ReStatic))
2128-
}
21292125
Some(Region::EarlyBound(index, ..)) => inferred_outlives.iter().any(|r| {
21302126
if let ty::ReEarlyBound(ebr) = **r { ebr.index == index } else { false }
21312127
}),
@@ -2201,7 +2197,6 @@ impl<'tcx> LateLintPass<'tcx> for ExplicitOutlivesRequirements {
22012197
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) {
22022198
use rustc_middle::middle::resolve_lifetime::Region;
22032199

2204-
let infer_static = cx.tcx.features().infer_static_outlives_requirements;
22052200
let def_id = item.def_id;
22062201
if let hir::ItemKind::Struct(_, ref hir_generics)
22072202
| hir::ItemKind::Enum(_, ref hir_generics)
@@ -2262,12 +2257,8 @@ impl<'tcx> LateLintPass<'tcx> for ExplicitOutlivesRequirements {
22622257
continue;
22632258
}
22642259

2265-
let bound_spans = self.collect_outlives_bound_spans(
2266-
cx.tcx,
2267-
bounds,
2268-
&relevant_lifetimes,
2269-
infer_static,
2270-
);
2260+
let bound_spans =
2261+
self.collect_outlives_bound_spans(cx.tcx, bounds, &relevant_lifetimes);
22712262
bound_count += bound_spans.len();
22722263

22732264
let drop_predicate = bound_spans.len() == bounds.len();

compiler/rustc_typeck/src/outlives/utils.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub fn insert_outlives_predicate<'tcx>(
2121
) {
2222
// If the `'a` region is bound within the field type itself, we
2323
// don't want to propagate this constraint to the header.
24-
if !is_free_region(tcx, outlived_region) {
24+
if !is_free_region(outlived_region) {
2525
return;
2626
}
2727

@@ -119,7 +119,7 @@ pub fn insert_outlives_predicate<'tcx>(
119119
}
120120

121121
GenericArgKind::Lifetime(r) => {
122-
if !is_free_region(tcx, r) {
122+
if !is_free_region(r) {
123123
return;
124124
}
125125
required_predicates.entry(ty::OutlivesPredicate(kind, outlived_region)).or_insert(span);
@@ -131,7 +131,7 @@ pub fn insert_outlives_predicate<'tcx>(
131131
}
132132
}
133133

134-
fn is_free_region(tcx: TyCtxt<'_>, region: Region<'_>) -> bool {
134+
fn is_free_region(region: Region<'_>) -> bool {
135135
// First, screen for regions that might appear in a type header.
136136
match *region {
137137
// These correspond to `T: 'a` relationships:
@@ -144,13 +144,12 @@ fn is_free_region(tcx: TyCtxt<'_>, region: Region<'_>) -> bool {
144144
ty::ReEarlyBound(_) => true,
145145

146146
// These correspond to `T: 'static` relationships which can be
147-
// rather surprising. We are therefore putting this behind a
148-
// feature flag:
147+
// rather surprising.
149148
//
150149
// struct Foo<'a, T> {
151150
// field: &'static T, // this would generate a ReStatic
152151
// }
153-
ty::ReStatic => tcx.sess.features_untracked().infer_static_outlives_requirements,
152+
ty::ReStatic => false,
154153

155154
// Late-bound regions can appear in `fn` types:
156155
//

0 commit comments

Comments
 (0)