Store the arrays of properties as &'static [T] rather than [T, ..N].

This means the .as_slice() call (which is problematic when storing the array
in a static struct) is no longer necessary.
This commit is contained in:
Ms2ger 2014-06-21 10:32:21 +02:00
parent f6294a67c5
commit da28a791e5

View file

@ -1101,9 +1101,9 @@ class PropertyDefiner:
if specTerminator:
specs.append(specTerminator)
return (("static %s: [%s, ..%i] = [\n" +
return (("static %s: &'static [%s] = &[\n" +
",\n".join(specs) + "\n" +
"];\n\n") % (name, specType, len(specs)))
"];\n\n") % (name, specType))
# The length of a method is the maximum of the lengths of the
# argument lists of all its overloads.
@ -1894,7 +1894,7 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
val = ('%(' + name + ')s') % self.properties.variableNames()
if val == "ptr::null()":
return "None"
return "Some(%s.as_slice())" % val
return "Some(%s)" % val
if needInterfaceObject:
if self.descriptor.interface.ctor():