Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 4d2d903

Browse files
committed
Remove impl trait bindings handling on const AST lowering
1 parent bc106eb commit 4d2d903

File tree

8 files changed

+104
-238
lines changed

8 files changed

+104
-238
lines changed

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -484,17 +484,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
484484
span: Span,
485485
body: Option<&Expr>,
486486
) -> (&'hir hir::Ty<'hir>, hir::BodyId) {
487-
let mut capturable_lifetimes;
488-
let itctx = if self.sess.features_untracked().impl_trait_in_bindings {
489-
capturable_lifetimes = FxHashSet::default();
490-
ImplTraitContext::TypeAliasesOpaqueTy {
491-
capturable_lifetimes: &mut capturable_lifetimes,
492-
origin: hir::OpaqueTyOrigin::Misc,
493-
}
494-
} else {
495-
ImplTraitContext::Disallowed(ImplTraitPosition::Binding)
496-
};
497-
let ty = self.lower_ty(ty, itctx);
487+
let ty = self.lower_ty(ty, ImplTraitContext::Disallowed(ImplTraitPosition::Binding));
498488
(ty, self.lower_const_body(span, body))
499489
}
500490

src/test/ui/associated-type-bounds/duplicate.full_tait.stderr

Lines changed: 34 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -232,317 +232,269 @@ LL | fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
232232
| `Item` bound here first
233233

234234
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
235-
--> $DIR/duplicate.rs:73:39
236-
|
237-
LL | const CIT1: impl Iterator<Item: Copy, Item: Send> = iter::empty();
238-
| ---------- ^^^^^^^^^^ re-bound here
239-
| |
240-
| `Item` bound here first
241-
242-
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
243-
--> $DIR/duplicate.rs:75:39
244-
|
245-
LL | const CIT2: impl Iterator<Item: Copy, Item: Copy> = iter::empty();
246-
| ---------- ^^^^^^^^^^ re-bound here
247-
| |
248-
| `Item` bound here first
249-
250-
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
251-
--> $DIR/duplicate.rs:77:42
252-
|
253-
LL | const CIT3: impl Iterator<Item: 'static, Item: 'static> = iter::empty();
254-
| ------------- ^^^^^^^^^^^^^ re-bound here
255-
| |
256-
| `Item` bound here first
257-
258-
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
259-
--> $DIR/duplicate.rs:79:40
260-
|
261-
LL | static SIT1: impl Iterator<Item: Copy, Item: Send> = iter::empty();
262-
| ---------- ^^^^^^^^^^ re-bound here
263-
| |
264-
| `Item` bound here first
265-
266-
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
267-
--> $DIR/duplicate.rs:81:40
268-
|
269-
LL | static SIT2: impl Iterator<Item: Copy, Item: Copy> = iter::empty();
270-
| ---------- ^^^^^^^^^^ re-bound here
271-
| |
272-
| `Item` bound here first
273-
274-
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
275-
--> $DIR/duplicate.rs:83:43
276-
|
277-
LL | static SIT3: impl Iterator<Item: 'static, Item: 'static> = iter::empty();
278-
| ------------- ^^^^^^^^^^^^^ re-bound here
279-
| |
280-
| `Item` bound here first
281-
282-
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
283-
--> $DIR/duplicate.rs:86:35
235+
--> $DIR/duplicate.rs:73:35
284236
|
285237
LL | type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
286238
| ---------- ^^^^^^^^^^ re-bound here
287239
| |
288240
| `Item` bound here first
289241

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

546-
error: aborting due to 66 previous errors; 2 warnings emitted
498+
error: aborting due to 60 previous errors; 2 warnings emitted
547499

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

0 commit comments

Comments
 (0)