Skip to content

Commit

Permalink
Stabilize universal_impl_trait
Browse files Browse the repository at this point in the history
  • Loading branch information
cramertj committed Mar 22, 2018
1 parent c19264f commit 776c0be
Show file tree
Hide file tree
Showing 31 changed files with 15 additions and 104 deletions.

This file was deleted.

7 changes: 0 additions & 7 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -989,13 +989,6 @@ impl<'a> LoweringContext<'a> {
}, lifetimes)
},
ImplTraitContext::Universal(def_id) => {
let has_feature = self.sess.features_untracked().universal_impl_trait;
if !t.span.allows_unstable() && !has_feature {
emit_feature_err(&self.sess.parse_sess, "universal_impl_trait",
t.span, GateIssue::Language,
"`impl Trait` in argument position is experimental");
}

let def_node_id = self.next_id().node_id;

// Add a definition for the in-band TyParam
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
#![feature(specialization)]
#![feature(unboxed_closures)]
#![feature(underscore_lifetimes)]
#![feature(universal_impl_trait)]
#![cfg_attr(stage0, feature(universal_impl_trait))]
#![feature(trace_macros)]
#![feature(trusted_len)]
#![feature(catch_expr)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_data_structures/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#![feature(underscore_lifetimes)]
#![feature(macro_vis_matcher)]
#![feature(allow_internal_unstable)]
#![feature(universal_impl_trait)]
#![cfg_attr(stage0, feature(universal_impl_trait))]

#![cfg_attr(unix, feature(libc))]
#![cfg_attr(test, feature(test))]
Expand Down
1 change: 0 additions & 1 deletion src/librustc_typeck/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4600,7 +4600,6 @@ This error indicates that there is a mismatch between generic parameters and
impl Trait parameters in a trait declaration versus its impl.
```compile_fail,E0643
#![feature(universal_impl_trait)]
trait Foo {
fn foo(&self, _: &impl Iterator);
}
Expand Down
5 changes: 2 additions & 3 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,6 @@ declare_features! (
// Allows `impl Trait` in function return types.
(active, conservative_impl_trait, "1.12.0", Some(34511), None),

// Allows `impl Trait` in function arguments.
(active, universal_impl_trait, "1.23.0", Some(34511), None),

// Allows exhaustive pattern matching on types that contain uninhabited types.
(active, exhaustive_patterns, "1.13.0", None, None),

Expand Down Expand Up @@ -556,6 +553,8 @@ declare_features! (
(accepted, inclusive_range_syntax, "1.26.0", Some(28237), None),
// allow `..=` in patterns (RFC 1192)
(accepted, dotdoteq_in_patterns, "1.26.0", Some(28237), None),
// Allows `impl Trait` in function arguments.
(accepted, universal_impl_trait, "1.26.0", Some(34511), None),
);

// If you change this, please modify src/doc/unstable-book as well. You must
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(universal_impl_trait)]
use std::fmt::Debug;

trait Foo {
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/impl-trait/impl-generic-mismatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(universal_impl_trait)]
use std::fmt::Debug;

trait Foo {
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/impl-trait/where-allowed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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

// Allowed
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/impl-trait/example-calendar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
//[nll] compile-flags: -Znll -Zborrowck=mir

#![feature(conservative_impl_trait,
universal_impl_trait,
fn_traits,
step_trait,
unboxed_closures,
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/impl-trait/lifetimes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(conservative_impl_trait, underscore_lifetimes, universal_impl_trait)]
#![feature(conservative_impl_trait, underscore_lifetimes)]
#![allow(warnings)]

use std::fmt::Debug;
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/impl-trait/universal_hrtb_anon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(universal_impl_trait)]

fn hrtb(f: impl Fn(&u32) -> u32) -> u32 {
f(&22) + f(&44)
}
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/impl-trait/universal_hrtb_named.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(universal_impl_trait)]

fn hrtb(f: impl for<'a> Fn(&'a u32) -> &'a u32) -> u32 {
f(&22) + f(&44)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(universal_impl_trait)]
use std::fmt::Display;

fn check_display_eq(iter: &Vec<impl Display>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(universal_impl_trait)]
use std::fmt::Display;

fn check_display_eq(iter: impl IntoIterator<Item = impl Display>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(universal_impl_trait)]

use std::fmt::Debug;

trait InTraitDefnParameters {
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/impl-trait/universal_multiple_bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(universal_impl_trait)]

use std::fmt::Display;

fn foo(f: impl Display + Clone) -> String {
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/in-band-lifetimes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.

#![allow(warnings)]
#![feature(in_band_lifetimes, universal_impl_trait, conservative_impl_trait)]
#![feature(in_band_lifetimes, conservative_impl_trait)]

fn foo(x: &'x u8) -> &'x u8 { x }
fn foo2(x: &'a u8, y: &u8) -> &'a u8 { x }
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/issue-46959.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(universal_impl_trait)]
#![feature(conservative_impl_trait)]
#![deny(non_camel_case_types)]

Expand Down
1 change: 0 additions & 1 deletion src/test/rustdoc/issue-46976.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(universal_impl_trait)]
pub fn ice(f: impl Fn()) {}
16 changes: 0 additions & 16 deletions src/test/ui/feature-gate-universal.rs

This file was deleted.

11 changes: 0 additions & 11 deletions src/test/ui/feature-gate-universal.stderr

This file was deleted.

2 changes: 0 additions & 2 deletions src/test/ui/impl-trait/universal-mismatched-type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(universal_impl_trait)]

use std::fmt::Debug;

fn foo(x: impl Debug) -> String {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/impl-trait/universal-mismatched-type.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/universal-mismatched-type.rs:16:5
--> $DIR/universal-mismatched-type.rs:14:5
|
LL | fn foo(x: impl Debug) -> String {
| ------ expected `std::string::String` because of return type
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/impl-trait/universal-two-impl-traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(universal_impl_trait)]

use std::fmt::Debug;

fn foo(x: impl Debug, y: impl Debug) -> String {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/impl-trait/universal-two-impl-traits.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/universal-two-impl-traits.rs:17:9
--> $DIR/universal-two-impl-traits.rs:15:9
|
LL | a = y; //~ ERROR mismatched
| ^ expected type parameter, found a different type parameter
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/impl-trait/universal_wrong_bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(universal_impl_trait)]

use std::fmt::Display;

fn foo(f: impl Display + Clone) -> String {
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/impl-trait/universal_wrong_bounds.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error[E0425]: cannot find function `wants_clone` in this scope
--> $DIR/universal_wrong_bounds.rs:18:5
--> $DIR/universal_wrong_bounds.rs:16:5
|
LL | wants_clone(f); //~ ERROR cannot find
| ^^^^^^^^^^^ did you mean `wants_cone`?

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

error[E0405]: cannot find trait `Debug` in this scope
--> $DIR/universal_wrong_bounds.rs:22:26
--> $DIR/universal_wrong_bounds.rs:20:26
|
LL | fn wants_display(g: impl Debug) { } //~ ERROR cannot find
| ^^^^^ not found in this scope
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/impl_trait_projections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(dyn_trait, conservative_impl_trait, universal_impl_trait)]
#![feature(dyn_trait, conservative_impl_trait)]

use std::fmt::Debug;
use std::option;
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/in-band-lifetimes/E0687_where.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.

#![allow(warnings)]
#![feature(in_band_lifetimes, universal_impl_trait)]
#![feature(in_band_lifetimes)]

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

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/nested_impl_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(conservative_impl_trait, universal_impl_trait)]
#![feature(conservative_impl_trait)]

use std::fmt::Debug;

Expand Down

0 comments on commit 776c0be

Please sign in to comment.