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

Commit 4d4da92

Browse files
Fix rebase damage
1 parent 9930e1f commit 4d4da92

17 files changed

+126
-94
lines changed

src/librustc_typeck/check/wfcheck.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ fn check_associated_type_defaults(fcx: &FnCtxt<'_, '_>, trait_def_id: DefId) {
443443
// `<Self as Trait<...>>::Assoc` to the default type.
444444
let map = tcx
445445
.associated_items(trait_def_id)
446+
.iter()
446447
.filter_map(|item| {
447448
if item.kind == ty::AssocKind::Type && item.defaultness.has_value() {
448449
// `<Self as Trait<...>>::Assoc`

src/test/ui/associated-const/defaults-not-assumed-fail.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ fn main() {
3232
assert_eq!(<() as Tr>::A, 255);
3333
assert_eq!(<() as Tr>::B, 0); // causes the error above
3434
//~^ ERROR evaluation of constant expression failed
35+
//~| ERROR erroneous constant used
3536

3637
assert_eq!(<u8 as Tr>::A, 254);
3738
assert_eq!(<u8 as Tr>::B, 255);

src/test/ui/associated-const/defaults-not-assumed-fail.stderr

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,16 @@ LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
1616
| |
1717
| referenced constant has errors
1818
|
19-
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
19+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
2020

21-
error: aborting due to 2 previous errors
21+
error: erroneous constant used
22+
--> $DIR/defaults-not-assumed-fail.rs:33:5
23+
|
24+
LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
25+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
26+
|
27+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
28+
29+
error: aborting due to 3 previous errors
2230

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

src/test/ui/associated-types/defaults-cyclic-fail-1.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
error[E0275]: overflow evaluating the requirement `<() as Tr>::B`
2-
--> $DIR/defaults-cyclic-fail-1.rs:12:6
2+
--> $DIR/defaults-cyclic-fail-1.rs:10:6
33
|
44
LL | impl Tr for () {}
55
| ^^
66

77
error[E0275]: overflow evaluating the requirement `<bool as Tr>::B`
8-
--> $DIR/defaults-cyclic-fail-1.rs:30:6
8+
--> $DIR/defaults-cyclic-fail-1.rs:28:6
99
|
1010
LL | impl Tr for bool {
1111
| ^^
1212

1313
error[E0275]: overflow evaluating the requirement `<usize as Tr>::B`
14-
--> $DIR/defaults-cyclic-fail-1.rs:37:6
14+
--> $DIR/defaults-cyclic-fail-1.rs:35:6
1515
|
1616
LL | impl Tr for usize {
1717
| ^^
1818

1919
error[E0275]: overflow evaluating the requirement `<bool as Tr>::B`
20-
--> $DIR/defaults-cyclic-fail-1.rs:32:5
20+
--> $DIR/defaults-cyclic-fail-1.rs:30:5
2121
|
2222
LL | type A = Box<Self::B>;
2323
| ^^^^^^^^^^^^^^^^^^^^^^
2424

2525
error[E0275]: overflow evaluating the requirement `<usize as Tr>::A`
26-
--> $DIR/defaults-cyclic-fail-1.rs:39:5
26+
--> $DIR/defaults-cyclic-fail-1.rs:37:5
2727
|
2828
LL | type B = &'static Self::A;
2929
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

src/test/ui/associated-types/defaults-cyclic-fail-2.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// compile-fail
2-
31
#![feature(associated_type_defaults)]
42

53
// A more complex version of `defaults-cyclic-fail-1.rs`, with non-trivial defaults.

src/test/ui/associated-types/defaults-cyclic-fail-2.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
error[E0275]: overflow evaluating the requirement `<() as Tr>::B`
2-
--> $DIR/defaults-cyclic-fail-2.rs:14:6
2+
--> $DIR/defaults-cyclic-fail-2.rs:12:6
33
|
44
LL | impl Tr for () {}
55
| ^^
66

77
error[E0275]: overflow evaluating the requirement `<bool as Tr>::B`
8-
--> $DIR/defaults-cyclic-fail-2.rs:32:6
8+
--> $DIR/defaults-cyclic-fail-2.rs:30:6
99
|
1010
LL | impl Tr for bool {
1111
| ^^
1212

1313
error[E0275]: overflow evaluating the requirement `<usize as Tr>::B`
14-
--> $DIR/defaults-cyclic-fail-2.rs:39:6
14+
--> $DIR/defaults-cyclic-fail-2.rs:37:6
1515
|
1616
LL | impl Tr for usize {
1717
| ^^
1818

1919
error[E0275]: overflow evaluating the requirement `<bool as Tr>::B`
20-
--> $DIR/defaults-cyclic-fail-2.rs:34:5
20+
--> $DIR/defaults-cyclic-fail-2.rs:32:5
2121
|
2222
LL | type A = Box<Self::B>;
2323
| ^^^^^^^^^^^^^^^^^^^^^^
2424

2525
error[E0275]: overflow evaluating the requirement `<usize as Tr>::A`
26-
--> $DIR/defaults-cyclic-fail-2.rs:41:5
26+
--> $DIR/defaults-cyclic-fail-2.rs:39:5
2727
|
2828
LL | type B = &'static Self::A;
2929
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

src/test/ui/associated-types/defaults-in-other-trait-items.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ LL | let () = p;
1010
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
1111

1212
error[E0308]: mismatched types
13-
--> $DIR/defaults-in-other-trait-items.rs:39:25
13+
--> $DIR/defaults-in-other-trait-items.rs:37:25
1414
|
1515
LL | const C: Self::Ty = 0u8;
1616
| ^^^ expected associated type, found `u8`

src/test/ui/associated-types/defaults-mixed.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// compile-fail
2-
31
#![feature(associated_type_defaults)]
42

53
// Tests that a trait with one defaulted and one non-defaulted assoc. type behaves properly.

src/test/ui/associated-types/defaults-mixed.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0046]: not all trait items implemented, missing: `Bar`
2-
--> $DIR/defaults-mixed.rs:13:1
2+
--> $DIR/defaults-mixed.rs:11:1
33
|
44
LL | type Bar;
55
| --------- `Bar` from trait
@@ -8,7 +8,7 @@ LL | impl Trait for () {}
88
| ^^^^^^^^^^^^^^^^^ missing `Bar` in implementation
99

1010
error[E0046]: not all trait items implemented, missing: `Bar`
11-
--> $DIR/defaults-mixed.rs:16:1
11+
--> $DIR/defaults-mixed.rs:14:1
1212
|
1313
LL | type Bar;
1414
| --------- `Bar` from trait

src/test/ui/associated-types/defaults-specialization.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! Tests the interaction of associated type defaults and specialization.
22
3-
// compile-fail
4-
53
#![feature(associated_type_defaults, specialization)]
64

75
trait Tr {

0 commit comments

Comments
 (0)