Commit 20af858601

Andrew Kelley <andrew@ziglang.org>
2020-01-20 03:06:41
some fixes
1 parent e3b5e91
Changed files (2)
lib
src-self-hosted
lib/std/buffer.zig
@@ -59,7 +59,7 @@ pub const Buffer = struct {
     /// is safe to `deinit`.
     pub fn toOwnedSlice(self: *Buffer) [:0]u8 {
         const allocator = self.list.allocator;
-        const result = allocator.shrink(self.list.items, self.len());
+        const result = self.list.toOwnedSlice();
         self.* = initNull(allocator);
         return result[0 .. result.len - 1 :0];
     }
src-self-hosted/stage1.zig
@@ -542,14 +542,14 @@ export fn stage2_list_features_for_arch(arch_name_ptr: [*]const u8, arch_name_le
 fn printFeaturesForArch(arch_name: []const u8, show_dependencies: bool) !void {
     const stdout_stream = &std.io.getStdOut().outStream().stream;
 
-    const arch = Target.parseArchTag(arch_name) catch {
+    const arch = Target.parseArchSub(arch_name) catch {
         std.debug.warn("Failed to parse arch '{}'\nInvoke 'zig targets' for a list of valid architectures\n", .{arch_name});
         return;
     };
 
     try stdout_stream.print("Available features for {}:\n", .{@tagName(arch)});
 
-    const features = std.target.getFeaturesForArch(arch);
+    const features = arch.allFeaturesList();
 
     var longest_len: usize = 0;
     for (features) |feature| {
@@ -568,7 +568,7 @@ fn printFeaturesForArch(arch_name: []const u8, show_dependencies: bool) !void {
 
         try stdout_stream.print(" - {}\n", .{feature.description});
 
-        if (show_dependencies and feature.dependencies.len > 0) {
+        if (show_dependencies and feature.dependencies != 0) {
             for (feature.dependencies) |dependency| {
                 try stdout_stream.print("    {}\n", .{dependency.name});
             }
@@ -622,7 +622,7 @@ fn printCpusForArch(arch_name: []const u8, show_dependencies: bool) !void {
 
 const Stage2CpuFeatures = struct {
     allocator: *mem.Allocator,
-    cpu_features: Target.CpuFeatures,
+    cpu_features: Target.Cross.CpuFeatures,
 
     llvm_cpu_name: ?[:0]const u8,
     llvm_features_str: ?[:0]const u8,