Auto merge of #122055 - compiler-errors:stabilize-atb, r=oli-obk

Stabilize associated type bounds (RFC 2289)

This PR stabilizes associated type bounds, which were laid out in [RFC 2289]. This gives us a shorthand to express nested type bounds that would otherwise need to be expressed with nested `impl Trait` or broken into several `where` clauses.

### What are we stabilizing?

We're stabilizing the associated item bounds syntax, which allows us to put bounds in associated type position within other bounds, i.e. `T: Trait<Assoc: Bounds...>`. See [RFC 2289] for motivation.

In all position, the associated type bound syntax expands into a set of two (or more) bounds, and never anything else (see "How does this differ[...]" section for more info).

Associated type bounds are stabilized in four positions:
* **`where` clauses (and APIT)** - This is equivalent to breaking up the bound into two (or more) `where` clauses. For example, `where T: Trait<Assoc: Bound>` is equivalent to `where T: Trait, <T as Trait>::Assoc: Bound`.
* **Supertraits** - Similar to above, `trait CopyIterator: Iterator<Item: Copy> {}`. This is almost equivalent to breaking up the bound into two (or more) `where` clauses; however, the bound on the associated item is implied whenever the trait is used. See #112573/#112629.
* **Associated type item bounds** - This allows constraining the *nested* rigid projections that are associated with a trait's associated types. e.g. `trait Trait { type Assoc: Trait2<Assoc2: Copy>; }`.
* **opaque item bounds (RPIT, TAIT)** - This allows constraining associated types that are associated with the opaque without having to *name* the opaque. For example, `impl Iterator<Item: Copy>` defines an iterator whose item is `Copy` without having to actually name that item bound.

The latter three are not expressible in surface Rust (though for associated type item bounds, this will change in #120752, which I don't believe should block this PR), so this does represent a slight expansion of what can be expressed in trait bounds.

### How does this differ from the RFC?

Compared to the RFC, the current implementation *always* desugars associated type bounds to sets of `ty::Clause`s internally. Specifically, it does *not* introduce a position-dependent desugaring as laid out in [RFC 2289], and in particular:
* It does *not* desugar to anonymous associated items in associated type item bounds.
* It does *not* desugar to nested RPITs in RPIT bounds, nor nested TAITs in TAIT bounds.

This position-dependent desugaring laid out in the RFC existed simply to side-step limitations of the trait solver, which have mostly been fixed in #120584. The desugaring laid out in the RFC also added unnecessary complication to the design of the feature, and introduces its own limitations to, for example:
* Conditionally lowering to nested `impl Trait` in certain positions such as RPIT and TAIT means that we inherit the limitations of RPIT/TAIT, namely lack of support for higher-ranked opaque inference. See this code example: https://github.com/rust-lang/rust/pull/120752#issuecomment-1979412531.
* Introducing anonymous associated types makes traits no longer object safe, since anonymous associated types are not nameable, and all associated types must be named in `dyn` types.

This last point motivates why this PR is *not* stabilizing support for associated type bounds in `dyn` types, e.g, `dyn Assoc<Item: Bound>`. Why? Because `dyn` types need to have *concrete* types for all associated items, this would necessitate a distinct lowering for associated type bounds, which seems both complicated and unnecessary compared to just requiring the user to write `impl Trait` themselves. See #120719.

### Implementation history:

Limited to the significant behavioral changes and fixes and relevant PRs, ping me if I left something out--
* #57428
* #108063
* #110512
* #112629
* #120719
* #120584

Closes #52662

[RFC 2289]: https://rust-lang.github.io/rfcs/2289-associated-type-bounds.html
This commit is contained in:
bors 2024-03-19 00:04:09 +00:00
commit 21d94a3d2c
95 changed files with 147 additions and 533 deletions

View File

@ -11,7 +11,7 @@
#![doc(rust_logo)]
#![allow(internal_features)]
#![feature(rustdoc_internals)]
#![feature(associated_type_bounds)]
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(associated_type_defaults)]
#![feature(box_patterns)]
#![feature(if_let_guard)]

View File

@ -463,13 +463,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
constraint.span,
"return type notation is experimental"
);
} else {
gate!(
&self,
associated_type_bounds,
constraint.span,
"associated type bounds are unstable"
);
}
}
visit::walk_assoc_constraint(self, constraint)
@ -615,7 +608,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
}
gate_all_legacy_dont_use!(trait_alias, "trait aliases are experimental");
gate_all_legacy_dont_use!(associated_type_bounds, "associated type bounds are unstable");
// Despite being a new feature, `where T: Trait<Assoc(): Sized>`, which is RTN syntax now,
// used to be gated under associated_type_bounds, which are right above, so RTN needs to
// be too.

View File

@ -4,7 +4,7 @@
#![feature(rustdoc_internals)]
#![doc(rust_logo)]
#![feature(assert_matches)]
#![feature(associated_type_bounds)]
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(box_patterns)]
#![feature(control_flow_enum)]
#![feature(let_chains)]

View File

@ -19,11 +19,11 @@
#![feature(
rustc_private,
decl_macro,
associated_type_bounds,
never_type,
trusted_len,
hash_raw_entry
)]
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![allow(broken_intra_doc_links)]
#![recursion_limit = "256"]
#![warn(rust_2018_idioms)]

View File

@ -4,7 +4,7 @@
#![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![feature(associated_type_bounds)]
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(box_patterns)]
#![feature(if_let_guard)]
#![feature(let_chains)]

View File

@ -3,8 +3,6 @@ An associated type value was specified more than once.
Erroneous code example:
```compile_fail,E0719
#![feature(associated_type_bounds)]
trait FooTrait {}
trait BarTrait {}
@ -19,8 +17,6 @@ specify the associated type with the new trait.
Corrected example:
```
#![feature(associated_type_bounds)]
trait FooTrait {}
trait BarTrait {}
trait FooBarTrait: FooTrait + BarTrait {}

View File

@ -1,7 +1,7 @@
#![doc(rust_logo)]
#![feature(rustdoc_internals)]
#![feature(array_windows)]
#![feature(associated_type_bounds)]
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(associated_type_defaults)]
#![feature(if_let_guard)]
#![feature(let_chains)]

View File

@ -59,6 +59,8 @@ declare_features! (
(accepted, asm_sym, "1.66.0", Some(93333)),
/// Allows the definition of associated constants in `trait` or `impl` blocks.
(accepted, associated_consts, "1.20.0", Some(29646)),
/// Allows the user of associated type bounds.
(accepted, associated_type_bounds, "CURRENT_RUSTC_VERSION", Some(52662)),
/// Allows using associated `type`s in `trait`s.
(accepted, associated_types, "1.0.0", None),
/// Allows free and inherent `async fn`s, `async` blocks, and `<expr>.await` expressions.

View File

@ -351,8 +351,6 @@ declare_features! (
(unstable, asm_unwind, "1.58.0", Some(93334)),
/// Allows users to enforce equality of associated constants `TraitImpl<AssocConst=3>`.
(unstable, associated_const_equality, "1.58.0", Some(92827)),
/// Allows the user of associated type bounds.
(unstable, associated_type_bounds, "1.34.0", Some(52662)),
/// Allows associated type defaults.
(unstable, associated_type_defaults, "1.2.0", Some(29661)),
/// Allows `async || body` closures.

View File

@ -18,7 +18,7 @@
#![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![feature(associated_type_bounds)]
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(box_patterns)]
#![feature(control_flow_enum)]
#![feature(extend_one)]

View File

@ -48,7 +48,7 @@
#![feature(trusted_len)]
#![feature(type_alias_impl_trait)]
#![feature(strict_provenance)]
#![feature(associated_type_bounds)]
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(rustc_attrs)]
#![feature(control_flow_enum)]
#![feature(trait_upcasting)]

View File

@ -5,7 +5,7 @@
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![feature(assert_matches)]
#![feature(associated_type_bounds)]
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(box_patterns)]
#![feature(if_let_guard)]
#![feature(let_chains)]

View File

@ -731,8 +731,6 @@ impl<'a> Parser<'a> {
&& matches!(args.output, ast::FnRetTy::Default(..))
{
self.psess.gated_spans.gate(sym::return_type_notation, span);
} else {
self.psess.gated_spans.gate(sym::associated_type_bounds, span);
}
}
let constraint =

View File

@ -8,7 +8,7 @@
#![doc(rust_logo)]
#![allow(internal_features)]
#![feature(rustdoc_internals)]
#![feature(associated_type_bounds)]
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(const_option)]
#![feature(core_intrinsics)]
#![feature(generic_nonzero)]

View File

@ -17,7 +17,7 @@
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![feature(assert_matches)]
#![feature(associated_type_bounds)]
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(associated_type_defaults)]
#![feature(box_patterns)]
#![feature(control_flow_enum)]

View File

@ -194,8 +194,7 @@ pub fn suggest_restriction<'tcx, G: EmissionGuarantee>(
sugg.extend(ty_spans.into_iter().map(|s| (s, type_param_name.to_string())));
// Suggest `fn foo<T: Trait>(t: T) where <T as Trait>::A: Bound`.
// FIXME: once `#![feature(associated_type_bounds)]` is stabilized, we should suggest
// `fn foo(t: impl Trait<A: Bound>)` instead.
// FIXME: we should suggest `fn foo(t: impl Trait<A: Bound>)` instead.
err.multipart_suggestion(
"introduce a type parameter with a trait bound instead of using `impl Trait`",
sugg,

View File

@ -173,12 +173,12 @@
//
// Language features:
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![cfg_attr(not(test), feature(coroutine_trait))]
#![cfg_attr(test, feature(panic_update_hook))]
#![cfg_attr(test, feature(test))]
#![feature(allocator_internals)]
#![feature(allow_internal_unstable)]
#![feature(associated_type_bounds)]
#![feature(c_unwind)]
#![feature(cfg_sanitize)]
#![feature(const_mut_refs)]

View File

@ -1,3 +1,4 @@
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(allocator_api)]
#![feature(alloc_layout_extra)]
#![feature(iter_array_chunks)]
@ -22,7 +23,6 @@
#![feature(try_reserve_kind)]
#![feature(try_with_capacity)]
#![feature(unboxed_closures)]
#![feature(associated_type_bounds)]
#![feature(binary_heap_into_iter_sorted)]
#![feature(binary_heap_drain_sorted)]
#![feature(slice_ptr_get)]

View File

@ -203,6 +203,7 @@
//
// Language features:
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![cfg_attr(bootstrap, feature(diagnostic_namespace))]
#![cfg_attr(bootstrap, feature(exhaustive_patterns))]
#![cfg_attr(bootstrap, feature(platform_intrinsics))]
@ -213,7 +214,6 @@
#![feature(allow_internal_unsafe)]
#![feature(allow_internal_unstable)]
#![feature(asm_const)]
#![feature(associated_type_bounds)]
#![feature(auto_traits)]
#![feature(c_unwind)]
#![feature(cfg_sanitize)]

View File

@ -1,7 +1,6 @@
//@ check-pass
#![crate_type="lib"]
#![feature(associated_type_bounds)]
trait A<'a> {}
trait B<'b> {}

View File

@ -6,7 +6,6 @@ fn e() {
//~| ERROR cannot find value
//~| ERROR associated const equality
//~| ERROR cannot find trait `p` in this scope
//~| ERROR associated type bounds
}
fn main() {}

View File

@ -26,17 +26,7 @@ LL | type_ascribe!(p, a<p:p<e=6>>);
= help: add `#![feature(associated_const_equality)]` 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[E0658]: associated type bounds are unstable
--> $DIR/issue-93835.rs:4:24
|
LL | type_ascribe!(p, a<p:p<e=6>>);
| ^^^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` 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 5 previous errors
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0405, E0412, E0425, E0658.
For more information about an error, try `rustc --explain E0405`.

View File

@ -1,7 +1,5 @@
//@ check-pass
#![feature(associated_type_bounds)]
pub struct Flatten<I>
where
I: Iterator<Item: IntoIterator>,

View File

@ -8,8 +8,6 @@
// Additionally, as reported in https://github.com/rust-lang/rust/issues/63594,
// we check that the spans for the error message are sane here.
#![feature(associated_type_bounds)]
fn main() {}
trait Bar {

View File

@ -1,5 +1,5 @@
error: associated type bounds are not allowed in `dyn` types
--> $DIR/assoc-type-eq-with-dyn-atb-fail.rs:30:28
--> $DIR/assoc-type-eq-with-dyn-atb-fail.rs:28:28
|
LL | type Out = Box<dyn Bar<Assoc: Copy>>;
| ^^^^^^^^^^^

View File

@ -1,7 +1,5 @@
//@ check-pass
#![feature(associated_type_bounds)]
use std::fmt::Debug;
use std::iter::Once;

View File

@ -1,5 +1,3 @@
#![feature(associated_type_bounds)]
trait B {
type AssocType;
}

View File

@ -1,5 +1,5 @@
error: associated type bounds are not allowed in `dyn` types
--> $DIR/bad-universal-in-dyn-in-where-clause.rs:9:19
--> $DIR/bad-universal-in-dyn-in-where-clause.rs:7:19
|
LL | dyn for<'j> B<AssocType: 'j>:,
| ^^^^^^^^^^^^^

View File

@ -1,5 +1,3 @@
#![feature(associated_type_bounds)]
trait Trait {
type Item;
}

View File

@ -1,5 +1,5 @@
error: associated type bounds are not allowed in `dyn` types
--> $DIR/bad-universal-in-impl-sig.rs:10:16
--> $DIR/bad-universal-in-impl-sig.rs:8:16
|
LL | impl dyn Trait<Item: Trait2> {}
| ^^^^^^^^^^^^

View File

@ -1,7 +1,5 @@
//@ check-pass
#![feature(associated_type_bounds)]
use std::fmt::Debug;
use std::iter::Empty;
use std::ops::Range;

View File

@ -1,5 +1,3 @@
#![feature(associated_type_bounds)]
pub fn accept(_: impl Trait<K: Copy>) {}
//~^ ERROR expected type, found constant

View File

@ -1,5 +1,5 @@
error: expected type, found constant
--> $DIR/consts.rs:3:29
--> $DIR/consts.rs:1:29
|
LL | pub fn accept(_: impl Trait<K: Copy>) {}
| ^------ bounds are not allowed on associated constants
@ -7,7 +7,7 @@ LL | pub fn accept(_: impl Trait<K: Copy>) {}
| unexpected constant
|
note: the associated constant is defined here
--> $DIR/consts.rs:7:5
--> $DIR/consts.rs:5:5
|
LL | const K: i32;
| ^^^^^^^^^^^^

View File

@ -1,4 +1,3 @@
#![feature(associated_type_bounds)]
#![feature(type_alias_impl_trait)]
use std::iter;

View File

@ -1,5 +1,5 @@
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:7:36
--> $DIR/duplicate.rs:6:36
|
LL | struct SI1<T: Iterator<Item: Copy, Item: Send>> {
| ---------- ^^^^^^^^^^ re-bound here
@ -7,7 +7,7 @@ LL | struct SI1<T: Iterator<Item: Copy, Item: Send>> {
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:11:36
--> $DIR/duplicate.rs:10:36
|
LL | struct SI2<T: Iterator<Item: Copy, Item: Copy>> {
| ---------- ^^^^^^^^^^ re-bound here
@ -15,7 +15,7 @@ LL | struct SI2<T: Iterator<Item: Copy, Item: Copy>> {
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:15:39
--> $DIR/duplicate.rs:14:39
|
LL | struct SI3<T: Iterator<Item: 'static, Item: 'static>> {
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -23,7 +23,7 @@ LL | struct SI3<T: Iterator<Item: 'static, Item: 'static>> {
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:21:29
--> $DIR/duplicate.rs:20:29
|
LL | T: Iterator<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
@ -31,7 +31,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:28:29
--> $DIR/duplicate.rs:27:29
|
LL | T: Iterator<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
@ -39,7 +39,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:35:32
--> $DIR/duplicate.rs:34:32
|
LL | T: Iterator<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -47,7 +47,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:41:34
--> $DIR/duplicate.rs:40:34
|
LL | enum EI1<T: Iterator<Item: Copy, Item: Send>> {
| ---------- ^^^^^^^^^^ re-bound here
@ -55,7 +55,7 @@ LL | enum EI1<T: Iterator<Item: Copy, Item: Send>> {
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:45:34
--> $DIR/duplicate.rs:44:34
|
LL | enum EI2<T: Iterator<Item: Copy, Item: Copy>> {
| ---------- ^^^^^^^^^^ re-bound here
@ -63,7 +63,7 @@ LL | enum EI2<T: Iterator<Item: Copy, Item: Copy>> {
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:49:37
--> $DIR/duplicate.rs:48:37
|
LL | enum EI3<T: Iterator<Item: 'static, Item: 'static>> {
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -71,7 +71,7 @@ LL | enum EI3<T: Iterator<Item: 'static, Item: 'static>> {
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:55:29
--> $DIR/duplicate.rs:54:29
|
LL | T: Iterator<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
@ -79,7 +79,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:62:29
--> $DIR/duplicate.rs:61:29
|
LL | T: Iterator<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
@ -87,7 +87,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:69:32
--> $DIR/duplicate.rs:68:32
|
LL | T: Iterator<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -95,7 +95,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:75:35
--> $DIR/duplicate.rs:74:35
|
LL | union UI1<T: Iterator<Item: Copy, Item: Send>> {
| ---------- ^^^^^^^^^^ re-bound here
@ -103,7 +103,7 @@ LL | union UI1<T: Iterator<Item: Copy, Item: Send>> {
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:79:35
--> $DIR/duplicate.rs:78:35
|
LL | union UI2<T: Iterator<Item: Copy, Item: Copy>> {
| ---------- ^^^^^^^^^^ re-bound here
@ -111,7 +111,7 @@ LL | union UI2<T: Iterator<Item: Copy, Item: Copy>> {
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:83:38
--> $DIR/duplicate.rs:82:38
|
LL | union UI3<T: Iterator<Item: 'static, Item: 'static>> {
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -119,7 +119,7 @@ LL | union UI3<T: Iterator<Item: 'static, Item: 'static>> {
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:89:29
--> $DIR/duplicate.rs:88:29
|
LL | T: Iterator<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
@ -127,7 +127,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:96:29
--> $DIR/duplicate.rs:95:29
|
LL | T: Iterator<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
@ -135,7 +135,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:103:32
--> $DIR/duplicate.rs:102:32
|
LL | T: Iterator<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -143,7 +143,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:109:32
--> $DIR/duplicate.rs:108:32
|
LL | fn FI1<T: Iterator<Item: Copy, Item: Send>>() {}
| ---------- ^^^^^^^^^^ re-bound here
@ -151,7 +151,7 @@ LL | fn FI1<T: Iterator<Item: Copy, Item: Send>>() {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:111:32
--> $DIR/duplicate.rs:110:32
|
LL | fn FI2<T: Iterator<Item: Copy, Item: Copy>>() {}
| ---------- ^^^^^^^^^^ re-bound here
@ -159,7 +159,7 @@ LL | fn FI2<T: Iterator<Item: Copy, Item: Copy>>() {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:113:35
--> $DIR/duplicate.rs:112:35
|
LL | fn FI3<T: Iterator<Item: 'static, Item: 'static>>() {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -167,7 +167,7 @@ LL | fn FI3<T: Iterator<Item: 'static, Item: 'static>>() {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:117:29
--> $DIR/duplicate.rs:116:29
|
LL | T: Iterator<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
@ -175,7 +175,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:123:29
--> $DIR/duplicate.rs:122:29
|
LL | T: Iterator<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
@ -183,7 +183,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:129:32
--> $DIR/duplicate.rs:128:32
|
LL | T: Iterator<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -191,7 +191,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:134:42
--> $DIR/duplicate.rs:133:42
|
LL | fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> {
| ---------- ^^^^^^^^^^ re-bound here
@ -199,7 +199,7 @@ LL | fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> {
| `Item` bound here first
error[E0282]: type annotations needed
--> $DIR/duplicate.rs:136:5
--> $DIR/duplicate.rs:135:5
|
LL | iter::empty()
| ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty`
@ -210,7 +210,7 @@ LL | iter::empty::<T>()
| +++++
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:139:42
--> $DIR/duplicate.rs:138:42
|
LL | fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> {
| ---------- ^^^^^^^^^^ re-bound here
@ -218,7 +218,7 @@ LL | fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> {
| `Item` bound here first
error[E0282]: type annotations needed
--> $DIR/duplicate.rs:141:5
--> $DIR/duplicate.rs:140:5
|
LL | iter::empty()
| ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty`
@ -229,7 +229,7 @@ LL | iter::empty::<T>()
| +++++
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:144:45
--> $DIR/duplicate.rs:143:45
|
LL | fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> {
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -237,7 +237,7 @@ LL | fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> {
| `Item` bound here first
error[E0282]: type annotations needed
--> $DIR/duplicate.rs:146:5
--> $DIR/duplicate.rs:145:5
|
LL | iter::empty()
| ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty`
@ -248,7 +248,7 @@ LL | iter::empty::<T>()
| +++++
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:149:40
--> $DIR/duplicate.rs:148:40
|
LL | fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {}
| ---------- ^^^^^^^^^^ re-bound here
@ -256,7 +256,7 @@ LL | fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:151:40
--> $DIR/duplicate.rs:150:40
|
LL | fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {}
| ---------- ^^^^^^^^^^ re-bound here
@ -264,7 +264,7 @@ LL | fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:153:43
--> $DIR/duplicate.rs:152:43
|
LL | fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -272,7 +272,7 @@ LL | fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:156:35
--> $DIR/duplicate.rs:155:35
|
LL | type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
| ---------- ^^^^^^^^^^ re-bound here
@ -280,7 +280,7 @@ LL | type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:158:35
--> $DIR/duplicate.rs:157:35
|
LL | type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T;
| ---------- ^^^^^^^^^^ re-bound here
@ -288,7 +288,7 @@ LL | type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:160:38
--> $DIR/duplicate.rs:159:38
|
LL | type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -296,7 +296,7 @@ LL | type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:164:29
--> $DIR/duplicate.rs:163:29
|
LL | T: Iterator<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
@ -304,7 +304,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:169:29
--> $DIR/duplicate.rs:168:29
|
LL | T: Iterator<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
@ -312,7 +312,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:174:32
--> $DIR/duplicate.rs:173:32
|
LL | T: Iterator<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -320,7 +320,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:178:36
--> $DIR/duplicate.rs:177:36
|
LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
| ---------- ^^^^^^^^^^ re-bound here
@ -328,7 +328,7 @@ LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:180:36
--> $DIR/duplicate.rs:179:36
|
LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
| ---------- ^^^^^^^^^^ re-bound here
@ -336,7 +336,7 @@ LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:182:39
--> $DIR/duplicate.rs:181:39
|
LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -344,7 +344,7 @@ LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:184:40
--> $DIR/duplicate.rs:183:40
|
LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ re-bound here
@ -352,7 +352,7 @@ LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:186:40
--> $DIR/duplicate.rs:185:40
|
LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
| ---------- ^^^^^^^^^^ re-bound here
@ -360,7 +360,7 @@ LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:188:43
--> $DIR/duplicate.rs:187:43
|
LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -368,7 +368,7 @@ LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:191:36
--> $DIR/duplicate.rs:190:36
|
LL | trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -376,7 +376,7 @@ LL | trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:193:36
--> $DIR/duplicate.rs:192:36
|
LL | trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -384,7 +384,7 @@ LL | trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:195:39
--> $DIR/duplicate.rs:194:39
|
LL | trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -392,7 +392,7 @@ LL | trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:197:34
--> $DIR/duplicate.rs:196:34
|
LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -400,7 +400,7 @@ LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:197:34
--> $DIR/duplicate.rs:196:34
|
LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -410,7 +410,7 @@ LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:197:34
--> $DIR/duplicate.rs:196:34
|
LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -420,7 +420,7 @@ LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:201:34
--> $DIR/duplicate.rs:200:34
|
LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -428,7 +428,7 @@ LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:201:34
--> $DIR/duplicate.rs:200:34
|
LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -438,7 +438,7 @@ LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:201:34
--> $DIR/duplicate.rs:200:34
|
LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -448,7 +448,7 @@ LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:205:37
--> $DIR/duplicate.rs:204:37
|
LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -456,7 +456,7 @@ LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:205:37
--> $DIR/duplicate.rs:204:37
|
LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -466,7 +466,7 @@ LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:205:37
--> $DIR/duplicate.rs:204:37
|
LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -476,7 +476,7 @@ LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:211:29
--> $DIR/duplicate.rs:210:29
|
LL | T: Iterator<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
@ -484,7 +484,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:217:29
--> $DIR/duplicate.rs:216:29
|
LL | T: Iterator<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
@ -492,7 +492,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:223:32
--> $DIR/duplicate.rs:222:32
|
LL | T: Iterator<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -500,7 +500,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:229:32
--> $DIR/duplicate.rs:228:32
|
LL | Self: Iterator<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
@ -508,7 +508,7 @@ LL | Self: Iterator<Item: Copy, Item: Send>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:229:32
--> $DIR/duplicate.rs:228:32
|
LL | Self: Iterator<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
@ -518,7 +518,7 @@ LL | Self: Iterator<Item: Copy, Item: Send>,
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:229:32
--> $DIR/duplicate.rs:228:32
|
LL | Self: Iterator<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
@ -528,7 +528,7 @@ LL | Self: Iterator<Item: Copy, Item: Send>,
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:237:32
--> $DIR/duplicate.rs:236:32
|
LL | Self: Iterator<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
@ -536,7 +536,7 @@ LL | Self: Iterator<Item: Copy, Item: Copy>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:237:32
--> $DIR/duplicate.rs:236:32
|
LL | Self: Iterator<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
@ -546,7 +546,7 @@ LL | Self: Iterator<Item: Copy, Item: Copy>,
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:237:32
--> $DIR/duplicate.rs:236:32
|
LL | Self: Iterator<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
@ -556,7 +556,7 @@ LL | Self: Iterator<Item: Copy, Item: Copy>,
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:245:35
--> $DIR/duplicate.rs:244:35
|
LL | Self: Iterator<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -564,7 +564,7 @@ LL | Self: Iterator<Item: 'static, Item: 'static>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:245:35
--> $DIR/duplicate.rs:244:35
|
LL | Self: Iterator<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -574,7 +574,7 @@ LL | Self: Iterator<Item: 'static, Item: 'static>,
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:245:35
--> $DIR/duplicate.rs:244:35
|
LL | Self: Iterator<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -584,7 +584,7 @@ LL | Self: Iterator<Item: 'static, Item: 'static>,
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:252:34
--> $DIR/duplicate.rs:251:34
|
LL | type A: Iterator<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ re-bound here
@ -592,7 +592,7 @@ LL | type A: Iterator<Item: Copy, Item: Send>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:256:34
--> $DIR/duplicate.rs:255:34
|
LL | type A: Iterator<Item: Copy, Item: Copy>;
| ---------- ^^^^^^^^^^ re-bound here
@ -600,7 +600,7 @@ LL | type A: Iterator<Item: Copy, Item: Copy>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:260:37
--> $DIR/duplicate.rs:259:37
|
LL | type A: Iterator<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ re-bound here

View File

@ -1,4 +1,3 @@
#![feature(associated_type_bounds)]
#![feature(anonymous_lifetime_in_impl_trait)]
// The same thing should happen for constraints in dyn trait.

View File

@ -1,5 +1,5 @@
error[E0106]: missing lifetime specifier
--> $DIR/elision.rs:5:70
--> $DIR/elision.rs:4:70
|
LL | fn f(x: &mut dyn Iterator<Item: Iterator<Item = &'_ ()>>) -> Option<&'_ ()> { x.next() }
| ------------------------------------------------ ^^ expected named lifetime parameter
@ -11,7 +11,7 @@ LL | fn f<'a>(x: &'a mut dyn Iterator<Item: Iterator<Item = &'a ()>>) -> Option<
| ++++ ++ ~~ ~~
error: associated type bounds are not allowed in `dyn` types
--> $DIR/elision.rs:5:27
--> $DIR/elision.rs:4:27
|
LL | fn f(x: &mut dyn Iterator<Item: Iterator<Item = &'_ ()>>) -> Option<&'_ ()> { x.next() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,7 +1,5 @@
//@ build-pass (FIXME(62277): could be check-pass?)
#![feature(associated_type_bounds)]
trait Tr1: Sized { type As1; }
trait Tr2<'a>: Sized { type As2; }

View File

@ -1,6 +1,5 @@
//@ run-pass
#![feature(associated_type_bounds)]
#![allow(dead_code)]
trait Tr1 { type As1; }

View File

@ -2,8 +2,6 @@
//@ aux-build:fn-aux.rs
#![allow(unused)]
#![feature(associated_type_bounds)]
extern crate fn_aux;
use fn_aux::*;

View File

@ -1,8 +1,6 @@
//@ run-pass
//@ aux-build:fn-aux.rs
#![feature(associated_type_bounds)]
extern crate fn_aux;
use fn_aux::*;

View File

@ -2,8 +2,6 @@
//@ aux-build:fn-aux.rs
#![allow(unused)]
#![feature(associated_type_bounds)]
extern crate fn_aux;
use fn_aux::*;

View File

@ -2,8 +2,6 @@
//@ aux-build:fn-aux.rs
#![allow(unused)]
#![feature(associated_type_bounds)]
extern crate fn_aux;
use fn_aux::*;

View File

@ -1,7 +1,6 @@
//@ run-pass
//@ aux-build:fn-aux.rs
#![feature(associated_type_bounds)]
#![allow(dead_code)]
extern crate fn_aux;

View File

@ -1,7 +1,5 @@
//@ check-pass
#![feature(associated_type_bounds)]
trait A<'a> {
type Assoc: ?Sized;
}

View File

@ -1,7 +1,5 @@
//@ check-pass
#![feature(associated_type_bounds)]
trait A<'a> {}
trait B<'b> {}
fn foo<T>()

View File

@ -1,5 +1,3 @@
#![feature(associated_type_bounds)]
trait A {
type T;
}

View File

@ -1,12 +1,12 @@
error[E0391]: cycle detected when computing the implied predicates of `B`
--> $DIR/implied-bounds-cycle.rs:7:15
--> $DIR/implied-bounds-cycle.rs:5:15
|
LL | trait B: A<T: B> {}
| ^
|
= note: ...which immediately requires computing the implied predicates of `B` again
note: cycle used when computing normalized predicates of `B`
--> $DIR/implied-bounds-cycle.rs:7:1
--> $DIR/implied-bounds-cycle.rs:5:1
|
LL | trait B: A<T: B> {}
| ^^^^^^^^^^^^^^^^

View File

@ -1,7 +1,5 @@
//@ check-pass
#![feature(associated_type_bounds)]
trait Trait: Super<Assoc: Bound> {}
trait Super {

View File

@ -1,5 +1,3 @@
#![feature(associated_type_bounds)]
trait Tr1 { type As1; }
trait Tr2 { type As2; }

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/implied-region-constraints.rs:17:56
--> $DIR/implied-region-constraints.rs:15:56
|
LL | fn _bad_st<'a, 'b, T>(x: St<'a, 'b, T>)
| -- -- lifetime `'b` defined here
@ -12,7 +12,7 @@ LL | let _failure_proves_not_implied_outlives_region_b: &'b T = &x.f0;
= help: consider adding the following bound: `'a: 'b`
error: lifetime may not live long enough
--> $DIR/implied-region-constraints.rs:38:64
--> $DIR/implied-region-constraints.rs:36:64
|
LL | fn _bad_en7<'a, 'b, T>(x: En7<'a, 'b, T>)
| -- -- lifetime `'b` defined here

View File

@ -1,5 +1,3 @@
#![feature(associated_type_bounds)]
use std::mem::ManuallyDrop;
struct S1 { f: dyn Iterator<Item: Copy> }

View File

@ -1,53 +1,53 @@
error: associated type bounds are not allowed in `dyn` types
--> $DIR/inside-adt.rs:5:29
--> $DIR/inside-adt.rs:3:29
|
LL | struct S1 { f: dyn Iterator<Item: Copy> }
| ^^^^^^^^^^
error: associated type bounds are not allowed in `dyn` types
--> $DIR/inside-adt.rs:7:33
--> $DIR/inside-adt.rs:5:33
|
LL | struct S2 { f: Box<dyn Iterator<Item: Copy>> }
| ^^^^^^^^^^
error: associated type bounds are not allowed in `dyn` types
--> $DIR/inside-adt.rs:9:29
--> $DIR/inside-adt.rs:7:29
|
LL | struct S3 { f: dyn Iterator<Item: 'static> }
| ^^^^^^^^^^^^^
error: associated type bounds are not allowed in `dyn` types
--> $DIR/inside-adt.rs:12:26
--> $DIR/inside-adt.rs:10:26
|
LL | enum E1 { V(dyn Iterator<Item: Copy>) }
| ^^^^^^^^^^
error: associated type bounds are not allowed in `dyn` types
--> $DIR/inside-adt.rs:14:30
--> $DIR/inside-adt.rs:12:30
|
LL | enum E2 { V(Box<dyn Iterator<Item: Copy>>) }
| ^^^^^^^^^^
error: associated type bounds are not allowed in `dyn` types
--> $DIR/inside-adt.rs:16:26
--> $DIR/inside-adt.rs:14:26
|
LL | enum E3 { V(dyn Iterator<Item: 'static>) }
| ^^^^^^^^^^^^^
error: associated type bounds are not allowed in `dyn` types
--> $DIR/inside-adt.rs:19:41
--> $DIR/inside-adt.rs:17:41
|
LL | union U1 { f: ManuallyDrop<dyn Iterator<Item: Copy>> }
| ^^^^^^^^^^
error: associated type bounds are not allowed in `dyn` types
--> $DIR/inside-adt.rs:21:45
--> $DIR/inside-adt.rs:19:45
|
LL | union U2 { f: ManuallyDrop<Box<dyn Iterator<Item: Copy>>> }
| ^^^^^^^^^^
error: associated type bounds are not allowed in `dyn` types
--> $DIR/inside-adt.rs:23:41
--> $DIR/inside-adt.rs:21:41
|
LL | union U3 { f: ManuallyDrop<dyn Iterator<Item: 'static>> }
| ^^^^^^^^^^^^^

View File

@ -1,5 +1,3 @@
#![feature(associated_type_bounds)]
trait B {
type AssocType;
}

View File

@ -1,5 +1,5 @@
error: associated type bounds are not allowed in `dyn` types
--> $DIR/issue-104916.rs:9:19
--> $DIR/issue-104916.rs:7:19
|
LL | dyn for<'j> B<AssocType: 'j>:,
| ^^^^^^^^^^^^^

View File

@ -1,7 +1,5 @@
//@ check-pass
#![feature(associated_type_bounds)]
trait Foo {
type Bar;
}

View File

@ -1,7 +1,5 @@
//@ check-pass
#![feature(associated_type_bounds)]
fn foo<F>(_: F)
where
F: for<'a> Trait<Output: 'a>,

View File

@ -1,5 +1,3 @@
#![feature(associated_type_bounds)]
struct Incorrect;
fn hello<F: for<'a> Iterator<Item: 'a>>() {

View File

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-71443-1.rs:6:5
--> $DIR/issue-71443-1.rs:4:5
|
LL | fn hello<F: for<'a> Iterator<Item: 'a>>() {
| - help: try adding a return type: `-> Incorrect`

View File

@ -1,7 +1,5 @@
//@ check-pass
#![feature(associated_type_bounds)]
fn hello<'b, F>()
where
for<'a> F: Iterator<Item: 'a> + 'b,

View File

@ -1,8 +1,6 @@
//@ check-pass
#![allow(incomplete_features)]
#![feature(associated_type_bounds)]
trait MP {
type T<'a>;
}

View File

@ -1,7 +1,5 @@
//@ check-pass
#![feature(associated_type_bounds)]
trait A<'a, 'b> {}
trait B<'a, 'b, 'c> {}

View File

@ -1,7 +1,5 @@
//@ check-pass
#![feature(associated_type_bounds)]
trait TraitA<'a> {
type AsA;
}

View File

@ -1,7 +1,5 @@
//@ check-pass
#![feature(associated_type_bounds)]
trait Trait1 {
type Assoc1: Bar;

View File

@ -1,5 +1,3 @@
#![feature(associated_type_bounds)]
// Test for <https://github.com/rust-lang/rust/issues/119857>.
pub trait Iter {

View File

@ -1,5 +1,5 @@
error[E0229]: associated type bindings are not allowed here
--> $DIR/no-gat-position.rs:8:56
--> $DIR/no-gat-position.rs:6:56
|
LL | fn next<'a>(&'a mut self) -> Option<Self::Item<'a, As1: Copy>>;
| ^^^^^^^^^ associated type not allowed here

View File

@ -1,5 +1,4 @@
#![allow(bare_trait_objects)]
#![feature(associated_type_bounds)]
trait Item {
type Core;
}

View File

@ -1,11 +1,11 @@
error[E0191]: the value of the associated types `Item` and `IntoIter` in `IntoIterator` must be specified
--> $DIR/overlaping-bound-suggestion.rs:7:13
--> $DIR/overlaping-bound-suggestion.rs:6:13
|
LL | inner: <IntoIterator<Item: IntoIterator<Item: >>::IntoIterator as Item>::Core,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: specify the associated types: `IntoIterator<Item: IntoIterator<Item: >, Item = Type, IntoIter = Type>`
error[E0223]: ambiguous associated type
--> $DIR/overlaping-bound-suggestion.rs:7:13
--> $DIR/overlaping-bound-suggestion.rs:6:13
|
LL | inner: <IntoIterator<Item: IntoIterator<Item: >>::IntoIterator as Item>::Core,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -9,11 +9,9 @@ trait Trait {
fn foo<T: Trait<method(i32): Send>>() {}
//~^ ERROR argument types not allowed with return type notation
//~| ERROR associated type bounds are unstable
fn bar<T: Trait<method() -> (): Send>>() {}
//~^ ERROR return type not allowed with return type notation
//~| ERROR associated type bounds are unstable
fn baz<T: Trait<method(..): Send>>() {}
//~^ ERROR return type notation uses `()` instead of `(..)` for elided arguments

View File

@ -1,29 +1,9 @@
error: return type notation uses `()` instead of `(..)` for elided arguments
--> $DIR/bad-inputs-and-output.rs:18:24
--> $DIR/bad-inputs-and-output.rs:16:24
|
LL | fn baz<T: Trait<method(..): Send>>() {}
| ^^ help: remove the `..`
error[E0658]: associated type bounds are unstable
--> $DIR/bad-inputs-and-output.rs:10:17
|
LL | fn foo<T: Trait<method(i32): Send>>() {}
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` 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[E0658]: associated type bounds are unstable
--> $DIR/bad-inputs-and-output.rs:14:17
|
LL | fn bar<T: Trait<method() -> (): Send>>() {}
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bad-inputs-and-output.rs:3:12
|
@ -40,11 +20,10 @@ LL | fn foo<T: Trait<method(i32): Send>>() {}
| ^^^^^ help: remove the input types: `()`
error: return type not allowed with return type notation
--> $DIR/bad-inputs-and-output.rs:14:25
--> $DIR/bad-inputs-and-output.rs:13:25
|
LL | fn bar<T: Trait<method() -> (): Send>>() {}
| ^^^^^^ help: remove the return type
error: aborting due to 5 previous errors; 1 warning emitted
error: aborting due to 3 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,11 +1,14 @@
//@ edition: 2021
//@ compile-flags: -Zunpretty=expanded
//@ check-pass
// NOTE: This is not considered RTN syntax currently.
// This is simply parenthesized generics.
trait Trait {
async fn method() {}
}
fn foo<T: Trait<method(i32): Send>>() {}
//~^ ERROR associated type bounds are unstable
fn main() {}

View File

@ -1,13 +0,0 @@
error[E0658]: associated type bounds are unstable
--> $DIR/unpretty-parenthesized.rs:8:17
|
LL | fn foo<T: Trait<method(i32): Send>>() {}
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` 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
For more information about this error, try `rustc --explain E0658`.

View File

@ -5,6 +5,10 @@ use std::prelude::rust_2021::*;
extern crate std;
//@ edition: 2021
//@ compile-flags: -Zunpretty=expanded
//@ check-pass
// NOTE: This is not considered RTN syntax currently.
// This is simply parenthesized generics.
trait Trait {
async fn method() {}

View File

@ -1,7 +1,5 @@
//@ run-pass
#![feature(associated_type_bounds)]
use std::ops::Add;
trait Tr1 { type As1; fn mk(self) -> Self::As1; }

View File

@ -1,5 +1,5 @@
warning: method `tr2` is never used
--> $DIR/rpit.rs:8:20
--> $DIR/rpit.rs:6:20
|
LL | trait Tr2<'a> { fn tr2(self) -> &'a Self; }
| --- ^^^

View File

@ -1,8 +1,6 @@
//@ run-pass
#![allow(unused)]
#![feature(associated_type_bounds)]
trait Tr1 { type As1; }
trait Tr2 { type As2; }
trait Tr3 {}

View File

@ -3,8 +3,6 @@
// Make sure that we don't look into associated type bounds when looking for
// supertraits that define an associated type. Fixes #76593.
#![feature(associated_type_bounds)]
trait Load: Sized {
type Blob;
}

View File

@ -1,7 +1,6 @@
//@ run-pass
#![allow(dead_code)]
#![feature(associated_type_bounds)]
#![feature(type_alias_impl_trait)]
use std::ops::Add;

View File

@ -1,7 +1,5 @@
//@ build-pass (FIXME(62277): could be check-pass?)
#![feature(associated_type_bounds)]
use std::iter::Once;
use std::ops::Range;

View File

@ -1,7 +1,5 @@
//@ check-pass
#![feature(associated_type_bounds)]
type _TaWhere1<T> where T: Iterator<Item: Copy> = T; //~ WARNING type_alias_bounds
type _TaWhere2<T> where T: Iterator<Item: 'static> = T; //~ WARNING type_alias_bounds
type _TaWhere3<T> where T: Iterator<Item: 'static> = T; //~ WARNING type_alias_bounds

View File

@ -1,5 +1,5 @@
warning: where clauses are not enforced in type aliases
--> $DIR/type-alias.rs:5:25
--> $DIR/type-alias.rs:3:25
|
LL | type _TaWhere1<T> where T: Iterator<Item: Copy> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -12,7 +12,7 @@ LL + type _TaWhere1<T> = T;
|
warning: where clauses are not enforced in type aliases
--> $DIR/type-alias.rs:6:25
--> $DIR/type-alias.rs:4:25
|
LL | type _TaWhere2<T> where T: Iterator<Item: 'static> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -24,7 +24,7 @@ LL + type _TaWhere2<T> = T;
|
warning: where clauses are not enforced in type aliases
--> $DIR/type-alias.rs:7:25
--> $DIR/type-alias.rs:5:25
|
LL | type _TaWhere3<T> where T: Iterator<Item: 'static> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -36,7 +36,7 @@ LL + type _TaWhere3<T> = T;
|
warning: where clauses are not enforced in type aliases
--> $DIR/type-alias.rs:8:25
--> $DIR/type-alias.rs:6:25
|
LL | type _TaWhere4<T> where T: Iterator<Item: 'static + Copy + Send> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -48,7 +48,7 @@ LL + type _TaWhere4<T> = T;
|
warning: where clauses are not enforced in type aliases
--> $DIR/type-alias.rs:9:25
--> $DIR/type-alias.rs:7:25
|
LL | type _TaWhere5<T> where T: Iterator<Item: for<'a> Into<&'a u8>> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -60,7 +60,7 @@ LL + type _TaWhere5<T> = T;
|
warning: where clauses are not enforced in type aliases
--> $DIR/type-alias.rs:10:25
--> $DIR/type-alias.rs:8:25
|
LL | type _TaWhere6<T> where T: Iterator<Item: Iterator<Item: Copy>> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -72,7 +72,7 @@ LL + type _TaWhere6<T> = T;
|
warning: bounds on generic parameters are not enforced in type aliases
--> $DIR/type-alias.rs:12:20
--> $DIR/type-alias.rs:10:20
|
LL | type _TaInline1<T: Iterator<Item: Copy>> = T;
| ^^^^^^^^^^^^^^^^^^^^
@ -84,7 +84,7 @@ LL + type _TaInline1<T> = T;
|
warning: bounds on generic parameters are not enforced in type aliases
--> $DIR/type-alias.rs:13:20
--> $DIR/type-alias.rs:11:20
|
LL | type _TaInline2<T: Iterator<Item: 'static>> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -96,7 +96,7 @@ LL + type _TaInline2<T> = T;
|
warning: bounds on generic parameters are not enforced in type aliases
--> $DIR/type-alias.rs:14:20
--> $DIR/type-alias.rs:12:20
|
LL | type _TaInline3<T: Iterator<Item: 'static>> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -108,7 +108,7 @@ LL + type _TaInline3<T> = T;
|
warning: bounds on generic parameters are not enforced in type aliases
--> $DIR/type-alias.rs:15:20
--> $DIR/type-alias.rs:13:20
|
LL | type _TaInline4<T: Iterator<Item: 'static + Copy + Send>> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -120,7 +120,7 @@ LL + type _TaInline4<T> = T;
|
warning: bounds on generic parameters are not enforced in type aliases
--> $DIR/type-alias.rs:16:20
--> $DIR/type-alias.rs:14:20
|
LL | type _TaInline5<T: Iterator<Item: for<'a> Into<&'a u8>>> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -132,7 +132,7 @@ LL + type _TaInline5<T> = T;
|
warning: bounds on generic parameters are not enforced in type aliases
--> $DIR/type-alias.rs:17:20
--> $DIR/type-alias.rs:15:20
|
LL | type _TaInline6<T: Iterator<Item: Iterator<Item: Copy>>> = T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,7 +1,5 @@
//@ run-pass
#![feature(associated_type_bounds)]
#![allow(unused_assignments)]
trait Tr1: Copy { type As1: Copy; }

View File

@ -1,6 +1,5 @@
//@ check-pass
#![feature(associated_type_bounds)]
#![feature(impl_trait_in_assoc_type)]
fn main() {}

View File

@ -1,61 +0,0 @@
use std::mem::ManuallyDrop;
trait Tr1 { type As1: Copy; }
trait Tr2 { type As2: Copy; }
struct S1;
#[derive(Copy, Clone)]
struct S2;
impl Tr1 for S1 { type As1 = S2; }
trait _Tr3 {
type A: Iterator<Item: Copy>;
//~^ ERROR associated type bounds are unstable
type B: Iterator<Item: 'static>;
//~^ ERROR associated type bounds are unstable
}
struct _St1<T: Tr1<As1: Tr2>> {
//~^ ERROR associated type bounds are unstable
outest: T,
outer: T::As1,
inner: <T::As1 as Tr2>::As2,
}
enum _En1<T: Tr1<As1: Tr2>> {
//~^ ERROR associated type bounds are unstable
Outest(T),
Outer(T::As1),
Inner(<T::As1 as Tr2>::As2),
}
union _Un1<T: Tr1<As1: Tr2>> {
//~^ ERROR associated type bounds are unstable
outest: ManuallyDrop<T>,
outer: ManuallyDrop<T::As1>,
inner: ManuallyDrop<<T::As1 as Tr2>::As2>,
}
type _TaWhere1<T> where T: Iterator<Item: Copy> = T;
//~^ ERROR associated type bounds are unstable
fn _apit(_: impl Tr1<As1: Copy>) {}
//~^ ERROR associated type bounds are unstable
fn _rpit() -> impl Tr1<As1: Copy> { S1 }
//~^ ERROR associated type bounds are unstable
const _cdef: impl Tr1<As1: Copy> = S1;
//~^ ERROR associated type bounds are unstable
//~| ERROR `impl Trait` is not allowed in const types
static _sdef: impl Tr1<As1: Copy> = S1;
//~^ ERROR associated type bounds are unstable
//~| ERROR `impl Trait` is not allowed in static types
fn main() {
let _: impl Tr1<As1: Copy> = S1;
//~^ ERROR associated type bounds are unstable
//~| ERROR `impl Trait` is not allowed in the type of variable bindings
}

View File

@ -1,138 +0,0 @@
error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:12:22
|
LL | type A: Iterator<Item: Copy>;
| ^^^^^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` 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[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:15:22
|
LL | type B: Iterator<Item: 'static>;
| ^^^^^^^^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` 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[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:19:20
|
LL | struct _St1<T: Tr1<As1: Tr2>> {
| ^^^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` 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[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:26:18
|
LL | enum _En1<T: Tr1<As1: Tr2>> {
| ^^^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` 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[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:33:19
|
LL | union _Un1<T: Tr1<As1: Tr2>> {
| ^^^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` 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[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:40:37
|
LL | type _TaWhere1<T> where T: Iterator<Item: Copy> = T;
| ^^^^^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` 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[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:43:22
|
LL | fn _apit(_: impl Tr1<As1: Copy>) {}
| ^^^^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` 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[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:46:24
|
LL | fn _rpit() -> impl Tr1<As1: Copy> { S1 }
| ^^^^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` 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[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:49:23
|
LL | const _cdef: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` 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[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:53:24
|
LL | static _sdef: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` 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[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:58:21
|
LL | let _: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` 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[E0562]: `impl Trait` is not allowed in const types
--> $DIR/feature-gate-associated_type_bounds.rs:49:14
|
LL | const _cdef: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in static types
--> $DIR/feature-gate-associated_type_bounds.rs:53:15
|
LL | static _sdef: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in the type of variable bindings
--> $DIR/feature-gate-associated_type_bounds.rs:58:12
|
LL | let _: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error: aborting due to 14 previous errors
Some errors have detailed explanations: E0562, E0658.
For more information about an error, try `rustc --explain E0562`.

View File

@ -1,7 +1,5 @@
//@ check-pass
#![feature(associated_type_bounds)]
trait Trait {
type Type;

View File

@ -3,11 +3,7 @@
#[cfg(FALSE)]
fn syntax() {
foo::<T = u8, T: Ord, String>();
//~^ WARN associated type bounds are unstable
//~| WARN unstable syntax
foo::<T = u8, 'a, T: Ord>();
//~^ WARN associated type bounds are unstable
//~| WARN unstable syntax
}
fn main() {}

View File

@ -1,26 +0,0 @@
warning: associated type bounds are unstable
--> $DIR/constraints-before-generic-args-syntactic-pass.rs:5:19
|
LL | foo::<T = u8, T: Ord, String>();
| ^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= warning: unstable syntax can change at any point in the future, causing a hard error!
= note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
warning: associated type bounds are unstable
--> $DIR/constraints-before-generic-args-syntactic-pass.rs:8:23
|
LL | foo::<T = u8, 'a, T: Ord>();
| ^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= warning: unstable syntax can change at any point in the future, causing a hard error!
= note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
warning: 2 warnings emitted

View File

@ -3,7 +3,6 @@
#![allow(incomplete_features)]
#![feature(
associated_type_bounds,
const_trait_impl,
effects,
const_cmp,

View File

@ -1,5 +1,5 @@
error[E0277]: can't compare `()` with `()`
--> $DIR/const-impl-trait.rs:37:17
--> $DIR/const-impl-trait.rs:36:17
|
LL | assert!(cmp(&()));
| --- ^^^ no implementation for `() == ()`
@ -9,13 +9,13 @@ LL | assert!(cmp(&()));
= help: the trait `const PartialEq` is not implemented for `()`
= help: the trait `PartialEq` is implemented for `()`
note: required by a bound in `cmp`
--> $DIR/const-impl-trait.rs:14:23
--> $DIR/const-impl-trait.rs:13:23
|
LL | const fn cmp(a: &impl ~const PartialEq) -> bool {
| ^^^^^^^^^^^^^^^^ required by this bound in `cmp`
error[E0369]: binary operation `==` cannot be applied to type `&impl ~const PartialEq`
--> $DIR/const-impl-trait.rs:15:7
--> $DIR/const-impl-trait.rs:14:7
|
LL | a == a
| - ^^ - &impl ~const PartialEq

View File

@ -6,7 +6,7 @@ trait TraitA<A> {
fn foo<T: TraitB<Item = A>>(_: T) -> Self;
fn bar<T>(_: T) -> Self;
fn baz<T>(_: T) -> Self where T: TraitB, <T as TraitB>::Item: Copy;
fn bat<T: TraitB<Item: Copy>>(_: T) -> Self; //~ ERROR associated type bounds are unstable
fn bat<T: TraitB<Item: Copy>>(_: T) -> Self;
}
struct S;

View File

@ -1,13 +1,3 @@
error[E0658]: associated type bounds are unstable
--> $DIR/missing-assoc-fn.rs:9:22
|
LL | fn bat<T: TraitB<Item: Copy>>(_: T) -> Self;
| ^^^^^^^^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` 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[E0046]: not all trait items implemented, missing: `foo`, `bar`, `baz`, `bat`
--> $DIR/missing-assoc-fn.rs:14:1
|
@ -31,7 +21,6 @@ LL | impl FromIterator<()> for X {
|
= help: implement the missing item: `fn from_iter<T: IntoIterator<Item = ()>>(_: T) -> Self { todo!() }`
error: aborting due to 3 previous errors
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0046, E0658.
For more information about an error, try `rustc --explain E0046`.
For more information about this error, try `rustc --explain E0046`.

View File

@ -6,8 +6,6 @@ fn main() {
let _: Vec<A:B> = A::B;
//~^ ERROR cannot find trait `B` in this scope
//~| HELP you might have meant to write a path instead of an associated type bound
//~| ERROR associated type bounds are unstable
//~| HELP add `#![feature(associated_type_bounds)]` to the crate attributes to enable
//~| ERROR struct takes at least 1 generic argument but 0 generic arguments were supplied
//~| HELP add missing generic argument
//~| ERROR associated type bindings are not allowed here

View File

@ -9,16 +9,6 @@ help: you might have meant to write a path instead of an associated type bound
LL | let _: Vec<A::B> = A::B;
| ~~
error[E0658]: associated type bounds are unstable
--> $DIR/type-ascription-instead-of-path-in-type.rs:6:16
|
LL | let _: Vec<A:B> = A::B;
| ^^^
|
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` 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[E0107]: struct takes at least 1 generic argument but 0 generic arguments were supplied
--> $DIR/type-ascription-instead-of-path-in-type.rs:6:12
|
@ -36,7 +26,7 @@ error[E0229]: associated type bindings are not allowed here
LL | let _: Vec<A:B> = A::B;
| ^^^ associated type not allowed here
error: aborting due to 4 previous errors
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0107, E0229, E0405, E0658.
Some errors have detailed explanations: E0107, E0229, E0405.
For more information about an error, try `rustc --explain E0107`.

View File

@ -1,4 +1,4 @@
#![feature(negative_bounds, associated_type_bounds)]
#![feature(negative_bounds)]
trait Trait {
type Assoc;