Skip to content

Commit 3dba5ad

Browse files
committed
---
yaml --- r: 56693 b: refs/heads/try c: d716398 h: refs/heads/master i: 56691: 1f1effb v: v3
1 parent d084db2 commit 3dba5ad

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: c081ffbd1e845687202a975ea2e698b623e5722f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 79a2b2eafc3c766cecec8a5f76317693bae9ed17
5-
refs/heads/try: 2a44a1bd97cbd072646f98eb60db6de08f679f1b
5+
refs/heads/try: d7163985b8c8daccc34cc6213fb621657f1bc50a
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustc/middle/typeck/collect.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,13 +653,20 @@ pub fn convert_methods(ccx: &CrateCtxt,
653653
&method_generics.lifetimes,
654654
untransformed_rcvr_ty,
655655
m.self_ty, &m.decl);
656+
657+
// if the method specifies a visibility, use that, otherwise
658+
// inherit the visibility from the impl (so `foo` in `pub impl
659+
// { fn foo(); }` is public, but private in `priv impl { fn
660+
// foo(); }`).
661+
let method_vis = m.vis.inherit_from(rcvr_visibility);
662+
656663
ty::method {
657664
ident: m.ident,
658665
generics: ty_generics(ccx, None, &m.generics),
659666
transformed_self_ty: transformed_self_ty,
660667
fty: fty,
661668
self_ty: m.self_ty.node,
662-
vis: m.vis.inherit_from(rcvr_visibility),
669+
vis: method_vis,
663670
def_id: local_def(m.id)
664671
}
665672
}

0 commit comments

Comments
 (0)