Skip to content

Commit 3e649ab

Browse files
committed
---
yaml --- r: 214513 b: refs/heads/beta c: aca207a h: refs/heads/master i: 214511: 093002e v: v3
1 parent e6803b4 commit 3e649ab

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 3bb54a3362a5eae45b345b6cfa690dd863f80fdd
26+
refs/heads/beta: aca207a65c82d7581076772846ef424f1a64449b
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 8c0aa6d64ebab528f7eb182812007155d6044972
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/libsyntax/ext/deriving/show.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ fn show_substructure(cx: &mut ExtCtxt, span: Span,
7575

7676
match *substr.fields {
7777
Struct(ref fields) | EnumMatching(_, _, ref fields) => {
78+
7879
if fields.is_empty() || fields[0].name.is_none() {
7980
// tuple struct/"normal" variant
8081
expr = cx.expr_method_call(span,
@@ -83,11 +84,14 @@ fn show_substructure(cx: &mut ExtCtxt, span: Span,
8384
vec![name]);
8485

8586
for field in fields {
87+
// Use double indirection to make sure this works for unsized types
88+
let field = cx.expr_addr_of(field.span, field.self_.clone());
89+
let field = cx.expr_addr_of(field.span, field);
90+
8691
expr = cx.expr_method_call(span,
8792
expr,
8893
token::str_to_ident("field"),
89-
vec![cx.expr_addr_of(field.span,
90-
field.self_.clone())]);
94+
vec![field]);
9195
}
9296
} else {
9397
// normal struct/struct variant
@@ -100,12 +104,14 @@ fn show_substructure(cx: &mut ExtCtxt, span: Span,
100104
let name = cx.expr_lit(field.span, ast::Lit_::LitStr(
101105
token::get_ident(field.name.clone().unwrap()),
102106
ast::StrStyle::CookedStr));
107+
108+
// Use double indirection to make sure this works for unsized types
109+
let field = cx.expr_addr_of(field.span, field.self_.clone());
110+
let field = cx.expr_addr_of(field.span, field);
103111
expr = cx.expr_method_call(span,
104112
expr,
105113
token::str_to_ident("field"),
106-
vec![name,
107-
cx.expr_addr_of(field.span,
108-
field.self_.clone())]);
114+
vec![name, field]);
109115
}
110116
}
111117
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#[derive(Debug)]
12+
struct Row<T>([T]);
13+
14+
fn main() {}

0 commit comments

Comments
 (0)