forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#105940 - matthiaskrgr:rollup-ho4po1t, r=matth…
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#105901 (Don't panic on stable since miri is not available there) - rust-lang#105912 (rustdoc: force pre tags to have the default line height) - rust-lang#105914 (rustdoc: Simplify CSS for scraped code examples code blocks) - rust-lang#105933 (Add readable rustdoc display for tvOS and watchOS) - rust-lang#105935 (docs/test: add UI test and long-form error docs for `E0377`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
10 changed files
with
90 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
The trait `CoerceUnsized` may only be implemented for a coercion between | ||
structures with the same definition. | ||
|
||
Example of erroneous code: | ||
|
||
```compile_fail,E0377 | ||
#![feature(coerce_unsized)] | ||
use std::ops::CoerceUnsized; | ||
pub struct Foo<T: ?Sized> { | ||
field_with_unsized_type: T, | ||
} | ||
pub struct Bar<T: ?Sized> { | ||
field_with_unsized_type: T, | ||
} | ||
// error: the trait `CoerceUnsized` may only be implemented for a coercion | ||
// between structures with the same definition | ||
impl<T, U> CoerceUnsized<Bar<U>> for Foo<T> where T: CoerceUnsized<U> {} | ||
``` | ||
|
||
When attempting to implement `CoerceUnsized`, the `impl` signature must look | ||
like: `impl CoerceUnsized<Type<U>> for Type<T> where T: CoerceUnsized<U>`; | ||
the *implementer* and *`CoerceUnsized` type parameter* must be the same | ||
type. In this example, `Bar` and `Foo` (even though structurally identical) | ||
are *not* the same type and are rejected. Learn more about the `CoerceUnsized` | ||
trait and DST coercion in | ||
[the `CoerceUnsized` docs](../std/ops/trait.CoerceUnsized.html). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Test that code blocks nested within <sub> do not have a line height of 0. | ||
goto: "file://" + |DOC_PATH| + "/test_docs/codeblock_sub/index.html" | ||
|
||
store-property: (codeblock_sub_1, "#codeblock-sub-1", "offsetHeight") | ||
assert-property-false: ("#codeblock-sub-3", { "offsetHeight": |codeblock_sub_1| }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#![feature(coerce_unsized)] | ||
use std::ops::CoerceUnsized; | ||
|
||
pub struct Foo<T: ?Sized> { | ||
field_with_unsized_type: T, | ||
} | ||
|
||
pub struct Bar<T: ?Sized> { | ||
field_with_unsized_type: T, | ||
} | ||
|
||
impl<T, U> CoerceUnsized<Bar<U>> for Foo<T> where T: CoerceUnsized<U> {} //~ ERROR E0377 | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0377]: the trait `CoerceUnsized` may only be implemented for a coercion between structures with the same definition; expected `Foo`, found `Bar` | ||
--> $DIR/E0377.rs:12:1 | ||
| | ||
LL | impl<T, U> CoerceUnsized<Bar<U>> for Foo<T> where T: CoerceUnsized<U> {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0377`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters