Skip to content

Commit 11465de

Browse files
arielb1Ariel Ben-Yehuda
authored andcommitted
---
yaml --- r: 224883 b: refs/heads/tmp c: c533f96 h: refs/heads/master i: 224881: 5400c2b 224879: 897317e v: v3
1 parent e1691f7 commit 11465de

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: 83dee3dfbb452a7558193f3ce171b3c60bf4a499
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: 34942331a3288bbebc5a00fef57b6976afc0eb75
28+
refs/heads/tmp: c533f963d9f7f6c665c4d6e9c8c02c5a2d62c9e6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: e58601ab085591c71a27ae82137fc313222c2270
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/src/librustc_trans/trans/adt.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,7 @@ fn find_discr_field_candidate<'tcx>(tcx: &ty::ctxt<'tcx>,
462462
// let's recurse and find out
463463
ty::TyStruct(def, substs) => {
464464
for (j, field) in def.struct_variant().fields.iter().enumerate() {
465-
// TODO(#27532)
466-
let field_ty = field.ty(tcx, substs);
465+
let field_ty = monomorphize::field_ty(tcx, substs, field);
467466
if let Some(mut fpath) = find_discr_field_candidate(tcx, field_ty, path.clone()) {
468467
fpath.push(j);
469468
return Some(fpath);

branches/tmp/src/test/run-pass/enum-null-pointer-opt.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ use std::rc::Rc;
1818
use std::sync::Arc;
1919

2020
trait Trait { fn dummy(&self) { } }
21+
trait Mirror { type Image; }
22+
impl<T> Mirror for T { type Image = T; }
23+
struct ParamTypeStruct<T>(T);
24+
struct AssocTypeStruct<T>(<T as Mirror>::Image);
2125

2226
fn main() {
2327
// Functions
@@ -66,4 +70,7 @@ fn main() {
6670
// Should apply to types that have NonZero transitively
6771
assert_eq!(size_of::<String>(), size_of::<Option<String>>());
6872

73+
// Should apply to types where the pointer is substituted
74+
assert_eq!(size_of::<&u8>(), size_of::<Option<ParamTypeStruct<&u8>>>());
75+
assert_eq!(size_of::<&u8>(), size_of::<Option<AssocTypeStruct<&u8>>>());
6976
}

0 commit comments

Comments
 (0)