Skip to content

Commit

Permalink
Stabilize conservative_impl_trait
Browse files Browse the repository at this point in the history
  • Loading branch information
cramertj committed Mar 26, 2018
1 parent c393db6 commit 0f5b52e
Show file tree
Hide file tree
Showing 68 changed files with 62 additions and 240 deletions.
27 changes: 3 additions & 24 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

2 changes: 1 addition & 1 deletion src/libcore/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#![cfg_attr(stage0, feature(inclusive_range_syntax))]
#![feature(iterator_try_fold)]
#![feature(iterator_flatten)]
#![feature(conservative_impl_trait)]
#![cfg_attr(stage0, feature(conservative_impl_trait))]
#![feature(iter_rfind)]
#![feature(iter_rfold)]
#![feature(iterator_repeat_with)]
Expand Down
8 changes: 0 additions & 8 deletions src/librustc/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1789,8 +1789,6 @@ allowed as function return types.
Erroneous code example:
```compile_fail,E0562
#![feature(conservative_impl_trait)]
fn main() {
let count_to_ten: impl Iterator<Item=usize> = 0..10;
// error: `impl Trait` not allowed outside of function and inherent method
Expand All @@ -1804,8 +1802,6 @@ fn main() {
Make sure `impl Trait` only appears in return-type position.
```
#![feature(conservative_impl_trait)]
fn count_to_n(n: usize) -> impl Iterator<Item=usize> {
0..n
}
Expand Down Expand Up @@ -2081,8 +2077,6 @@ appear within the `impl Trait` itself.
Erroneous code example:
```compile-fail,E0909
#![feature(conservative_impl_trait)]
use std::cell::Cell;
trait Trait<'a> { }
Expand All @@ -2109,8 +2103,6 @@ type. For example, changing the return type to `impl Trait<'y> + 'x`
would work:
```
#![feature(conservative_impl_trait)]
use std::cell::Cell;
trait Trait<'a> { }
Expand Down
11 changes: 0 additions & 11 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1108,20 +1108,9 @@ impl<'a> LoweringContext<'a> {
hir::TyTraitObject(bounds, lifetime_bound)
}
TyKind::ImplTrait(ref bounds) => {
use syntax::feature_gate::{emit_feature_err, GateIssue};
let span = t.span;
match itctx {
ImplTraitContext::Existential => {
let has_feature = self.sess.features_untracked().conservative_impl_trait;
if !t.span.allows_unstable() && !has_feature {
emit_feature_err(
&self.sess.parse_sess,
"conservative_impl_trait",
t.span,
GateIssue::Language,
"`impl Trait` in return position is experimental",
);
}
let def_index = self.resolver.definitions().opt_def_index(t.id).unwrap();
let hir_bounds = self.lower_bounds(bounds, itctx);
let (lifetimes, lifetime_defs) =
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(conservative_impl_trait)]
#![cfg_attr(stage0, feature(conservative_impl_trait))]
#![feature(const_fn)]
#![cfg_attr(stage0, feature(copy_closures, clone_closures))]
#![feature(core_intrinsics)]
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 @@ -28,7 +28,7 @@
#![feature(unsize)]
#![feature(i128_type)]
#![feature(i128)]
#![feature(conservative_impl_trait)]
#![cfg_attr(stage0, feature(conservative_impl_trait))]
#![feature(specialization)]
#![feature(optin_builtin_traits)]
#![feature(underscore_lifetimes)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_errors/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#![allow(unused_attributes)]
#![feature(range_contains)]
#![cfg_attr(unix, feature(libc))]
#![feature(conservative_impl_trait)]
#![cfg_attr(stage0, feature(conservative_impl_trait))]
#![feature(i128_type)]
#![feature(optin_builtin_traits)]

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_incremental/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]

#![feature(conservative_impl_trait)]
#![cfg_attr(stage0, feature(conservative_impl_trait))]
#![feature(fs_read_write)]
#![feature(i128_type)]
#![cfg_attr(stage0, feature(inclusive_range_syntax))]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_metadata/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#![deny(warnings)]

#![feature(box_patterns)]
#![feature(conservative_impl_trait)]
#![cfg_attr(stage0, feature(conservative_impl_trait))]
#![feature(fs_read_write)]
#![feature(i128_type)]
#![feature(libc)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(catch_expr)]
#![feature(conservative_impl_trait)]
#![cfg_attr(stage0, feature(conservative_impl_trait))]
#![feature(const_fn)]
#![feature(core_intrinsics)]
#![feature(decl_macro)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![cfg_attr(stage0, feature(slice_patterns))]
#![feature(conservative_impl_trait)]
#![cfg_attr(stage0, feature(conservative_impl_trait))]
#![feature(optin_builtin_traits)]
#![feature(inclusive_range_fields)]

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans_utils/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#![feature(i128_type)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(conservative_impl_trait)]
#![cfg_attr(stage0, feature(conservative_impl_trait))]

extern crate ar;
extern crate flate2;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ This API is completely unstable and subject to change.
#![cfg_attr(stage0, feature(advanced_slice_patterns))]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(conservative_impl_trait)]
#![cfg_attr(stage0, feature(conservative_impl_trait))]
#![cfg_attr(stage0, feature(copy_closures, clone_closures))]
#![feature(crate_visibility_modifier)]
#![feature(from_ref)]
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 @@ -276,9 +276,6 @@ declare_features! (
// Allows cfg(target_has_atomic = "...").
(active, cfg_target_has_atomic, "1.9.0", Some(32976), None),

// Allows `impl Trait` in function return types.
(active, conservative_impl_trait, "1.12.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 @@ -565,6 +562,8 @@ declare_features! (
(accepted, copy_closures, "1.26.0", Some(44490), None),
// Allows `impl Trait` in function arguments.
(accepted, universal_impl_trait, "1.26.0", Some(34511), None),
// Allows `impl Trait` in function return types.
(accepted, conservative_impl_trait, "1.26.0", Some(34511), None),
);

// If you change this, please modify src/doc/unstable-book as well. You must
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/conservative_impl_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

// #39872, #39553

#![feature(conservative_impl_trait)]
fn will_ice(something: &u32) -> impl Iterator<Item = &u32> {
//~^ ERROR the trait bound `(): std::iter::Iterator` is not satisfied [E0277]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

// error-pattern:overflow evaluating the requirement `impl Quux`

#![feature(conservative_impl_trait)]

trait Quux {}

fn foo() -> impl Quux {
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(conservative_impl_trait)]

use std::fmt::Debug;

fn elided(x: &i32) -> impl Copy { x }
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(conservative_impl_trait)]

use std::fmt::Debug;

trait MultiRegionTrait<'a, 'b> {}
Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/impl-trait/no-trait.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(conservative_impl_trait)]

fn f() -> impl 'static {} //~ ERROR at least one trait must be specified

fn main() {}
2 changes: 0 additions & 2 deletions src/test/compile-fail/impl-trait/type_parameters_captured.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(conservative_impl_trait)]

use std::fmt::Debug;

trait Any {}
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, dyn_trait)]
#![feature(dyn_trait)]
use std::fmt::Debug;

// Allowed
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/issue-32995-2.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(conservative_impl_trait)]
#![allow(unused)]

fn main() {
Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/issue-35668.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(conservative_impl_trait)]

fn func<'a, T>(a: &'a [T]) -> impl Iterator<Item=&'a T> {
a.iter().map(|a| a*a)
//~^ ERROR binary operation `*` cannot be applied to type `&T`
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-36379.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, rustc_attrs)]
#![feature(rustc_attrs)]

fn _test() -> impl Default { }

Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/private-inferred-type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// except according to those terms.

#![feature(associated_consts)]
#![feature(conservative_impl_trait)]
#![feature(decl_macro)]
#![allow(private_in_public)]

Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/private-type-in-interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

// aux-build:private-inferred-type.rs

#![feature(conservative_impl_trait)]
#![allow(warnings)]

extern crate private_inferred_type as ext;
Expand Down
Loading

0 comments on commit 0f5b52e

Please sign in to comment.