diff options
| author | bors <bors@rust-lang.org> | 2021-11-27 14:29:12 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-11-27 14:29:12 +0000 |
| commit | 686e313a9aa14107c8631ffe48fa09110a7692db (patch) | |
| tree | 7bfc7136d580c906876d0aba06ab4cc4a77579e4 /src/test | |
| parent | 5fd3a5c7c175f228afaf5fc6ff00c177b83d8055 (diff) | |
| parent | 073b1208f0389f89ade1e60401edc99c7a113a50 (diff) | |
Auto merge of #91288 - matthiaskrgr:rollup-yp5h41r, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #83791 (Weaken guarantee around advancing underlying iterators in zip) - #90995 (Document non-guarantees for Hash) - #91057 (Expand `available_parallelism` docs in anticipation of cgroup quota support) - #91062 (rustdoc: Consolidate static-file replacement mechanism) - #91208 (Account for incorrect `where T::Assoc = Ty` bound) - #91266 (Use non-generic inner function for pointer formatting) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/test')
6 files changed, 94 insertions, 6 deletions
diff --git a/src/test/rustdoc/static-root-path.rs b/src/test/rustdoc/static-root-path.rs index 2f7c89c5f1e..f1d49b9fcb2 100644 --- a/src/test/rustdoc/static-root-path.rs +++ b/src/test/rustdoc/static-root-path.rs @@ -3,7 +3,7 @@ // @has static_root_path/struct.SomeStruct.html // @matches - '"/cache/main\.js"' // @!matches - '"\.\./main\.js"' -// @matches - '"\.\./search-index\.js"' +// @matches - 'data-root-path="\.\./"' // @!matches - '"/cache/search-index\.js"' pub struct SomeStruct; diff --git a/src/test/ui/generic-associated-types/equality-bound.rs b/src/test/ui/generic-associated-types/equality-bound.rs new file mode 100644 index 00000000000..fcc2da8014f --- /dev/null +++ b/src/test/ui/generic-associated-types/equality-bound.rs @@ -0,0 +1,15 @@ +fn sum<I: Iterator<Item = ()>>(i: I) -> i32 where I::Item = i32 { +//~^ ERROR equality constraints are not yet supported in `where` clauses + panic!() +} +fn sum2<I: Iterator>(i: I) -> i32 where I::Item = i32 { +//~^ ERROR equality constraints are not yet supported in `where` clauses + panic!() +} +fn sum3<J: Iterator>(i: J) -> i32 where I::Item = i32 { +//~^ ERROR equality constraints are not yet supported in `where` clauses +//~| ERROR failed to resolve: use of undeclared type `I` + panic!() +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/equality-bound.stderr b/src/test/ui/generic-associated-types/equality-bound.stderr new file mode 100644 index 00000000000..27432641958 --- /dev/null +++ b/src/test/ui/generic-associated-types/equality-bound.stderr @@ -0,0 +1,43 @@ +error: equality constraints are not yet supported in `where` clauses + --> $DIR/equality-bound.rs:1:51 + | +LL | fn sum<I: Iterator<Item = ()>>(i: I) -> i32 where I::Item = i32 { + | ^^^^^^^^^^^^^ not supported + | + = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information +help: if `Iterator::Item` is an associated type you're trying to set, use the associated type binding syntax + | +LL - fn sum<I: Iterator<Item = ()>>(i: I) -> i32 where I::Item = i32 { +LL + fn sum<I: Iterator<Item = (), Item = i32>>(i: I) -> i32 where { + | + +error: equality constraints are not yet supported in `where` clauses + --> $DIR/equality-bound.rs:5:41 + | +LL | fn sum2<I: Iterator>(i: I) -> i32 where I::Item = i32 { + | ^^^^^^^^^^^^^ not supported + | + = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information +help: if `Iterator::Item` is an associated type you're trying to set, use the associated type binding syntax + | +LL - fn sum2<I: Iterator>(i: I) -> i32 where I::Item = i32 { +LL + fn sum2<I: Iterator<Item = i32>>(i: I) -> i32 where { + | + +error: equality constraints are not yet supported in `where` clauses + --> $DIR/equality-bound.rs:9:41 + | +LL | fn sum3<J: Iterator>(i: J) -> i32 where I::Item = i32 { + | ^^^^^^^^^^^^^ not supported + | + = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information + +error[E0433]: failed to resolve: use of undeclared type `I` + --> $DIR/equality-bound.rs:9:41 + | +LL | fn sum3<J: Iterator>(i: J) -> i32 where I::Item = i32 { + | ^ use of undeclared type `I` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0433`. diff --git a/src/test/ui/generic-associated-types/missing-bounds.fixed b/src/test/ui/generic-associated-types/missing-bounds.fixed index 54478d16282..0e234120a51 100644 --- a/src/test/ui/generic-associated-types/missing-bounds.fixed +++ b/src/test/ui/generic-associated-types/missing-bounds.fixed @@ -34,11 +34,12 @@ impl<B: std::ops::Add<Output = B>> Add for D<B> { struct E<B>(B); -impl<B: Add> Add for E<B> where B: Add<Output = B> { +impl<B: Add> Add for E<B> where B: Add<Output = B>, B: Add<Output = B> { + //~^ ERROR equality constraints are not yet supported in `where` clauses type Output = Self; fn add(self, rhs: Self) -> Self { - Self(self.0 + rhs.0) + Self(self.0 + rhs.0) //~ ERROR mismatched types } } diff --git a/src/test/ui/generic-associated-types/missing-bounds.rs b/src/test/ui/generic-associated-types/missing-bounds.rs index 962d2db9476..ffafff5e9f5 100644 --- a/src/test/ui/generic-associated-types/missing-bounds.rs +++ b/src/test/ui/generic-associated-types/missing-bounds.rs @@ -34,11 +34,12 @@ impl<B> Add for D<B> { struct E<B>(B); -impl<B: Add> Add for E<B> where B: Add<Output = B> { +impl<B: Add> Add for E<B> where <B as Add>::Output = B { + //~^ ERROR equality constraints are not yet supported in `where` clauses type Output = Self; fn add(self, rhs: Self) -> Self { - Self(self.0 + rhs.0) + Self(self.0 + rhs.0) //~ ERROR mismatched types } } diff --git a/src/test/ui/generic-associated-types/missing-bounds.stderr b/src/test/ui/generic-associated-types/missing-bounds.stderr index 4d33fe84829..c9603b8d1ea 100644 --- a/src/test/ui/generic-associated-types/missing-bounds.stderr +++ b/src/test/ui/generic-associated-types/missing-bounds.stderr @@ -1,3 +1,15 @@ +error: equality constraints are not yet supported in `where` clauses + --> $DIR/missing-bounds.rs:37:33 + | +LL | impl<B: Add> Add for E<B> where <B as Add>::Output = B { + | ^^^^^^^^^^^^^^^^^^^^^^ not supported + | + = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information +help: if `Output` is an associated type you're trying to set, use the associated type binding syntax + | +LL | impl<B: Add> Add for E<B> where B: Add<Output = B> { + | ~~~~~~~~~~~~~~~~~~ + error[E0308]: mismatched types --> $DIR/missing-bounds.rs:11:11 | @@ -43,7 +55,23 @@ help: consider restricting type parameter `B` LL | impl<B: std::ops::Add<Output = B>> Add for D<B> { | +++++++++++++++++++++++++++ -error: aborting due to 3 previous errors +error[E0308]: mismatched types + --> $DIR/missing-bounds.rs:42:14 + | +LL | impl<B: Add> Add for E<B> where <B as Add>::Output = B { + | - this type parameter +... +LL | Self(self.0 + rhs.0) + | ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type + | + = note: expected type parameter `B` + found associated type `<B as Add>::Output` +help: consider further restricting type parameter `B` + | +LL | impl<B: Add> Add for E<B> where <B as Add>::Output = B, B: Add<Output = B> { + | ++++++++++++++++++++ + +error: aborting due to 5 previous errors Some errors have detailed explanations: E0308, E0369. For more information about an error, try `rustc --explain E0308`. |
