Skip to content

Commit

Permalink
Remove impl trait bindings handling on const AST lowering
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Jul 18, 2021
1 parent bc106eb commit 4d2d903
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 238 deletions.
12 changes: 1 addition & 11 deletions compiler/rustc_ast_lowering/src/item.rs
Expand Up @@ -484,17 +484,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
span: Span,
body: Option<&Expr>,
) -> (&'hir hir::Ty<'hir>, hir::BodyId) {
let mut capturable_lifetimes;
let itctx = if self.sess.features_untracked().impl_trait_in_bindings {
capturable_lifetimes = FxHashSet::default();
ImplTraitContext::TypeAliasesOpaqueTy {
capturable_lifetimes: &mut capturable_lifetimes,
origin: hir::OpaqueTyOrigin::Misc,
}
} else {
ImplTraitContext::Disallowed(ImplTraitPosition::Binding)
};
let ty = self.lower_ty(ty, itctx);
let ty = self.lower_ty(ty, ImplTraitContext::Disallowed(ImplTraitPosition::Binding));
(ty, self.lower_const_body(span, body))
}

Expand Down
116 changes: 34 additions & 82 deletions src/test/ui/associated-type-bounds/duplicate.full_tait.stderr
Expand Up @@ -232,317 +232,269 @@ LL | fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:73:39
|
LL | const CIT1: impl Iterator<Item: Copy, Item: Send> = iter::empty();
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:75:39
|
LL | const CIT2: impl Iterator<Item: Copy, Item: Copy> = iter::empty();
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:77:42
|
LL | const CIT3: impl Iterator<Item: 'static, Item: 'static> = iter::empty();
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:79:40
|
LL | static SIT1: impl Iterator<Item: Copy, Item: Send> = iter::empty();
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:81:40
|
LL | static SIT2: impl Iterator<Item: Copy, Item: Copy> = iter::empty();
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:83:43
|
LL | static SIT3: impl Iterator<Item: 'static, Item: 'static> = iter::empty();
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:86:35
--> $DIR/duplicate.rs:73:35
|
LL | type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:88:35
--> $DIR/duplicate.rs:75:35
|
LL | type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T;
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:90:38
--> $DIR/duplicate.rs:77:38
|
LL | type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T;
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:92:44
--> $DIR/duplicate.rs:79:44
|
LL | type TAW1<T> where T: Iterator<Item: Copy, Item: Send> = T;
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:94:44
--> $DIR/duplicate.rs:81:44
|
LL | type TAW2<T> where T: Iterator<Item: Copy, Item: Copy> = T;
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:96:47
--> $DIR/duplicate.rs:83:47
|
LL | type TAW3<T> where T: Iterator<Item: 'static, Item: 'static> = T;
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:99:36
--> $DIR/duplicate.rs:86:36
|
LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:101:36
--> $DIR/duplicate.rs:88:36
|
LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:103:39
--> $DIR/duplicate.rs:90:39
|
LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:105:40
--> $DIR/duplicate.rs:92:40
|
LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:107:40
--> $DIR/duplicate.rs:94:40
|
LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:109:43
--> $DIR/duplicate.rs:96:43
|
LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:112:36
--> $DIR/duplicate.rs:99:36
|
LL | trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:114:36
--> $DIR/duplicate.rs:101:36
|
LL | trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:116:39
--> $DIR/duplicate.rs:103:39
|
LL | trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:118:34
--> $DIR/duplicate.rs:105:34
|
LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:120:34
--> $DIR/duplicate.rs:107:34
|
LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:122:37
--> $DIR/duplicate.rs:109:37
|
LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:124:45
--> $DIR/duplicate.rs:111:45
|
LL | trait TRW1<T> where T: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:126:45
--> $DIR/duplicate.rs:113:45
|
LL | trait TRW2<T> where T: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:128:48
--> $DIR/duplicate.rs:115:48
|
LL | trait TRW3<T> where T: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:130:46
--> $DIR/duplicate.rs:117:46
|
LL | trait TRSW1 where Self: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:130:46
--> $DIR/duplicate.rs:117:46
|
LL | trait TRSW1 where Self: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:133:46
--> $DIR/duplicate.rs:120:46
|
LL | trait TRSW2 where Self: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:133:46
--> $DIR/duplicate.rs:120:46
|
LL | trait TRSW2 where Self: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:136:49
--> $DIR/duplicate.rs:123:49
|
LL | trait TRSW3 where Self: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:136:49
--> $DIR/duplicate.rs:123:49
|
LL | trait TRSW3 where Self: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:146:40
--> $DIR/duplicate.rs:133:40
|
LL | type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:148:44
--> $DIR/duplicate.rs:135:44
|
LL | type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:150:43
--> $DIR/duplicate.rs:137:43
|
LL | type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:139:43
--> $DIR/duplicate.rs:126:43
|
LL | trait TRA1 { type A: Iterator<Item: Copy, Item: Send>; }
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:141:43
--> $DIR/duplicate.rs:128:43
|
LL | trait TRA2 { type A: Iterator<Item: Copy, Item: Copy>; }
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:143:46
--> $DIR/duplicate.rs:130:46
|
LL | trait TRA3 { type A: Iterator<Item: 'static, Item: 'static>; }
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first

error: aborting due to 66 previous errors; 2 warnings emitted
error: aborting due to 60 previous errors; 2 warnings emitted

For more information about this error, try `rustc --explain E0719`.

0 comments on commit 4d2d903

Please sign in to comment.