Skip to content

Commit 57d8918

Browse files
committed
---
yaml --- r: 65467 b: refs/heads/master c: 6fcb483 h: refs/heads/master i: 65465: 5db25c3 65463: 9323095 v: v3
1 parent c050ef2 commit 57d8918

File tree

7 files changed

+191
-109
lines changed

7 files changed

+191
-109
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: e86ac24e7ba71c488c243d2715b825ec1935aa33
2+
refs/heads/master: 6fcb483609dec71ec6fd13aaf9bea9080990043a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/src/etc/zsh/_rust

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#compdef rustc
2+
3+
local -a _rustc_opts_switches _rustc_opts_lint _rustc_opts_debug
4+
5+
typeset -A opt_args
6+
7+
_rustc_opts_switches=(
8+
--bin'[Compile an executable crate (default)]'
9+
-c'[Compile and assemble, but do not link]'
10+
--cfg'[Configure the compilation environment]'
11+
--emit-llvm'[Produce an LLVM bitcode file]'
12+
{-h,--help}'[Display this message]'
13+
-L'[Add a directory to the library search path]'
14+
--lib'[Compile a library crate]'
15+
--linker'[Program to use for linking instead of the default.]'
16+
--link-args'[FLAGS is a space-separated list of flags passed to the linker]'
17+
--ls'[List the symbols defined by a library crate]'
18+
--no-trans'[Run all passes except translation; no output]'
19+
-O'[Equivalent to --opt-level=2]'
20+
-o'[Write output to <filename>]'
21+
--opt-level'[Optimize with possible levels 0-3]'
22+
--out-dir'[Write output to compiler-chosen filename in <dir>]'
23+
--parse-only'[Parse only; do not compile, assemble, or link]'
24+
--pretty'[Pretty-print the input instead of compiling]'
25+
-S'[Compile only; do not assemble or link]'
26+
--save-temps'[Write intermediate files (.bc, .opt.bc, .o) in addition to normal output]'
27+
--sysroot'[Override the system root]'
28+
--test'[Build a test harness]'
29+
--target'[Target triple cpu-manufacturer-kernel\[-os\] to compile]'
30+
--target-feature'[Target specific attributes (llc -mattr=help for detail)]'
31+
--android-cross-path'[The path to the Android NDK]'
32+
{-W,--warn}'[Set lint warnings]'
33+
{-A,--allow}'[Set lint allowed]'
34+
{-D,--deny}'[Set lint denied]'
35+
{-F,--forbid}'[Set lint forbidden]'
36+
-Z'[Set internal debugging options]'
37+
{-v,--version}'[Print version info and exit]'
38+
)
39+
40+
_rustc_opts_lint=(
41+
'path-statement:path statements with no effect'
42+
'deprecated-pattern:warn about deprecated uses of pattern bindings'
43+
'non-implicitly-copyable-typarams:passing non implicitly copyable types as copy type params'
44+
'missing-trait-doc:detects missing documentation for traits'
45+
'missing-struct-doc:detects missing documentation for structs'
46+
'ctypes:proper use of core::libc types in foreign modules'
47+
'implicit-copies:implicit copies of non implicitly copyable data'
48+
"unused-mut:detect mut variables which don't need to be mutable"
49+
'unused-imports:imports that are never used'
50+
'heap-memory:use of any (~ type or @ type) heap memory'
51+
'default-methods:allow default methods'
52+
'unused-variable:detect variables which are not used in any way'
53+
'dead-assignment:detect assignments that will never be read'
54+
'unrecognized-lint:unrecognized lint attribute'
55+
'type-limits:comparisons made useless by limits of the types involved'
56+
'unused-unsafe:unnecessary use of an `unsafe` block'
57+
'while-true:suggest using loop { } instead of while(true) { }'
58+
'non-camel-case-types:types, variants and traits should have camel case names'
59+
'managed-heap-memory:use of managed (@ type) heap memory'
60+
'unnecessary-allocation:detects unnecessary allocations that can be eliminated'
61+
'owned-heap-memory:use of owned (~ type) heap memory'
62+
)
63+
64+
_rustc_opts_debug=(
65+
'verbose:in general, enable more debug printouts'
66+
'time-passes:measure time of each rustc pass'
67+
'count-llvm-insns:count where LLVM instrs originate'
68+
'time-llvm-passes:measure time of each LLVM pass'
69+
'trans-stats:gather trans statistics'
70+
'asm-comments:generate comments into the assembly (may change behavior)'
71+
'no-verify:skip LLVM verification'
72+
'trace:emit trace logs'
73+
'coherence:perform coherence checking'
74+
'borrowck-stats:gather borrowck statistics'
75+
"borrowck-note-pure:note where purity is req'd"
76+
"borrowck-note-loan:note where loans are req'd"
77+
'no-landing-pads:omit landing pads for unwinding'
78+
'debug-llvm:enable debug output from LLVM'
79+
'count-type-sizes:count the sizes of aggregate types'
80+
'meta-stats:gather metadata statistics'
81+
'no-opt:do not optimize, even if -O is passed'
82+
'no-monomorphic-collapse:do not collapse template instantiations'
83+
'print-link-args:Print the arguments passed to the linker'
84+
'gc:Garbage collect shared data (experimental)'
85+
'jit:Execute using JIT (experimental)'
86+
'extra-debug-info:Extra debugging info (experimental)'
87+
'debug-info:Produce debug info (experimental)'
88+
'static:Use or produce static libraries or binaries (experimental)'
89+
'no-debug-borrows:do not show where borrow checks fail'
90+
'lint-llvm:Run the LLVM lint pass on the pre-optimization IR'
91+
)
92+
93+
_rustc() {
94+
case $words[2] in
95+
-[WADF]) _describe 'options' _rustc_opts_lint ;;
96+
-Z) _describe 'options' _rustc_opts_debug ;;
97+
-) _arguments -s -w : "$_rustc_opts_switches[@]" ;;
98+
*) _files -g "*.rs" ;;
99+
esac
100+
}
101+
102+
_rustc "$@"

trunk/src/libextra/ebml.rs

Lines changed: 71 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -51,34 +51,32 @@ pub enum EbmlEncoderTag {
5151
EsI16, // 8
5252
EsI8, // 9
5353
EsBool, // 10
54-
EsChar, // 11
55-
EsStr, // 12
56-
EsF64, // 13
57-
EsF32, // 14
58-
EsFloat, // 15
59-
EsEnum, // 16
60-
EsEnumVid, // 17
61-
EsEnumBody, // 18
62-
EsVec, // 19
63-
EsVecLen, // 20
64-
EsVecElt, // 21
65-
EsMap, // 22
66-
EsMapLen, // 23
67-
EsMapKey, // 24
68-
EsMapVal, // 25
54+
EsStr, // 11
55+
EsF64, // 12
56+
EsF32, // 13
57+
EsFloat, // 14
58+
EsEnum, // 15
59+
EsEnumVid, // 16
60+
EsEnumBody, // 17
61+
EsVec, // 18
62+
EsVecLen, // 19
63+
EsVecElt, // 20
6964

7065
EsOpaque,
7166

72-
EsLabel, // Used only when debugging
67+
EsLabel // Used only when debugging
7368
}
7469
// --------------------------------------
7570

7671
pub mod reader {
77-
use super::*;
72+
use core::prelude::*;
7873

74+
use ebml::{Doc, EbmlEncoderTag, EsBool, EsEnum, EsEnumBody, EsEnumVid};
75+
use ebml::{EsI16, EsI32, EsI64, EsI8, EsInt};
76+
use ebml::{EsLabel, EsOpaque, EsStr, EsU16, EsU32, EsU64, EsU8, EsUint};
77+
use ebml::{EsVec, EsVecElt, EsVecLen, TaggedDoc};
7978
use serialize;
8079

81-
use core::prelude::*;
8280
use core::cast::transmute;
8381
use core::int;
8482
use core::io;
@@ -323,14 +321,12 @@ pub mod reader {
323321
r_doc
324322
}
325323

326-
fn push_doc<T>(&mut self, exp_tag: EbmlEncoderTag,
327-
f: &fn(&mut Decoder) -> T) -> T {
328-
let d = self.next_doc(exp_tag);
324+
fn push_doc<T>(&mut self, d: Doc, f: &fn() -> T) -> T {
329325
let old_parent = self.parent;
330326
let old_pos = self.pos;
331327
self.parent = d;
332328
self.pos = d.start;
333-
let r = f(self);
329+
let r = f();
334330
self.parent = old_parent;
335331
self.pos = old_pos;
336332
r
@@ -399,21 +395,10 @@ pub mod reader {
399395
doc_as_u8(self.next_doc(EsBool)) as bool
400396
}
401397

402-
fn read_f64(&mut self) -> f64 {
403-
let bits = doc_as_u64(self.next_doc(EsF64));
404-
unsafe { transmute(bits) }
405-
}
406-
fn read_f32(&mut self) -> f32 {
407-
let bits = doc_as_u32(self.next_doc(EsF32));
408-
unsafe { transmute(bits) }
409-
}
410-
fn read_float(&mut self) -> float {
411-
let bits = doc_as_u64(self.next_doc(EsFloat));
412-
(unsafe { transmute::<u64, f64>(bits) }) as float
413-
}
414-
fn read_char(&mut self) -> char {
415-
doc_as_u32(self.next_doc(EsChar)) as char
416-
}
398+
fn read_f64(&mut self) -> f64 { fail!("read_f64()"); }
399+
fn read_f32(&mut self) -> f32 { fail!("read_f32()"); }
400+
fn read_float(&mut self) -> float { fail!("read_float()"); }
401+
fn read_char(&mut self) -> char { fail!("read_char()"); }
417402
fn read_str(&mut self) -> ~str { doc_as_str(self.next_doc(EsStr)) }
418403

419404
// Compound types:
@@ -556,50 +541,66 @@ pub mod reader {
556541

557542
fn read_seq<T>(&mut self, f: &fn(&mut Decoder, uint) -> T) -> T {
558543
debug!("read_seq()");
559-
do self.push_doc(EsVec) |d| {
560-
let len = d._next_uint(EsVecLen);
561-
debug!(" len=%u", len);
562-
f(d, len)
563-
}
544+
let doc = self.next_doc(EsVec);
545+
546+
let (old_parent, old_pos) = (self.parent, self.pos);
547+
self.parent = doc;
548+
self.pos = self.parent.start;
549+
550+
let len = self._next_uint(EsVecLen);
551+
debug!(" len=%u", len);
552+
let result = f(self, len);
553+
554+
self.parent = old_parent;
555+
self.pos = old_pos;
556+
result
564557
}
565558

566559
fn read_seq_elt<T>(&mut self, idx: uint, f: &fn(&mut Decoder) -> T)
567560
-> T {
568561
debug!("read_seq_elt(idx=%u)", idx);
569-
self.push_doc(EsVecElt, f)
562+
let doc = self.next_doc(EsVecElt);
563+
564+
let (old_parent, old_pos) = (self.parent, self.pos);
565+
self.parent = doc;
566+
self.pos = self.parent.start;
567+
568+
let result = f(self);
569+
570+
self.parent = old_parent;
571+
self.pos = old_pos;
572+
result
570573
}
571574

572-
fn read_map<T>(&mut self, f: &fn(&mut Decoder, uint) -> T) -> T {
575+
fn read_map<T>(&mut self, _: &fn(&mut Decoder, uint) -> T) -> T {
573576
debug!("read_map()");
574-
do self.push_doc(EsMap) |d| {
575-
let len = d._next_uint(EsMapLen);
576-
debug!(" len=%u", len);
577-
f(d, len)
578-
}
577+
fail!("read_map is unimplemented");
579578
}
580579

581580
fn read_map_elt_key<T>(&mut self,
582581
idx: uint,
583-
f: &fn(&mut Decoder) -> T)
582+
_: &fn(&mut Decoder) -> T)
584583
-> T {
585584
debug!("read_map_elt_key(idx=%u)", idx);
586-
self.push_doc(EsMapKey, f)
585+
fail!("read_map_elt_val is unimplemented");
587586
}
588587

589588
fn read_map_elt_val<T>(&mut self,
590589
idx: uint,
591-
f: &fn(&mut Decoder) -> T)
590+
_: &fn(&mut Decoder) -> T)
592591
-> T {
593592
debug!("read_map_elt_val(idx=%u)", idx);
594-
self.push_doc(EsMapVal, f)
593+
fail!("read_map_elt_val is unimplemented");
595594
}
596595
}
597596
}
598597

599598
pub mod writer {
600-
use super::*;
599+
use ebml::{EbmlEncoderTag, EsBool, EsEnum, EsEnumBody, EsEnumVid};
600+
use ebml::{EsI16, EsI32, EsI64, EsI8, EsInt};
601+
use ebml::{EsLabel, EsOpaque, EsStr, EsU16, EsU32, EsU64, EsU8, EsUint};
602+
use ebml::{EsVec, EsVecElt, EsVecLen};
601603

602-
use core::cast;
603604
use core::io;
604605
use core::str;
605606

@@ -805,21 +806,19 @@ pub mod writer {
805806
self.wr_tagged_u8(EsBool as uint, v as u8)
806807
}
807808

808-
fn emit_f64(&mut self, v: f64) {
809-
let bits = unsafe { cast::transmute(v) };
810-
self.wr_tagged_u64(EsF64 as uint, bits);
809+
// FIXME (#2742): implement these
810+
fn emit_f64(&mut self, _v: f64) {
811+
fail!("Unimplemented: serializing an f64");
811812
}
812-
fn emit_f32(&mut self, v: f32) {
813-
let bits = unsafe { cast::transmute(v) };
814-
self.wr_tagged_u32(EsF32 as uint, bits);
813+
fn emit_f32(&mut self, _v: f32) {
814+
fail!("Unimplemented: serializing an f32");
815815
}
816-
fn emit_float(&mut self, v: float) {
817-
let bits = unsafe { cast::transmute(v as f64) };
818-
self.wr_tagged_u64(EsFloat as uint, bits);
816+
fn emit_float(&mut self, _v: float) {
817+
fail!("Unimplemented: serializing a float");
819818
}
820819

821-
fn emit_char(&mut self, v: char) {
822-
self.wr_tagged_u32(EsChar as uint, v as u32);
820+
fn emit_char(&mut self, _v: char) {
821+
fail!("Unimplemented: serializing a char");
823822
}
824823

825824
fn emit_str(&mut self, v: &str) {
@@ -915,23 +914,16 @@ pub mod writer {
915914
self.end_tag();
916915
}
917916

918-
fn emit_map(&mut self, len: uint, f: &fn(&mut Encoder)) {
919-
self.start_tag(EsMap as uint);
920-
self._emit_tagged_uint(EsMapLen, len);
921-
f(self);
922-
self.end_tag();
917+
fn emit_map(&mut self, _len: uint, _f: &fn(&mut Encoder)) {
918+
fail!("emit_map is unimplemented");
923919
}
924920

925-
fn emit_map_elt_key(&mut self, _idx: uint, f: &fn(&mut Encoder)) {
926-
self.start_tag(EsMapKey as uint);
927-
f(self);
928-
self.end_tag();
921+
fn emit_map_elt_key(&mut self, _idx: uint, _f: &fn(&mut Encoder)) {
922+
fail!("emit_map_elt_key is unimplemented");
929923
}
930924

931-
fn emit_map_elt_val(&mut self, _idx: uint, f: &fn(&mut Encoder)) {
932-
self.start_tag(EsMapVal as uint);
933-
f(self);
934-
self.end_tag();
925+
fn emit_map_elt_val(&mut self, _idx: uint, _f: &fn(&mut Encoder)) {
926+
fail!("emit_map_elt_val is unimplemented");
935927
}
936928
}
937929
}

trunk/src/libextra/serialize.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -375,18 +375,6 @@ impl<D:Decoder> Decodable<D> for bool {
375375
}
376376
}
377377

378-
impl<S:Encoder> Encodable<S> for char {
379-
fn encode(&self, s: &mut S) {
380-
s.emit_char(*self)
381-
}
382-
}
383-
384-
impl<D:Decoder> Decodable<D> for char {
385-
fn decode(d: &mut D) -> char {
386-
d.read_char()
387-
}
388-
}
389-
390378
impl<S:Encoder> Encodable<S> for () {
391379
fn encode(&self, s: &mut S) {
392380
s.emit_nil()

trunk/src/librustc/middle/trans/adt.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ fn build_const_struct(ccx: @CrateContext, st: &Struct, vals: &[ValueRef])
563563
vals[i]
564564
};
565565
cfields.push(val);
566+
offset += machine::llsize_of_alloc(ccx, llty) as u64
566567
}
567568

568569
return cfields;

0 commit comments

Comments
 (0)