about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-03-06 20:50:51 +0000
committerMichael Goulet <michael@errs.io>2025-03-23 14:11:04 +0000
commiteb3707e4b49e7d19d048cf2187d6e3643be9dba2 (patch)
treec7805bcb8ecb88c43c90e48eac1eaa6acd795850
parent97fc1f62d8c3f9b725b827540389a8874501c96e (diff)
downloadrust-eb3707e4b49e7d19d048cf2187d6e3643be9dba2.tar.gz
rust-eb3707e4b49e7d19d048cf2187d6e3643be9dba2.zip
Stabilize precise_capturing_in_traits
-rw-r--r--compiler/rustc_ast_lowering/messages.ftl3
-rw-r--r--compiler/rustc_ast_lowering/src/errors.rs8
-rw-r--r--compiler/rustc_ast_lowering/src/lib.rs22
-rw-r--r--compiler/rustc_feature/src/accepted.rs2
-rw-r--r--compiler/rustc_feature/src/unstable.rs2
-rw-r--r--tests/ui/feature-gates/feature-gate-precise_capturing_in_traits.rs6
-rw-r--r--tests/ui/feature-gates/feature-gate-precise_capturing_in_traits.stderr13
-rw-r--r--tests/ui/impl-trait/in-trait/dump.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/refine-captures.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/refine-captures.stderr8
-rw-r--r--tests/ui/impl-trait/in-trait/variance.rs2
-rw-r--r--tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.rs2
-rw-r--r--tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.stderr4
-rw-r--r--tests/ui/impl-trait/precise-capturing/redundant.rs1
-rw-r--r--tests/ui/impl-trait/precise-capturing/redundant.stderr10
-rw-r--r--tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.rs2
-rw-r--r--tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.stderr4
-rw-r--r--tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.rs2
-rw-r--r--tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.stderr4
-rw-r--r--tests/ui/impl-trait/precise-capturing/rpitit-outlives-2.rs2
-rw-r--r--tests/ui/impl-trait/precise-capturing/rpitit-outlives.rs2
-rw-r--r--tests/ui/impl-trait/precise-capturing/rpitit.rs2
-rw-r--r--tests/ui/impl-trait/precise-capturing/rpitit.stderr6
-rw-r--r--tests/ui/impl-trait/precise-capturing/self-capture.rs2
24 files changed, 22 insertions, 91 deletions
diff --git a/compiler/rustc_ast_lowering/messages.ftl b/compiler/rustc_ast_lowering/messages.ftl
index 65e5b530bbe..5ef76fb64aa 100644
--- a/compiler/rustc_ast_lowering/messages.ftl
+++ b/compiler/rustc_ast_lowering/messages.ftl
@@ -141,9 +141,6 @@ ast_lowering_never_pattern_with_guard =
 
 ast_lowering_no_precise_captures_on_apit = `use<...>` precise capturing syntax not allowed in argument-position `impl Trait`
 
-ast_lowering_no_precise_captures_on_rpitit = `use<...>` precise capturing syntax is currently not allowed in return-position `impl Trait` in traits
-    .note = currently, return-position `impl Trait` in traits and trait implementations capture all lifetimes in scope
-
 ast_lowering_previously_used_here = previously used here
 
 ast_lowering_register1 = register `{$reg1_name}`
diff --git a/compiler/rustc_ast_lowering/src/errors.rs b/compiler/rustc_ast_lowering/src/errors.rs
index ceeb5dffbea..576fa9731e9 100644
--- a/compiler/rustc_ast_lowering/src/errors.rs
+++ b/compiler/rustc_ast_lowering/src/errors.rs
@@ -445,14 +445,6 @@ pub(crate) struct NoPreciseCapturesOnApit {
 }
 
 #[derive(Diagnostic)]
-#[diag(ast_lowering_no_precise_captures_on_rpitit)]
-#[note]
-pub(crate) struct NoPreciseCapturesOnRpitit {
-    #[primary_span]
-    pub span: Span,
-}
-
-#[derive(Diagnostic)]
 #[diag(ast_lowering_yield_in_closure)]
 pub(crate) struct YieldInClosure {
     #[primary_span]
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs
index e08850da4a7..78770659736 100644
--- a/compiler/rustc_ast_lowering/src/lib.rs
+++ b/compiler/rustc_ast_lowering/src/lib.rs
@@ -1438,28 +1438,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
         // frequently opened issues show.
         let opaque_ty_span = self.mark_span_with_reason(DesugaringKind::OpaqueTy, span, None);
 
-        // Feature gate for RPITIT + use<..>
-        match origin {
-            rustc_hir::OpaqueTyOrigin::FnReturn { in_trait_or_impl: Some(_), .. } => {
-                if !self.tcx.features().precise_capturing_in_traits()
-                    && let Some(span) = bounds.iter().find_map(|bound| match *bound {
-                        ast::GenericBound::Use(_, span) => Some(span),
-                        _ => None,
-                    })
-                {
-                    let mut diag =
-                        self.tcx.dcx().create_err(errors::NoPreciseCapturesOnRpitit { span });
-                    add_feature_diagnostics(
-                        &mut diag,
-                        self.tcx.sess,
-                        sym::precise_capturing_in_traits,
-                    );
-                    diag.emit();
-                }
-            }
-            _ => {}
-        }
-
         self.lower_opaque_inner(opaque_ty_node_id, origin, opaque_ty_span, |this| {
             this.lower_param_bounds(bounds, itctx)
         })
diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs
index 980f3946035..88e6593572b 100644
--- a/compiler/rustc_feature/src/accepted.rs
+++ b/compiler/rustc_feature/src/accepted.rs
@@ -331,6 +331,8 @@ declare_features! (
     (accepted, pattern_parentheses, "1.31.0", Some(51087)),
     /// Allows `use<'a, 'b, A, B>` in `impl Trait + use<...>` for precise capture of generic args.
     (accepted, precise_capturing, "1.82.0", Some(123432)),
+    /// Allows `use<..>` precise capturign on impl Trait in traits.
+    (accepted, precise_capturing_in_traits, "CURRENT_RUSTC_VERSION", Some(130044)),
     /// Allows procedural macros in `proc-macro` crates.
     (accepted, proc_macro, "1.29.0", Some(38356)),
     /// Allows multi-segment paths in attributes and derives.
diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs
index 4707daea089..72468dd4714 100644
--- a/compiler/rustc_feature/src/unstable.rs
+++ b/compiler/rustc_feature/src/unstable.rs
@@ -600,8 +600,6 @@ declare_features! (
     (incomplete, pin_ergonomics, "1.83.0", Some(130494)),
     /// Allows postfix match `expr.match { ... }`
     (unstable, postfix_match, "1.79.0", Some(121618)),
-    /// Allows `use<..>` precise capturign on impl Trait in traits.
-    (unstable, precise_capturing_in_traits, "1.83.0", Some(130044)),
     /// Allows macro attributes on expressions, statements and non-inline modules.
     (unstable, proc_macro_hygiene, "1.30.0", Some(54727)),
     /// Allows the use of raw-dylibs on ELF platforms
diff --git a/tests/ui/feature-gates/feature-gate-precise_capturing_in_traits.rs b/tests/ui/feature-gates/feature-gate-precise_capturing_in_traits.rs
deleted file mode 100644
index 308b41dfc68..00000000000
--- a/tests/ui/feature-gates/feature-gate-precise_capturing_in_traits.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-trait Foo {
-    fn test() -> impl Sized + use<Self>;
-    //~^ ERROR `use<...>` precise capturing syntax is currently not allowed in return-position
-}
-
-fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-precise_capturing_in_traits.stderr b/tests/ui/feature-gates/feature-gate-precise_capturing_in_traits.stderr
deleted file mode 100644
index b2c6bf61124..00000000000
--- a/tests/ui/feature-gates/feature-gate-precise_capturing_in_traits.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error: `use<...>` precise capturing syntax is currently not allowed in return-position `impl Trait` in traits
-  --> $DIR/feature-gate-precise_capturing_in_traits.rs:2:31
-   |
-LL |     fn test() -> impl Sized + use<Self>;
-   |                               ^^^^^^^^^
-   |
-   = note: currently, return-position `impl Trait` in traits and trait implementations capture all lifetimes in scope
-   = note: see issue #130044 <https://github.com/rust-lang/rust/issues/130044> for more information
-   = help: add `#![feature(precise_capturing_in_traits)]` to the crate attributes to enable
-   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/impl-trait/in-trait/dump.rs b/tests/ui/impl-trait/in-trait/dump.rs
index 47198d51150..20b0e60702f 100644
--- a/tests/ui/impl-trait/in-trait/dump.rs
+++ b/tests/ui/impl-trait/in-trait/dump.rs
@@ -1,6 +1,6 @@
 //@ compile-flags: -Zverbose-internals
 
-#![feature(precise_capturing_in_traits, rustc_attrs)]
+#![feature(rustc_attrs)]
 #![rustc_hidden_type_of_opaques]
 
 trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/refine-captures.rs b/tests/ui/impl-trait/in-trait/refine-captures.rs
index e7dffcb52aa..199cc464c4e 100644
--- a/tests/ui/impl-trait/in-trait/refine-captures.rs
+++ b/tests/ui/impl-trait/in-trait/refine-captures.rs
@@ -1,5 +1,3 @@
-#![feature(precise_capturing_in_traits)]
-
 trait LifetimeParam<'a> {
     fn test() -> impl Sized;
 }
diff --git a/tests/ui/impl-trait/in-trait/refine-captures.stderr b/tests/ui/impl-trait/in-trait/refine-captures.stderr
index 166991894d1..6f213f16144 100644
--- a/tests/ui/impl-trait/in-trait/refine-captures.stderr
+++ b/tests/ui/impl-trait/in-trait/refine-captures.stderr
@@ -1,5 +1,5 @@
 warning: impl trait in impl method captures fewer lifetimes than in trait
-  --> $DIR/refine-captures.rs:8:31
+  --> $DIR/refine-captures.rs:6:31
    |
 LL |     fn test() -> impl Sized + use<> {}
    |                               ^^^^^
@@ -13,7 +13,7 @@ LL |     fn test() -> impl Sized + use<'a> {}
    |                                   ++
 
 warning: impl trait in impl method captures fewer lifetimes than in trait
-  --> $DIR/refine-captures.rs:22:31
+  --> $DIR/refine-captures.rs:20:31
    |
 LL |     fn test() -> impl Sized + use<> {}
    |                               ^^^^^
@@ -26,7 +26,7 @@ LL |     fn test() -> impl Sized + use<'a> {}
    |                                   ++
 
 warning: impl trait in impl method captures fewer lifetimes than in trait
-  --> $DIR/refine-captures.rs:27:31
+  --> $DIR/refine-captures.rs:25:31
    |
 LL |     fn test() -> impl Sized + use<'b> {}
    |                               ^^^^^^^
@@ -39,7 +39,7 @@ LL |     fn test() -> impl Sized + use<'a, 'b> {}
    |                                    ++++
 
 error: `impl Trait` must mention all type parameters in scope in `use<...>`
-  --> $DIR/refine-captures.rs:32:18
+  --> $DIR/refine-captures.rs:30:18
    |
 LL | impl<T> TypeParam<T> for u64 {
    |      - type parameter is implicitly captured by this `impl Trait`
diff --git a/tests/ui/impl-trait/in-trait/variance.rs b/tests/ui/impl-trait/in-trait/variance.rs
index cd2f43fca9a..c0f569c690a 100644
--- a/tests/ui/impl-trait/in-trait/variance.rs
+++ b/tests/ui/impl-trait/in-trait/variance.rs
@@ -1,4 +1,4 @@
-#![feature(rustc_attrs, precise_capturing_in_traits)]
+#![feature(rustc_attrs)]
 #![allow(internal_features)]
 #![rustc_variance_of_opaques]
 
diff --git a/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.rs b/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.rs
index 6c2477c9744..1b52b170201 100644
--- a/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.rs
+++ b/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.rs
@@ -1,5 +1,3 @@
-#![feature(precise_capturing_in_traits)]
-
 fn type_param<T>() -> impl Sized + use<> {}
 //~^ ERROR `impl Trait` must mention all type parameters in scope
 
diff --git a/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.stderr b/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.stderr
index 93b44a0c18c..93c35203f1d 100644
--- a/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.stderr
+++ b/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.stderr
@@ -1,5 +1,5 @@
 error: `impl Trait` must mention all type parameters in scope in `use<...>`
-  --> $DIR/forgot-to-capture-type.rs:3:23
+  --> $DIR/forgot-to-capture-type.rs:1:23
    |
 LL | fn type_param<T>() -> impl Sized + use<> {}
    |               -       ^^^^^^^^^^^^^^^^^^
@@ -9,7 +9,7 @@ LL | fn type_param<T>() -> impl Sized + use<> {}
    = note: currently, all type parameters are required to be mentioned in the precise captures list
 
 error: `impl Trait` must mention the `Self` type of the trait in `use<...>`
-  --> $DIR/forgot-to-capture-type.rs:7:17
+  --> $DIR/forgot-to-capture-type.rs:5:17
    |
 LL | trait Foo {
    | --------- `Self` type parameter is implicitly captured by this `impl Trait`
diff --git a/tests/ui/impl-trait/precise-capturing/redundant.rs b/tests/ui/impl-trait/precise-capturing/redundant.rs
index 32dc0927317..2385827db22 100644
--- a/tests/ui/impl-trait/precise-capturing/redundant.rs
+++ b/tests/ui/impl-trait/precise-capturing/redundant.rs
@@ -1,6 +1,5 @@
 //@ edition: 2024
 
-#![feature(precise_capturing_in_traits)]
 #![deny(impl_trait_redundant_captures)]
 
 fn hello<'a>() -> impl Sized + use<'a> {}
diff --git a/tests/ui/impl-trait/precise-capturing/redundant.stderr b/tests/ui/impl-trait/precise-capturing/redundant.stderr
index 5c8b35c2285..c9f84d360e3 100644
--- a/tests/ui/impl-trait/precise-capturing/redundant.stderr
+++ b/tests/ui/impl-trait/precise-capturing/redundant.stderr
@@ -1,5 +1,5 @@
 error: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant
-  --> $DIR/redundant.rs:6:19
+  --> $DIR/redundant.rs:5:19
    |
 LL | fn hello<'a>() -> impl Sized + use<'a> {}
    |                   ^^^^^^^^^^^^^-------
@@ -7,13 +7,13 @@ LL | fn hello<'a>() -> impl Sized + use<'a> {}
    |                                help: remove the `use<...>` syntax
    |
 note: the lint level is defined here
-  --> $DIR/redundant.rs:4:9
+  --> $DIR/redundant.rs:3:9
    |
 LL | #![deny(impl_trait_redundant_captures)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant
-  --> $DIR/redundant.rs:11:27
+  --> $DIR/redundant.rs:10:27
    |
 LL |     fn inherent(&self) -> impl Sized + use<'_> {}
    |                           ^^^^^^^^^^^^^-------
@@ -21,7 +21,7 @@ LL |     fn inherent(&self) -> impl Sized + use<'_> {}
    |                                        help: remove the `use<...>` syntax
 
 error: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant
-  --> $DIR/redundant.rs:16:22
+  --> $DIR/redundant.rs:15:22
    |
 LL |     fn in_trait() -> impl Sized + use<'a, Self>;
    |                      ^^^^^^^^^^^^^-------------
@@ -29,7 +29,7 @@ LL |     fn in_trait() -> impl Sized + use<'a, Self>;
    |                                   help: remove the `use<...>` syntax
 
 error: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant
-  --> $DIR/redundant.rs:20:22
+  --> $DIR/redundant.rs:19:22
    |
 LL |     fn in_trait() -> impl Sized + use<'a> {}
    |                      ^^^^^^^^^^^^^-------
diff --git a/tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.rs b/tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.rs
index b39c1408c05..f6126c03339 100644
--- a/tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.rs
+++ b/tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.rs
@@ -2,8 +2,6 @@
 // trait definition, which is not allowed. Due to the default lifetime capture
 // rules of RPITITs, this is only doable if we use precise capturing.
 
-#![feature(precise_capturing_in_traits)]
-
 pub trait Foo {
     fn bar<'tr: 'tr>(&'tr mut self) -> impl Sized + use<Self>;
 }
diff --git a/tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.stderr b/tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.stderr
index 45f755d3cc1..d9066018880 100644
--- a/tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.stderr
+++ b/tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.stderr
@@ -1,5 +1,5 @@
 error: return type captures more lifetimes than trait definition
-  --> $DIR/rpitit-captures-more-method-lifetimes.rs:12:40
+  --> $DIR/rpitit-captures-more-method-lifetimes.rs:10:40
    |
 LL |     fn bar<'im: 'im>(&'im mut self) -> impl Sized + use<'im> {}
    |            ---                         ^^^^^^^^^^^^^^^^^^^^^
@@ -7,7 +7,7 @@ LL |     fn bar<'im: 'im>(&'im mut self) -> impl Sized + use<'im> {}
    |            this lifetime was captured
    |
 note: hidden type must only reference lifetimes captured by this impl trait
-  --> $DIR/rpitit-captures-more-method-lifetimes.rs:8:40
+  --> $DIR/rpitit-captures-more-method-lifetimes.rs:6:40
    |
 LL |     fn bar<'tr: 'tr>(&'tr mut self) -> impl Sized + use<Self>;
    |                                        ^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.rs b/tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.rs
index b16b0522d6e..115cab1cb99 100644
--- a/tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.rs
+++ b/tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.rs
@@ -1,5 +1,3 @@
-#![feature(precise_capturing_in_traits)]
-
 struct Invariant<'a>(&'a mut &'a mut ());
 
 trait Trait {
diff --git a/tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.stderr b/tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.stderr
index 360f0d7e7f3..123e0acf171 100644
--- a/tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.stderr
+++ b/tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.stderr
@@ -1,5 +1,5 @@
 error: return type captures more lifetimes than trait definition
-  --> $DIR/rpitit-impl-captures-too-much.rs:10:39
+  --> $DIR/rpitit-impl-captures-too-much.rs:8:39
    |
 LL |     fn hello(self_: Invariant<'_>) -> impl Sized + use<Self>;
    |                               -- this lifetime was captured
@@ -8,7 +8,7 @@ LL |     fn hello(self_: Invariant<'_>) -> impl Sized + use<'_> {}
    |                                       ^^^^^^^^^^^^^^^^^^^^
    |
 note: hidden type must only reference lifetimes captured by this impl trait
-  --> $DIR/rpitit-impl-captures-too-much.rs:6:39
+  --> $DIR/rpitit-impl-captures-too-much.rs:4:39
    |
 LL |     fn hello(self_: Invariant<'_>) -> impl Sized + use<Self>;
    |                                       ^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/impl-trait/precise-capturing/rpitit-outlives-2.rs b/tests/ui/impl-trait/precise-capturing/rpitit-outlives-2.rs
index 6f7e1a0eaef..6fc129a6480 100644
--- a/tests/ui/impl-trait/precise-capturing/rpitit-outlives-2.rs
+++ b/tests/ui/impl-trait/precise-capturing/rpitit-outlives-2.rs
@@ -2,8 +2,6 @@
 
 // Ensure that we skip uncaptured args from RPITITs when comptuing outlives.
 
-#![feature(precise_capturing_in_traits)]
-
 struct Invariant<T>(*mut T);
 
 trait Foo {
diff --git a/tests/ui/impl-trait/precise-capturing/rpitit-outlives.rs b/tests/ui/impl-trait/precise-capturing/rpitit-outlives.rs
index 94d81d766f7..616368d25cf 100644
--- a/tests/ui/impl-trait/precise-capturing/rpitit-outlives.rs
+++ b/tests/ui/impl-trait/precise-capturing/rpitit-outlives.rs
@@ -3,8 +3,6 @@
 // Ensure that we skip uncaptured args from RPITITs when collecting the regions
 // to enforce member constraints in opaque type inference.
 
-#![feature(precise_capturing_in_traits)]
-
 struct Invariant<T>(*mut T);
 
 trait Foo {
diff --git a/tests/ui/impl-trait/precise-capturing/rpitit.rs b/tests/ui/impl-trait/precise-capturing/rpitit.rs
index 3f887e8e47f..91c52817d85 100644
--- a/tests/ui/impl-trait/precise-capturing/rpitit.rs
+++ b/tests/ui/impl-trait/precise-capturing/rpitit.rs
@@ -3,8 +3,6 @@
 // To fix this soundly, we need to make sure that all the trait header args
 // remain captured, since they affect trait selection.
 
-#![feature(precise_capturing_in_traits)]
-
 fn eq_types<T>(_: T, _: T) {}
 
 trait TraitLt<'a: 'a> {
diff --git a/tests/ui/impl-trait/precise-capturing/rpitit.stderr b/tests/ui/impl-trait/precise-capturing/rpitit.stderr
index 498eae54a1c..ff461e81079 100644
--- a/tests/ui/impl-trait/precise-capturing/rpitit.stderr
+++ b/tests/ui/impl-trait/precise-capturing/rpitit.stderr
@@ -1,5 +1,5 @@
 error: `impl Trait` captures lifetime parameter, but it is not mentioned in `use<...>` precise captures list
-  --> $DIR/rpitit.rs:11:19
+  --> $DIR/rpitit.rs:9:19
    |
 LL | trait TraitLt<'a: 'a> {
    |               -- all lifetime parameters originating from a trait are captured implicitly
@@ -7,7 +7,7 @@ LL |     fn hello() -> impl Sized + use<Self>;
    |                   ^^^^^^^^^^^^^^^^^^^^^^
 
 error: lifetime may not live long enough
-  --> $DIR/rpitit.rs:15:5
+  --> $DIR/rpitit.rs:13:5
    |
 LL |   fn trait_lt<'a, 'b, T: for<'r> TraitLt<'r>> () {
    |               --  -- lifetime `'b` defined here
@@ -24,7 +24,7 @@ LL | |     );
    = help: consider adding the following bound: `'a: 'b`
 
 error: lifetime may not live long enough
-  --> $DIR/rpitit.rs:15:5
+  --> $DIR/rpitit.rs:13:5
    |
 LL |   fn trait_lt<'a, 'b, T: for<'r> TraitLt<'r>> () {
    |               --  -- lifetime `'b` defined here
diff --git a/tests/ui/impl-trait/precise-capturing/self-capture.rs b/tests/ui/impl-trait/precise-capturing/self-capture.rs
index 15985da50b5..66fbfc78043 100644
--- a/tests/ui/impl-trait/precise-capturing/self-capture.rs
+++ b/tests/ui/impl-trait/precise-capturing/self-capture.rs
@@ -1,7 +1,5 @@
 //@ check-pass
 
-#![feature(precise_capturing_in_traits)]
-
 trait Foo {
     fn bar<'a>() -> impl Sized + use<Self>;
 }