diff --git a/src/rustc/middle/resolve3.rs b/src/rustc/middle/resolve3.rs index 3eef3d118f7..3bd47b8d5f2 100644 --- a/src/rustc/middle/resolve3.rs +++ b/src/rustc/middle/resolve3.rs @@ -987,22 +987,30 @@ class Resolver { } } item_class(struct_definition, _) => { - let (name_bindings, new_parent) = self.add_child(atom, parent, - ~[ValueNS, TypeNS], sp); - - (*name_bindings).define_type(def_ty(local_def(item.id)), sp); - - match struct_definition.ctor { + let (name_bindings, new_parent) = + match struct_definition.ctor { none => { - // Nothing to do. + let (name_bindings, new_parent) = self.add_child(atom, + parent, ~[TypeNS], sp); + + (*name_bindings).define_type(def_ty( + local_def(item.id)), sp); + (name_bindings, new_parent) } some(ctor) => { + let (name_bindings, new_parent) = self.add_child(atom, + parent, ~[ValueNS, TypeNS], sp); + + (*name_bindings).define_type(def_ty( + local_def(item.id)), sp); + let purity = ctor.node.dec.purity; let ctor_def = def_fn(local_def(ctor.node.id), purity); (*name_bindings).define_value(ctor_def, sp); + (name_bindings, new_parent) } - } + }; // Create the set of implementation information that the // implementation scopes (ImplScopes) need and write it into diff --git a/src/test/run-pass/issue-3149.rs b/src/test/run-pass/issue-3149.rs new file mode 100644 index 00000000000..5d663b553f4 --- /dev/null +++ b/src/test/run-pass/issue-3149.rs @@ -0,0 +1,24 @@ +import Num = num::num; + +pure fn Matrix4(m11: T, m12: T, m13: T, m14: T, + m21: T, m22: T, m23: T, m24: T, + m31: T, m32: T, m33: T, m34: T, + m41: T, m42: T, m43: T, m44: T) + -> Matrix4 { + + Matrix4 { + m11: m11, m12: m12, m13: m13, m14: m14, + m21: m21, m22: m22, m23: m23, m24: m24, + m31: m31, m32: m32, m33: m33, m34: m34, + m41: m41, m42: m42, m43: m43, m44: m44 + } +} + +struct Matrix4 { + let m11: T; let m12: T; let m13: T; let m14: T; + let m21: T; let m22: T; let m23: T; let m24: T; + let m31: T; let m32: T; let m33: T; let m34: T; + let m41: T; let m42: T; let m43: T; let m44: T; +} + +fn main() {}