diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2018-10-06 11:21:18 +0200 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2018-10-06 11:21:18 +0200 |
| commit | ab57af4e6ac5d307db006a1b1cbd4ab60577eeb2 (patch) | |
| tree | 00132e44102805fa36b2b6bb7eb6f090f3f795eb /example/example.rs | |
| parent | aab736a137693945657e86bdd8a5d843ea829553 (diff) | |
| download | rust-ab57af4e6ac5d307db006a1b1cbd4ab60577eeb2.tar.gz rust-ab57af4e6ac5d307db006a1b1cbd4ab60577eeb2.zip | |
Fix projection of sized field in unsized type
Diffstat (limited to 'example/example.rs')
| -rw-r--r-- | example/example.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/example/example.rs b/example/example.rs index 9e247964f32..eebc8c126e9 100644 --- a/example/example.rs +++ b/example/example.rs @@ -196,3 +196,13 @@ fn str_wrapper_get(w: &StrWrapper) -> &str { fn i16_as_i8(a: i16) -> i8 { a as i8 } + +struct Unsized(u8, str); + +fn get_sized_field_ref_from_unsized_type(u: &Unsized) -> &u8 { + &u.0 +} + +fn get_unsized_field_ref_from_unsized_type(u: &Unsized) -> &str { + &u.1 +} |
