Skip to content

Commit c393db6

Browse files
committed
Stabilize universal_impl_trait
1 parent 445fafa commit c393db6

31 files changed

+15
-108
lines changed

src/doc/unstable-book/src/language-features/universal-impl-trait.md

-32
This file was deleted.

src/librustc/hir/lowering.rs

-11
Original file line numberDiff line numberDiff line change
@@ -1143,17 +1143,6 @@ impl<'a> LoweringContext<'a> {
11431143
)
11441144
}
11451145
ImplTraitContext::Universal(def_id) => {
1146-
let has_feature = self.sess.features_untracked().universal_impl_trait;
1147-
if !t.span.allows_unstable() && !has_feature {
1148-
emit_feature_err(
1149-
&self.sess.parse_sess,
1150-
"universal_impl_trait",
1151-
t.span,
1152-
GateIssue::Language,
1153-
"`impl Trait` in argument position is experimental",
1154-
);
1155-
}
1156-
11571146
let def_node_id = self.next_id().node_id;
11581147

11591148
// Add a definition for the in-band TyParam

src/librustc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
#![feature(specialization)]
7171
#![feature(unboxed_closures)]
7272
#![feature(underscore_lifetimes)]
73-
#![feature(universal_impl_trait)]
73+
#![cfg_attr(stage0, feature(universal_impl_trait))]
7474
#![feature(trace_macros)]
7575
#![feature(trusted_len)]
7676
#![feature(catch_expr)]

src/librustc_data_structures/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#![feature(underscore_lifetimes)]
3535
#![feature(macro_vis_matcher)]
3636
#![feature(allow_internal_unstable)]
37-
#![feature(universal_impl_trait)]
37+
#![cfg_attr(stage0, feature(universal_impl_trait))]
3838

3939
#![cfg_attr(unix, feature(libc))]
4040
#![cfg_attr(test, feature(test))]

src/librustc_typeck/diagnostics.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4600,7 +4600,6 @@ This error indicates that there is a mismatch between generic parameters and
46004600
impl Trait parameters in a trait declaration versus its impl.
46014601
46024602
```compile_fail,E0643
4603-
#![feature(universal_impl_trait)]
46044603
trait Foo {
46054604
fn foo(&self, _: &impl Iterator);
46064605
}

src/libsyntax/feature_gate.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,6 @@ declare_features! (
279279
// Allows `impl Trait` in function return types.
280280
(active, conservative_impl_trait, "1.12.0", Some(34511), None),
281281

282-
// Allows `impl Trait` in function arguments.
283-
(active, universal_impl_trait, "1.23.0", Some(34511), None),
284-
285282
// Allows exhaustive pattern matching on types that contain uninhabited types.
286283
(active, exhaustive_patterns, "1.13.0", None, None),
287284

@@ -566,6 +563,8 @@ declare_features! (
566563
// Copy/Clone closures (RFC 2132)
567564
(accepted, clone_closures, "1.26.0", Some(44490), None),
568565
(accepted, copy_closures, "1.26.0", Some(44490), None),
566+
// Allows `impl Trait` in function arguments.
567+
(accepted, universal_impl_trait, "1.26.0", Some(34511), None),
569568
);
570569

571570
// If you change this, please modify src/doc/unstable-book as well. You must

src/test/compile-fail/impl-trait/impl-generic-mismatch-ab.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(universal_impl_trait)]
1211
use std::fmt::Debug;
1312

1413
trait Foo {

src/test/compile-fail/impl-trait/impl-generic-mismatch.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(universal_impl_trait)]
1211
use std::fmt::Debug;
1312

1413
trait Foo {

src/test/compile-fail/impl-trait/where-allowed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
//! A simple test for testing many permutations of allowedness of
1212
//! impl Trait
13-
#![feature(conservative_impl_trait, universal_impl_trait, dyn_trait)]
13+
#![feature(conservative_impl_trait, dyn_trait)]
1414
use std::fmt::Debug;
1515

1616
// Allowed

src/test/run-pass/impl-trait/example-calendar.rs

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//[nll] compile-flags: -Znll -Zborrowck=mir
1313

1414
#![feature(conservative_impl_trait,
15-
universal_impl_trait,
1615
fn_traits,
1716
step_trait,
1817
unboxed_closures,

src/test/run-pass/impl-trait/lifetimes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(conservative_impl_trait, underscore_lifetimes, universal_impl_trait)]
11+
#![feature(conservative_impl_trait, underscore_lifetimes)]
1212
#![allow(warnings)]
1313

1414
use std::fmt::Debug;

src/test/run-pass/impl-trait/universal_hrtb_anon.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(universal_impl_trait)]
12-
1311
fn hrtb(f: impl Fn(&u32) -> u32) -> u32 {
1412
f(&22) + f(&44)
1513
}

src/test/run-pass/impl-trait/universal_hrtb_named.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(universal_impl_trait)]
12-
1311
fn hrtb(f: impl for<'a> Fn(&'a u32) -> &'a u32) -> u32 {
1412
f(&22) + f(&44)
1513
}

src/test/run-pass/impl-trait/universal_in_adt_in_parameters.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(universal_impl_trait)]
1211
use std::fmt::Display;
1312

1413
fn check_display_eq(iter: &Vec<impl Display>) {

src/test/run-pass/impl-trait/universal_in_impl_trait_in_parameters.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(universal_impl_trait)]
1211
use std::fmt::Display;
1312

1413
fn check_display_eq(iter: impl IntoIterator<Item = impl Display>) {

src/test/run-pass/impl-trait/universal_in_trait_defn_parameters.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(universal_impl_trait)]
12-
1311
use std::fmt::Debug;
1412

1513
trait InTraitDefnParameters {

src/test/run-pass/impl-trait/universal_multiple_bounds.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(universal_impl_trait)]
12-
1311
use std::fmt::Display;
1412

1513
fn foo(f: impl Display + Clone) -> String {

src/test/run-pass/in-band-lifetimes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
#![allow(warnings)]
12-
#![feature(in_band_lifetimes, universal_impl_trait, conservative_impl_trait)]
12+
#![feature(in_band_lifetimes, conservative_impl_trait)]
1313

1414
fn foo(x: &'x u8) -> &'x u8 { x }
1515
fn foo2(x: &'a u8, y: &u8) -> &'a u8 { x }

src/test/run-pass/issue-46959.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(universal_impl_trait)]
1211
#![feature(conservative_impl_trait)]
1312
#![deny(non_camel_case_types)]
1413

src/test/rustdoc/issue-46976.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(universal_impl_trait)]
1211
pub fn ice(f: impl Fn()) {}

src/test/ui/feature-gate-universal.rs

-16
This file was deleted.

src/test/ui/feature-gate-universal.stderr

-11
This file was deleted.

src/test/ui/impl-trait/universal-mismatched-type.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(universal_impl_trait)]
12-
1311
use std::fmt::Debug;
1412

1513
fn foo(x: impl Debug) -> String {

src/test/ui/impl-trait/universal-mismatched-type.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: mismatched types
2-
--> $DIR/universal-mismatched-type.rs:16:5
2+
--> $DIR/universal-mismatched-type.rs:14:5
33
|
44
LL | fn foo(x: impl Debug) -> String {
55
| ------ expected `std::string::String` because of return type

src/test/ui/impl-trait/universal-two-impl-traits.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(universal_impl_trait)]
12-
1311
use std::fmt::Debug;
1412

1513
fn foo(x: impl Debug, y: impl Debug) -> String {

src/test/ui/impl-trait/universal-two-impl-traits.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: mismatched types
2-
--> $DIR/universal-two-impl-traits.rs:17:9
2+
--> $DIR/universal-two-impl-traits.rs:15:9
33
|
44
LL | a = y; //~ ERROR mismatched
55
| ^ expected type parameter, found a different type parameter

src/test/ui/impl-trait/universal_wrong_bounds.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(universal_impl_trait)]
12-
1311
use std::fmt::Display;
1412

1513
fn foo(f: impl Display + Clone) -> String {

src/test/ui/impl-trait/universal_wrong_bounds.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0425]: cannot find function `wants_clone` in this scope
2-
--> $DIR/universal_wrong_bounds.rs:18:5
2+
--> $DIR/universal_wrong_bounds.rs:16:5
33
|
44
LL | wants_clone(f); //~ ERROR cannot find
55
| ^^^^^^^^^^^ did you mean `wants_cone`?
66

77
error[E0405]: cannot find trait `Debug` in this scope
8-
--> $DIR/universal_wrong_bounds.rs:21:24
8+
--> $DIR/universal_wrong_bounds.rs:19:24
99
|
1010
LL | fn wants_debug(g: impl Debug) { } //~ ERROR cannot find
1111
| ^^^^^ not found in this scope
@@ -15,7 +15,7 @@ LL | use std::fmt::Debug;
1515
|
1616

1717
error[E0405]: cannot find trait `Debug` in this scope
18-
--> $DIR/universal_wrong_bounds.rs:22:26
18+
--> $DIR/universal_wrong_bounds.rs:20:26
1919
|
2020
LL | fn wants_display(g: impl Debug) { } //~ ERROR cannot find
2121
| ^^^^^ not found in this scope

src/test/ui/impl_trait_projections.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10-
#![feature(dyn_trait, conservative_impl_trait, universal_impl_trait)]
10+
#![feature(dyn_trait, conservative_impl_trait)]
1111

1212
use std::fmt::Debug;
1313
use std::option;

src/test/ui/in-band-lifetimes/E0687_where.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
#![allow(warnings)]
12-
#![feature(in_band_lifetimes, universal_impl_trait)]
12+
#![feature(in_band_lifetimes)]
1313

1414
fn bar<F>(x: &F) where F: Fn(&'a u32) {} //~ ERROR must be explicitly
1515

src/test/ui/nested_impl_trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10-
#![feature(conservative_impl_trait, universal_impl_trait)]
10+
#![feature(conservative_impl_trait)]
1111

1212
use std::fmt::Debug;
1313

0 commit comments

Comments
 (0)