Skip to content

Commit 34823c4

Browse files
arielb1Ariel Ben-Yehuda
authored andcommitted
---
yaml --- r: 223234 b: refs/heads/auto c: c533f96 h: refs/heads/master v: v3
1 parent f31f7ca commit 34823c4

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
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: 34942331a3288bbebc5a00fef57b6976afc0eb75
11+
refs/heads/auto: c533f963d9f7f6c665c4d6e9c8c02c5a2d62c9e6
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/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/auto/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)