Stabilize conservative_impl_trait

This commit is contained in:
Taylor Cramer 2018-03-21 18:32:44 -07:00
parent c393db67ba
commit 0f5b52e4a8
68 changed files with 62 additions and 240 deletions

27
src/Cargo.lock generated
View File

@ -271,11 +271,11 @@ dependencies = [
[[package]]
name = "clippy"
version = "0.0.188"
version = "0.0.189"
dependencies = [
"cargo_metadata 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy-mini-macro-test 0.2.0",
"clippy_lints 0.0.188",
"clippy_lints 0.0.189",
"compiletest_rs 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"derive-new 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -289,29 +289,9 @@ dependencies = [
name = "clippy-mini-macro-test"
version = "0.2.0"
[[package]]
name = "clippy_lints"
version = "0.0.188"
dependencies = [
"if_chain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "clippy_lints"
version = "0.0.189"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"if_chain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1419,7 +1399,7 @@ version = "0.126.0"
dependencies = [
"cargo 0.27.0",
"cargo_metadata 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy_lints 0.0.189 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy_lints 0.0.189",
"env_logger 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"json 0.11.12 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2638,7 +2618,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
"checksum chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c20ebe0b2b08b0aeddba49c609fe7957ba2e33449882cb186a180bc60682fa9"
"checksum clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0f16b89cbb9ee36d87483dc939fe9f1e13c05898d56d7b230a0d4dff033a536"
"checksum clippy_lints 0.0.189 (registry+https://github.com/rust-lang/crates.io-index)" = "fef652630bbf8c5e89601220abd000f5057e8fa9db608484b5ebaad98e9bce53"
"checksum cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "56d741ea7a69e577f6d06b36b7dff4738f680593dc27a701ffa8506b73ce28bb"
"checksum commoncrypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d056a8586ba25a1e4d61cb090900e495952c7886786fc55f909ab2f819b69007"
"checksum commoncrypto-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fed34f46747aa73dfaa578069fd8279d2818ade2b55f38f22a9401c7f4083e2"

View File

@ -1,66 +0,0 @@
# `conservative_impl_trait`
The tracking issue for this feature is: [#34511]
[#34511]: https://github.com/rust-lang/rust/issues/34511
------------------------
The `conservative_impl_trait` feature allows a conservative form of abstract
return types.
Abstract return types allow a function to hide a concrete return type behind a
trait interface similar to trait objects, while still generating the same
statically dispatched code as with concrete types.
## Examples
```rust
#![feature(conservative_impl_trait)]
fn even_iter() -> impl Iterator<Item=u32> {
(0..).map(|n| n * 2)
}
fn main() {
let first_four_even_numbers = even_iter().take(4).collect::<Vec<_>>();
assert_eq!(first_four_even_numbers, vec![0, 2, 4, 6]);
}
```
## Background
In today's Rust, you can write function signatures like:
````rust,ignore
fn consume_iter_static<I: Iterator<Item=u8>>(iter: I) { }
fn consume_iter_dynamic(iter: Box<Iterator<Item=u8>>) { }
````
In both cases, the function does not depend on the exact type of the argument.
The type held is "abstract", and is assumed only to satisfy a trait bound.
* In the `_static` version using generics, each use of the function is
specialized to a concrete, statically-known type, giving static dispatch,
inline layout, and other performance wins.
* In the `_dynamic` version using trait objects, the concrete argument type is
only known at runtime using a vtable.
On the other hand, while you can write:
````rust,ignore
fn produce_iter_dynamic() -> Box<Iterator<Item=u8>> { }
````
...but you _cannot_ write something like:
````rust,ignore
fn produce_iter_static() -> Iterator<Item=u8> { }
````
That is, in today's Rust, abstract return types can only be written using trait
objects, which can be a significant performance penalty. This RFC proposes
"unboxed abstract types" as a way of achieving signatures like
`produce_iter_static`. Like generics, unboxed abstract types guarantee static
dispatch and inline data layout.

View File

@ -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)]

View File

@ -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
@ -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
}
@ -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> { }
@ -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> { }

View File

@ -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) =

View File

@ -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)]

View File

@ -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)]

View File

@ -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)]

View File

@ -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))]

View File

@ -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)]

View File

@ -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)]

View File

@ -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)]

View File

@ -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;

View File

@ -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)]

View File

@ -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),
@ -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

View File

@ -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]
}

View File

@ -15,8 +15,6 @@
// error-pattern:overflow evaluating the requirement `impl Quux`
#![feature(conservative_impl_trait)]
trait Quux {}
fn foo() -> impl Quux {

View File

@ -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 }

View File

@ -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> {}

View File

@ -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() {}

View File

@ -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 {}

View File

@ -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

View File

@ -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() {

View File

@ -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`

View File

@ -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 { }

View File

@ -9,7 +9,6 @@
// except according to those terms.
#![feature(associated_consts)]
#![feature(conservative_impl_trait)]
#![feature(decl_macro)]
#![allow(private_in_public)]

View File

@ -10,7 +10,6 @@
// aux-build:private-inferred-type.rs
#![feature(conservative_impl_trait)]
#![allow(warnings)]
extern crate private_inferred_type as ext;

View File

@ -22,7 +22,6 @@
#![allow(warnings)]
#![feature(conservative_impl_trait)]
#![feature(intrinsics)]
#![feature(linkage)]
#![feature(rustc_attrs)]

View File

@ -10,8 +10,6 @@
// #39665
#![feature(conservative_impl_trait)]
fn batches(n: &u32) -> impl Iterator<Item=&u32> {
std::iter::once(n)
}

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(conservative_impl_trait, generators, generator_trait)]
#![feature(generators, generator_trait)]
use std::ops::Generator;

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(generators, generator_trait, conservative_impl_trait)]
#![feature(generators, generator_trait)]
use std::ops::Generator;

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(conservative_impl_trait, generators, generator_trait)]
#![feature(generators, generator_trait)]
use std::ops::{ Generator, GeneratorState };

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(generators, generator_trait, conservative_impl_trait)]
#![feature(generators, generator_trait)]
use std::ops::{GeneratorState, Generator};

View File

@ -10,7 +10,7 @@
// aux-build:xcrate-reachable.rs
#![feature(conservative_impl_trait, generator_trait)]
#![feature(generator_trait)]
extern crate xcrate_reachable as foo;

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(conservative_impl_trait)]
// Fast path, main can see the concrete type returned.
fn before() -> impl FnMut(i32) {
let mut p = Box::new(0);

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(conservative_impl_trait)]
// NOTE commented out due to issue #45994
//pub fn fourway_add(a: i32) -> impl Fn(i32) -> impl Fn(i32) -> impl Fn(i32) -> i32 {
// move |b| move |c| move |d| a + b + c + d

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(conservative_impl_trait, specialization)]
#![feature(specialization)]
trait Foo: std::fmt::Debug + Eq {}

View File

@ -11,8 +11,7 @@
// revisions: normal nll
//[nll] compile-flags: -Znll -Zborrowck=mir
#![feature(conservative_impl_trait,
fn_traits,
#![feature(fn_traits,
step_trait,
unboxed_closures,
copy_closures,

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(conservative_impl_trait)]
struct State;
type Error = ();

View File

@ -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::iter::once;
struct Foo {

View File

@ -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)]
#![feature(underscore_lifetimes)]
#![allow(warnings)]
use std::fmt::Debug;

View File

@ -9,7 +9,7 @@
// except according to those terms.
#![allow(warnings)]
#![feature(in_band_lifetimes, conservative_impl_trait)]
#![feature(in_band_lifetimes)]
fn foo(x: &'x u8) -> &'x u8 { x }
fn foo2(x: &'a u8, y: &u8) -> &'a u8 { x }

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(conservative_impl_trait)]
fn foo() -> impl Copy {
foo
}

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(conservative_impl_trait)]
#![deny(non_camel_case_types)]
#[allow(dead_code)]

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(conservative_impl_trait)]
pub fn g() -> impl Iterator<Item=u8> {
Some(1u8).into_iter()
}

View File

@ -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;
fn foo() -> Box<impl fmt::Debug+?Sized> {

View File

@ -1,5 +1,5 @@
error[E0606]: casting `*mut impl std::fmt::Debug+?Sized` as `*mut impl std::fmt::Debug+?Sized` is invalid
--> $DIR/casts-differing-anon.rs:33:13
--> $DIR/casts-differing-anon.rs:31:13
|
LL | b_raw = f_raw as *mut _; //~ ERROR is invalid
| ^^^^^^^^^^^^^^^

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(warnings)]
#![feature(conservative_impl_trait)]
trait Id<T> {}
trait Lt<'a> {}

View File

@ -1,11 +1,11 @@
error[E0657]: `impl Trait` can only capture lifetimes bound at the fn or impl level
--> $DIR/E0657.rs:20:31
--> $DIR/E0657.rs:19:31
|
LL | -> Box<for<'a> Id<impl Lt<'a>>>
| ^^
error[E0657]: `impl Trait` can only capture lifetimes bound at the fn or impl level
--> $DIR/E0657.rs:29:35
--> $DIR/E0657.rs:28:35
|
LL | -> Box<for<'a> Id<impl Lt<'a>>>
| ^^

View File

@ -1,14 +0,0 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <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.
fn foo() -> impl Fn() { || {} }
//~^ ERROR `impl Trait` in return position is experimental
fn main() {}

View File

@ -1,11 +0,0 @@
error[E0658]: `impl Trait` in return position is experimental (see issue #34511)
--> $DIR/feature-gate-conservative_impl_trait.rs:11:13
|
LL | fn foo() -> impl Fn() { || {} }
| ^^^^^^^^^
|
= help: add #![feature(conservative_impl_trait)] to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View File

@ -10,8 +10,6 @@
// ignore-tidy-linelength
#![feature(conservative_impl_trait)]
use std::cell::Cell;
use std::rc::Rc;

View File

@ -1,56 +1,56 @@
error[E0277]: the trait bound `std::rc::Rc<std::cell::Cell<i32>>: std::marker::Send` is not satisfied in `impl std::ops::Fn<(i32,)>`
--> $DIR/auto-trait-leak.rs:27:5
--> $DIR/auto-trait-leak.rs:25:5
|
LL | send(before());
| ^^^^ `std::rc::Rc<std::cell::Cell<i32>>` cannot be sent between threads safely
|
= help: within `impl std::ops::Fn<(i32,)>`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::cell::Cell<i32>>`
= note: required because it appears within the type `[closure@$DIR/auto-trait-leak.rs:21:5: 21:22 p:std::rc::Rc<std::cell::Cell<i32>>]`
= note: required because it appears within the type `[closure@$DIR/auto-trait-leak.rs:19:5: 19:22 p:std::rc::Rc<std::cell::Cell<i32>>]`
= note: required because it appears within the type `impl std::ops::Fn<(i32,)>`
note: required by `send`
--> $DIR/auto-trait-leak.rs:24:1
--> $DIR/auto-trait-leak.rs:22:1
|
LL | fn send<T: Send>(_: T) {}
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `std::rc::Rc<std::cell::Cell<i32>>: std::marker::Send` is not satisfied in `impl std::ops::Fn<(i32,)>`
--> $DIR/auto-trait-leak.rs:30:5
--> $DIR/auto-trait-leak.rs:28:5
|
LL | send(after());
| ^^^^ `std::rc::Rc<std::cell::Cell<i32>>` cannot be sent between threads safely
|
= help: within `impl std::ops::Fn<(i32,)>`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::cell::Cell<i32>>`
= note: required because it appears within the type `[closure@$DIR/auto-trait-leak.rs:38:5: 38:22 p:std::rc::Rc<std::cell::Cell<i32>>]`
= note: required because it appears within the type `[closure@$DIR/auto-trait-leak.rs:36:5: 36:22 p:std::rc::Rc<std::cell::Cell<i32>>]`
= note: required because it appears within the type `impl std::ops::Fn<(i32,)>`
note: required by `send`
--> $DIR/auto-trait-leak.rs:24:1
--> $DIR/auto-trait-leak.rs:22:1
|
LL | fn send<T: Send>(_: T) {}
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0391]: cyclic dependency detected
--> $DIR/auto-trait-leak.rs:44:1
--> $DIR/auto-trait-leak.rs:42:1
|
LL | fn cycle1() -> impl Clone {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic reference
|
note: the cycle begins when processing `cycle1`...
--> $DIR/auto-trait-leak.rs:44:1
--> $DIR/auto-trait-leak.rs:42:1
|
LL | fn cycle1() -> impl Clone {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which then requires processing `cycle2::{{impl-Trait}}`...
--> $DIR/auto-trait-leak.rs:52:16
--> $DIR/auto-trait-leak.rs:50:16
|
LL | fn cycle2() -> impl Clone {
| ^^^^^^^^^^
note: ...which then requires processing `cycle2`...
--> $DIR/auto-trait-leak.rs:52:1
--> $DIR/auto-trait-leak.rs:50:1
|
LL | fn cycle2() -> impl Clone {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which then requires processing `cycle1::{{impl-Trait}}`...
--> $DIR/auto-trait-leak.rs:44:16
--> $DIR/auto-trait-leak.rs:42:16
|
LL | fn cycle1() -> impl Clone {
| ^^^^^^^^^^

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(conservative_impl_trait, specialization)]
#![feature(specialization)]
trait Foo: Copy + ToString {}

View File

@ -18,7 +18,6 @@
// run-pass
#![allow(dead_code)]
#![feature(conservative_impl_trait)]
#![feature(in_band_lifetimes)]
#![feature(nll)]

View File

@ -18,7 +18,6 @@
// run-pass
#![allow(dead_code)]
#![feature(conservative_impl_trait)]
#![feature(in_band_lifetimes)]
#![feature(nll)]

View File

@ -14,7 +14,6 @@
// See https://github.com/rust-lang/rust/issues/46541 for more details.
#![allow(dead_code)]
#![feature(conservative_impl_trait)]
#![feature(in_band_lifetimes)]
#![feature(nll)]

View File

@ -1,11 +1,11 @@
error[E0909]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/region-escape-via-bound.rs:27:29
--> $DIR/region-escape-via-bound.rs:26:29
|
LL | fn foo(x: Cell<&'x u32>) -> impl Trait<'y>
| ^^^^^^^^^^^^^^
|
note: hidden type `std::cell::Cell<&'x u32>` captures the lifetime 'x as defined on the function body at 27:1
--> $DIR/region-escape-via-bound.rs:27:1
note: hidden type `std::cell::Cell<&'x u32>` captures the lifetime 'x as defined on the function body at 26:1
--> $DIR/region-escape-via-bound.rs:26:1
|
LL | / fn foo(x: Cell<&'x u32>) -> impl Trait<'y>
LL | | //~^ ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds [E0909]

View File

@ -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)]
#![feature(dyn_trait)]
use std::fmt::Debug;
use std::option;

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(conservative_impl_trait)]
trait Foo {
fn foo(_: fn(u8) -> ());
fn bar(_: Option<u8>);

View File

@ -1,5 +1,5 @@
error[E0053]: method `foo` has an incompatible type for trait
--> $DIR/issue-35869.rs:23:15
--> $DIR/issue-35869.rs:21:15
|
LL | fn foo(_: fn(u8) -> ());
| ------------ type in trait
@ -11,7 +11,7 @@ LL | fn foo(_: fn(u16) -> ()) {}
found type `fn(fn(u16))`
error[E0053]: method `bar` has an incompatible type for trait
--> $DIR/issue-35869.rs:25:15
--> $DIR/issue-35869.rs:23:15
|
LL | fn bar(_: Option<u8>);
| ---------- type in trait
@ -23,7 +23,7 @@ LL | fn bar(_: Option<u16>) {}
found type `fn(std::option::Option<u16>)`
error[E0053]: method `baz` has an incompatible type for trait
--> $DIR/issue-35869.rs:27:15
--> $DIR/issue-35869.rs:25:15
|
LL | fn baz(_: (u8, u16));
| --------- type in trait
@ -35,7 +35,7 @@ LL | fn baz(_: (u16, u16)) {}
found type `fn((u16, u16))`
error[E0053]: method `qux` has an incompatible type for trait
--> $DIR/issue-35869.rs:29:17
--> $DIR/issue-35869.rs:27:17
|
LL | fn qux() -> u8;
| -- type in trait

View File

@ -7,8 +7,6 @@
// <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)]
use std::fmt::Debug;
fn fine(x: impl Into<u32>) -> impl Into<u32> { x }

View File

@ -1,5 +1,5 @@
error[E0666]: nested `impl Trait` is not allowed
--> $DIR/nested_impl_trait.rs:16:56
--> $DIR/nested_impl_trait.rs:14:56
|
LL | fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }
| ----------^^^^^^^^^^-
@ -8,7 +8,7 @@ LL | fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }
| outer `impl Trait`
error[E0666]: nested `impl Trait` is not allowed
--> $DIR/nested_impl_trait.rs:19:42
--> $DIR/nested_impl_trait.rs:17:42
|
LL | fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}
| ----------^^^^^^^^^^-
@ -17,7 +17,7 @@ LL | fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}
| outer `impl Trait`
error[E0666]: nested `impl Trait` is not allowed
--> $DIR/nested_impl_trait.rs:23:37
--> $DIR/nested_impl_trait.rs:21:37
|
LL | fn bad_in_arg_position(_: impl Into<impl Debug>) { }
| ----------^^^^^^^^^^-
@ -26,7 +26,7 @@ LL | fn bad_in_arg_position(_: impl Into<impl Debug>) { }
| outer `impl Trait`
error[E0666]: nested `impl Trait` is not allowed
--> $DIR/nested_impl_trait.rs:28:44
--> $DIR/nested_impl_trait.rs:26:44
|
LL | fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }
| ----------^^^^^^^^^^-
@ -35,13 +35,13 @@ LL | fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }
| outer `impl Trait`
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/nested_impl_trait.rs:19:32
--> $DIR/nested_impl_trait.rs:17:32
|
LL | fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}
| ^^^^^^^^^^^^^^^^^^^^^
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/nested_impl_trait.rs:36:42
--> $DIR/nested_impl_trait.rs:34:42
|
LL | fn allowed_in_ret_type() -> impl Fn() -> impl Into<u32> {
| ^^^^^^^^^^^^^^

View File

@ -11,7 +11,6 @@
// compile-flags:-Znll -Zborrowck=mir -Zverbose
#![allow(warnings)]
#![feature(conservative_impl_trait)]
trait Foo<'a> {
}

View File

@ -1,11 +1,11 @@
warning: not reporting region error due to -Znll
--> $DIR/impl-trait-captures.rs:22:5
--> $DIR/impl-trait-captures.rs:21:5
|
LL | x
| ^
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/impl-trait-captures.rs:22:5
--> $DIR/impl-trait-captures.rs:21:5
|
LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> {
| - consider changing the type of `x` to `&ReEarlyBound(0, 'a) T`

View File

@ -11,7 +11,6 @@
// compile-flags:-Znll -Zborrowck=mir -Zverbose
#![allow(warnings)]
#![feature(conservative_impl_trait)]
use std::fmt::Debug;

View File

@ -1,17 +1,17 @@
warning: not reporting region error due to -Znll
--> $DIR/impl-trait-outlives.rs:18:35
--> $DIR/impl-trait-outlives.rs:17:35
|
LL | fn no_region<'a, T>(x: Box<T>) -> impl Debug + 'a
| ^^^^^^^^^^^^^^^
warning: not reporting region error due to -Znll
--> $DIR/impl-trait-outlives.rs:34:42
--> $DIR/impl-trait-outlives.rs:33:42
|
LL | fn wrong_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
| ^^^^^^^^^^^^^^^
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/impl-trait-outlives.rs:23:5
--> $DIR/impl-trait-outlives.rs:22:5
|
LL | x
| ^
@ -19,7 +19,7 @@ LL | x
= help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`...
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/impl-trait-outlives.rs:39:5
--> $DIR/impl-trait-outlives.rs:38:5
|
LL | x
| ^

@ -1 +1 @@
Subproject commit 4edd140e57cce900fa930e1439bab469f5bbce46
Subproject commit eafd09010815da43302ac947afee45b0f5219e6b