-
Notifications
You must be signed in to change notification settings - Fork 13k
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 #43901 - GuillaumeGomez:unsized-union-field, r=petroche…
…nkov udpdate error message for unsized union field Fixes #36312.
- Loading branch information
Showing
7 changed files
with
91 additions
and
10 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
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,26 @@ | ||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
#![feature(untagged_unions)] | ||
|
||
union Foo<T: ?Sized> { | ||
value: T, | ||
} | ||
|
||
struct Foo2<T: ?Sized> { | ||
value: T, | ||
t: u32, | ||
} | ||
|
||
enum Foo3<T: ?Sized> { | ||
Value(T), | ||
} | ||
|
||
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,32 @@ | ||
error[E0277]: the trait bound `T: std::marker::Sized` is not satisfied | ||
--> $DIR/union-sized-field.rs:14:5 | ||
| | ||
14 | value: T, | ||
| ^^^^^^^^ `T` does not have a constant size known at compile-time | ||
| | ||
= help: the trait `std::marker::Sized` is not implemented for `T` | ||
= help: consider adding a `where T: std::marker::Sized` bound | ||
= note: no field of a union may have a dynamically sized type | ||
|
||
error[E0277]: the trait bound `T: std::marker::Sized` is not satisfied | ||
--> $DIR/union-sized-field.rs:18:5 | ||
| | ||
18 | value: T, | ||
| ^^^^^^^^ `T` does not have a constant size known at compile-time | ||
| | ||
= help: the trait `std::marker::Sized` is not implemented for `T` | ||
= help: consider adding a `where T: std::marker::Sized` bound | ||
= note: only the last field of a struct may have a dynamically sized type | ||
|
||
error[E0277]: the trait bound `T: std::marker::Sized` is not satisfied | ||
--> $DIR/union-sized-field.rs:23:11 | ||
| | ||
23 | Value(T), | ||
| ^^ `T` does not have a constant size known at compile-time | ||
| | ||
= help: the trait `std::marker::Sized` is not implemented for `T` | ||
= help: consider adding a `where T: std::marker::Sized` bound | ||
= note: no field of an enum variant may have a dynamically sized type | ||
|
||
error: aborting due to 3 previous errors | ||
|