diff options
| author | bors <bors@rust-lang.org> | 2021-12-03 07:12:36 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-12-03 07:12:36 +0000 |
| commit | 3e21768a0a3fc84befd1cbe825ae6849e9941b73 (patch) | |
| tree | 27a98b7f0c0149f13f782285532de6a3137f0997 /src/test | |
| parent | 190367ba2ef1d279004b8372cf022b5fc96145dd (diff) | |
| parent | a2160609c0016c1d65304905043bfea4b7f9ca52 (diff) | |
Auto merge of #91486 - matthiaskrgr:rollup-699fo18, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #88906 (Implement write() method for Box<MaybeUninit<T>>) - #90269 (Make `Option::expect` unstably const) - #90854 (Type can be unsized and uninhabited) - #91170 (rustdoc: preload fonts) - #91273 (Fix ICE #91268 by checking that the snippet ends with a `)`) - #91381 (Android: -ldl must appear after -lgcc when linking) - #91453 (Document Windows TLS drop behaviour) - #91462 (Use try_normalize_erasing_regions in needs_drop) - #91474 (suppress warning about set_errno being unused on DragonFly) - #91483 (Sync rustfmt subtree) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/issues/issue-88150.rs | 21 | ||||
| -rw-r--r-- | src/test/ui/type/issue-91268.rs | 9 | ||||
| -rw-r--r-- | src/test/ui/type/issue-91268.stderr | 50 | ||||
| -rw-r--r-- | src/test/ui/union/issue-81199.rs | 21 | ||||
| -rw-r--r-- | src/test/ui/union/issue-81199.stderr | 29 |
5 files changed, 130 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-88150.rs b/src/test/ui/issues/issue-88150.rs new file mode 100644 index 00000000000..555a38637a4 --- /dev/null +++ b/src/test/ui/issues/issue-88150.rs @@ -0,0 +1,21 @@ +// run-pass +// compile-flags:-C debuginfo=2 +// edition:2018 + +use core::marker::PhantomData; + +pub struct Foo<T: ?Sized, A>( + PhantomData<(A, T)>, +); + +enum Never {} + +impl<T: ?Sized> Foo<T, Never> { + fn new_foo() -> Foo<T, Never> { + Foo(PhantomData) + } +} + +fn main() { + let _ = Foo::<[()], Never>::new_foo(); +} diff --git a/src/test/ui/type/issue-91268.rs b/src/test/ui/type/issue-91268.rs new file mode 100644 index 00000000000..fd2733c1c54 --- /dev/null +++ b/src/test/ui/type/issue-91268.rs @@ -0,0 +1,9 @@ +// error-pattern: this file contains an unclosed delimiter +// error-pattern: cannot find type `ţ` in this scope +// error-pattern: parenthesized type parameters may only be used with a `Fn` trait +// error-pattern: type arguments are not allowed for this type +// error-pattern: mismatched types +// ignore-tidy-trailing-newlines +// `ţ` must be the last character in this file, it cannot be followed by a newline +fn main() { + 0: u8(ţ \ No newline at end of file diff --git a/src/test/ui/type/issue-91268.stderr b/src/test/ui/type/issue-91268.stderr new file mode 100644 index 00000000000..2fe6ba6248c --- /dev/null +++ b/src/test/ui/type/issue-91268.stderr @@ -0,0 +1,50 @@ +error: this file contains an unclosed delimiter + --> $DIR/issue-91268.rs:9:12 + | +LL | fn main() { + | - unclosed delimiter +LL | 0: u8(ţ + | - ^ + | | + | unclosed delimiter + +error: this file contains an unclosed delimiter + --> $DIR/issue-91268.rs:9:12 + | +LL | fn main() { + | - unclosed delimiter +LL | 0: u8(ţ + | - ^ + | | + | unclosed delimiter + +error[E0412]: cannot find type `ţ` in this scope + --> $DIR/issue-91268.rs:9:11 + | +LL | 0: u8(ţ + | ^ expecting a type here because of type ascription + +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-91268.rs:9:8 + | +LL | 0: u8(ţ + | ^^^^ only `Fn` traits may use parentheses + +error[E0109]: type arguments are not allowed for this type + --> $DIR/issue-91268.rs:9:11 + | +LL | 0: u8(ţ + | ^ type argument not allowed + +error[E0308]: mismatched types + --> $DIR/issue-91268.rs:9:5 + | +LL | fn main() { + | - expected `()` because of default return type +LL | 0: u8(ţ + | ^^^^^^^ expected `()`, found `u8` + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0109, E0214, E0308, E0412. +For more information about an error, try `rustc --explain E0109`. diff --git a/src/test/ui/union/issue-81199.rs b/src/test/ui/union/issue-81199.rs new file mode 100644 index 00000000000..628e7c6ed5d --- /dev/null +++ b/src/test/ui/union/issue-81199.rs @@ -0,0 +1,21 @@ +#[repr(C)] +union PtrRepr<T: ?Sized> { + const_ptr: *const T, + mut_ptr: *mut T, + components: PtrComponents<T>, + //~^ ERROR the trait bound +} + +#[repr(C)] +struct PtrComponents<T: Pointee + ?Sized> { + data_address: *const (), + metadata: <T as Pointee>::Metadata, +} + + + +pub trait Pointee { + type Metadata; +} + +fn main() {} diff --git a/src/test/ui/union/issue-81199.stderr b/src/test/ui/union/issue-81199.stderr new file mode 100644 index 00000000000..f26bfe3a0b0 --- /dev/null +++ b/src/test/ui/union/issue-81199.stderr @@ -0,0 +1,29 @@ +error[E0277]: the trait bound `T: Pointee` is not satisfied in `PtrComponents<T>` + --> $DIR/issue-81199.rs:5:17 + | +LL | components: PtrComponents<T>, + | ^^^^^^^^^^^^^^^^ within `PtrComponents<T>`, the trait `Pointee` is not implemented for `T` + | +note: required because it appears within the type `PtrComponents<T>` + --> $DIR/issue-81199.rs:10:8 + | +LL | struct PtrComponents<T: Pointee + ?Sized> { + | ^^^^^^^^^^^^^ + = note: no field of a union may have a dynamically sized type + = help: change the field's type to have a statically known size +help: consider further restricting this bound + | +LL | union PtrRepr<T: ?Sized + Pointee> { + | +++++++++ +help: borrowed types always have a statically known size + | +LL | components: &PtrComponents<T>, + | + +help: the `Box` type always has a statically known size and allocates its contents in the heap + | +LL | components: Box<PtrComponents<T>>, + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. |
