Skip to content

Commit e8e8aaf

Browse files
jesse99brson
authored andcommitted
---
yaml --- r: 33741 b: refs/heads/snap-stage3 c: 68c852a h: refs/heads/master i: 33739: 5c72102 v: v3
1 parent fb77969 commit e8e8aaf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+737
-602
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 67d421d62dcfe5ee6c45970aaf25ddaf4cc577df
4+
refs/heads/snap-stage3: 68c852ad3aa4b27b5295a8e7da288798afeea2c4
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/doc/README

Lines changed: 0 additions & 13 deletions
This file was deleted.

branches/snap-stage3/doc/rust.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,8 +1304,9 @@ Attributes may appear as any of
13041304
* An identifier followed by the equals sign '=' and a literal, providing a key/value pair
13051305
* An identifier followed by a parenthesized list of sub-attribute arguments
13061306

1307-
Attributes terminated by a semi-colon apply to the entity that the attribute is declared
1308-
within. Attributes that are not terminated by a semi-colon apply to the next entity.
1307+
Attributes are applied to an entity by placing them within a hash-list
1308+
(`#[...]`) as either a prefix to the entity or as a semicolon-delimited
1309+
declaration within the entity body.
13091310

13101311
An example of attributes:
13111312

@@ -1325,9 +1326,9 @@ mod bar {
13251326
...
13261327
}
13271328
1328-
// A lint attribute used to suppress a warning/error
1329-
#[allow(non_camel_case_types)]
1330-
pub type int8_t = i8;
1329+
// A documentation attribute
1330+
#[doc = "Add two numbers together."]
1331+
fn add(x: int, y: int) { x + y }
13311332
~~~~~~~~
13321333

13331334
> **Note:** In future versions of Rust, user-provided extensions to the compiler will be able to interpret attributes.
@@ -1340,8 +1341,6 @@ names are effectively reserved. Some significant attributes include:
13401341
* The `cfg` attribute, for conditional-compilation by build-configuration.
13411342
* The `link` attribute, for describing linkage metadata for a crate.
13421343
* The `test` attribute, for marking functions as unit tests.
1343-
* The `allow`, `warn`, `forbid`, and `deny` attributes, for controling lint checks. Lint checks supported
1344-
by the compiler can be found via `rustc -W help`.
13451344

13461345
Other attributes may be added or removed during development of the language.
13471346

@@ -1547,9 +1546,7 @@ it is automatically derferenced to make the field access possible.
15471546
### Vector expressions
15481547

15491548
~~~~~~~~{.ebnf .gram}
1550-
vec_expr : '[' "mut"? vec_elems? ']'
1551-
1552-
vec_elems : [expr [',' expr]*] | [expr ',' ".." expr]
1549+
vec_expr : '[' "mut" ? [ expr [ ',' expr ] * ] ? ']'
15531550
~~~~~~~~
15541551

15551552
A [_vector_](#vector-types) _expression_ is written by enclosing zero or
@@ -1559,10 +1556,8 @@ indicate that the elements of the resulting vector may be mutated.
15591556
When no mutability is specified, the vector is immutable.
15601557

15611558
~~~~
1562-
[]
15631559
[1, 2, 3, 4];
15641560
["a", "b", "c", "d"];
1565-
[0, ..128]; // vector with 128 zeros
15661561
[mut 0u8, 0u8, 0u8, 0u8];
15671562
~~~~
15681563

@@ -1894,7 +1889,7 @@ let x: int = add(1, 2);
18941889

18951890
~~~~~~~~ {.abnf .gram}
18961891
ident_list : [ ident [ ',' ident ]* ] ? ;
1897-
lambda_expr : '|' ident_list '|' expr ;
1892+
lambda_expr : '|' ident_list '| expr ;
18981893
~~~~~~~~
18991894

19001895
A _lambda expression_ (a.k.a. "anonymous function expression") defines a function and denotes it as a value,

branches/snap-stage3/src/libcore/extfmt.rs

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,4 @@
1-
//! Support for fmt! expressions.
2-
//!
3-
//! The syntax is close to that of Posix format strings:
4-
//!
5-
//! ~~~~~~
6-
//! Format := '%' Parameter? Flag* Width? Precision? Type
7-
//! Parameter := [0-9]+ '$'
8-
//! Flag := [ 0#+-]
9-
//! Width := Parameter | [0-9]+
10-
//! Precision := '.' [0-9]+
11-
//! Type := [bcdfiostuxX?]
12-
//! ~~~~~~
13-
//!
14-
//! * Parameter is the 1-based argument to apply the format to. Currently not implemented.
15-
//! * Flag 0 causes leading zeros to be used for padding when converting numbers.
16-
//! * Flag # causes the conversion to be done in an *alternative* manner. Currently not implemented.
17-
//! * Flag + causes signed numbers to always be prepended with a sign character.
18-
//! * Flag - left justifies the result
19-
//! * Width specifies the minimum field width of the result. By default leading spaces are added.
20-
//! * Precision specifies the minimum number of digits for integral types and the minimum number
21-
//! of decimal places for float.
22-
//!
23-
//! The types currently supported are:
24-
//!
25-
//! * b - bool
26-
//! * c - char
27-
//! * d - int
28-
//! * f - float
29-
//! * i - int (same as d)
30-
//! * o - uint as octal
31-
//! * t - uint as binary
32-
//! * u - uint
33-
//! * x - uint as lower-case hexadecimal
34-
//! * X - uint as upper-case hexadecimal
35-
//! * s - str (any flavor)
36-
//! * ? - arbitrary type (does not use the to_str trait)
37-
1+
#[doc(hidden)];
382
// NB: transitionary, de-mode-ing.
393
#[forbid(deprecated_mode)];
404
#[forbid(deprecated_pattern)];
@@ -80,7 +44,6 @@ use option::{Some, None};
8044
*/
8145

8246
// Functions used by the fmt extension at compile time
83-
#[doc(hidden)]
8447
pub mod ct {
8548
pub enum Signedness { Signed, Unsigned, }
8649
pub enum Caseness { CaseUpper, CaseLower, }
@@ -314,7 +277,6 @@ pub mod ct {
314277
// decisions made a runtime. If it proves worthwhile then some of these
315278
// conditions can be evaluated at compile-time. For now though it's cleaner to
316279
// implement it 0this way, I think.
317-
#[doc(hidden)]
318280
pub mod rt {
319281
pub const flag_none : u32 = 0u32;
320282
pub const flag_left_justify : u32 = 0b00000000000001u32;
@@ -502,7 +464,6 @@ pub mod rt {
502464
}
503465
}
504466

505-
// Bulk of the tests are in src/test/run-pass/syntax-extension-fmt.rs
506467
#[cfg(test)]
507468
mod test {
508469
#[test]

branches/snap-stage3/src/libcore/mutable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl<T> Data<T> {
4848
}
4949
}
5050

51-
fn borrow_const<R>(op: &fn(t: &const T) -> R) -> R {
51+
pure fn borrow_const<R>(op: &fn(t: &const T) -> R) -> R {
5252
op(&const self.value)
5353
}
5454

branches/snap-stage3/src/libfuzzer/fuzzer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ fn as_str(f: fn@(+x: io::Writer)) -> ~str {
225225
io::with_str_writer(f)
226226
}
227227

228-
fn check_variants_of_ast(crate: ast::crate, codemap: codemap::CodeMap,
228+
fn check_variants_of_ast(crate: ast::crate, codemap: @codemap::CodeMap,
229229
filename: &Path, cx: context) {
230230
let stolen = steal(crate, cx.mode);
231231
let extra_exprs = vec::filter(common_exprs(),
@@ -239,7 +239,7 @@ fn check_variants_of_ast(crate: ast::crate, codemap: codemap::CodeMap,
239239

240240
fn check_variants_T<T: Copy>(
241241
crate: ast::crate,
242-
codemap: codemap::CodeMap,
242+
codemap: @codemap::CodeMap,
243243
filename: &Path,
244244
thing_label: ~str,
245245
things: ~[T],

branches/snap-stage3/src/librustc/driver/driver.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ fn pretty_print_input(sess: Session, cfg: ast::crate_cfg, input: input,
366366
ppm_expanded | ppm_normal => pprust::no_ann()
367367
};
368368
let is_expanded = upto != cu_parse;
369-
let src = codemap::get_filemap(sess.codemap, source_name(input)).src;
369+
let src = sess.codemap.get_filemap(source_name(input)).src;
370370
do io::with_str_reader(*src) |rdr| {
371371
pprust::print_crate(sess.codemap, sess.parse_sess.interner,
372372
sess.span_diagnostic, crate,
@@ -586,7 +586,7 @@ fn build_session_options(binary: ~str,
586586

587587
fn build_session(sopts: @session::options,
588588
demitter: diagnostic::emitter) -> Session {
589-
let codemap = codemap::new_codemap();
589+
let codemap = @codemap::CodeMap::new();
590590
let diagnostic_handler =
591591
diagnostic::mk_handler(Some(demitter));
592592
let span_diagnostic_handler =
@@ -595,7 +595,7 @@ fn build_session(sopts: @session::options,
595595
}
596596

597597
fn build_session_(sopts: @session::options,
598-
cm: codemap::CodeMap,
598+
cm: @codemap::CodeMap,
599599
demitter: diagnostic::emitter,
600600
span_diagnostic_handler: diagnostic::span_handler)
601601
-> Session {

branches/snap-stage3/src/librustc/driver/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ type Session_ = {targ_cfg: @config,
131131
opts: @options,
132132
cstore: metadata::cstore::CStore,
133133
parse_sess: parse_sess,
134-
codemap: codemap::CodeMap,
134+
codemap: @codemap::CodeMap,
135135
// For a library crate, this is always none
136136
mut main_fn: Option<(node_id, codemap::span)>,
137137
span_diagnostic: diagnostic::span_handler,

branches/snap-stage3/src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::Serializer,
557557
let add_to_index = |copy ebml_w| add_to_index_(item, ebml_w, index);
558558

559559
debug!("encoding info for item at %s",
560-
syntax::codemap::span_to_str(item.span, ecx.tcx.sess.codemap));
560+
ecx.tcx.sess.codemap.span_to_str(item.span));
561561

562562
match item.node {
563563
item_const(_, _) => {

branches/snap-stage3/src/librustc/middle/liveness.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ use std::map::HashMap;
9797
use syntax::{visit, ast_util};
9898
use syntax::print::pprust::{expr_to_str, block_to_str};
9999
use visit::vt;
100-
use syntax::codemap::{span, span_to_str};
100+
use syntax::codemap::span;
101101
use syntax::ast::*;
102102
use io::WriterUtil;
103103
use capture::{cap_move, cap_drop, cap_copy, cap_ref};
@@ -170,9 +170,9 @@ impl LiveNodeKind : cmp::Eq {
170170
fn live_node_kind_to_str(lnk: LiveNodeKind, cx: ty::ctxt) -> ~str {
171171
let cm = cx.sess.codemap;
172172
match lnk {
173-
FreeVarNode(s) => fmt!("Free var node [%s]", span_to_str(s, cm)),
174-
ExprNode(s) => fmt!("Expr node [%s]", span_to_str(s, cm)),
175-
VarDefNode(s) => fmt!("Var def node [%s]", span_to_str(s, cm)),
173+
FreeVarNode(s) => fmt!("Free var node [%s]", cm.span_to_str(s)),
174+
ExprNode(s) => fmt!("Expr node [%s]", cm.span_to_str(s)),
175+
VarDefNode(s) => fmt!("Var def node [%s]", cm.span_to_str(s)),
176176
ExitNode => ~"Exit node"
177177
}
178178
}

branches/snap-stage3/src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ fn trans_trace(bcx: block, sp_opt: Option<span>, trace_str: ~str) {
919919
let {V_filename, V_line} = match sp_opt {
920920
Some(sp) => {
921921
let sess = bcx.sess();
922-
let loc = codemap::lookup_char_pos(sess.parse_sess.cm, sp.lo);
922+
let loc = sess.parse_sess.cm.lookup_char_pos(sp.lo);
923923
{V_filename: C_cstr(bcx.ccx(), loc.file.name),
924924
V_line: loc.line as int}
925925
}

branches/snap-stage3/src/librustc/middle/trans/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ fn _UndefReturn(cx: block, Fn: ValueRef) -> ValueRef {
645645
fn add_span_comment(bcx: block, sp: span, text: ~str) {
646646
let ccx = bcx.ccx();
647647
if !ccx.sess.no_asm_comments() {
648-
let s = text + ~" (" + codemap::span_to_str(sp, ccx.sess.codemap)
648+
let s = text + ~" (" + ccx.sess.codemap.span_to_str(sp)
649649
+ ~")";
650650
log(debug, s);
651651
add_comment(bcx, s);

branches/snap-stage3/src/librustc/middle/trans/controlflow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ fn trans_fail_value(bcx: block, sp_opt: Option<span>, V_fail_str: ValueRef)
339339
let {V_filename, V_line} = match sp_opt {
340340
Some(sp) => {
341341
let sess = bcx.sess();
342-
let loc = codemap::lookup_char_pos(sess.parse_sess.cm, sp.lo);
342+
let loc = sess.parse_sess.cm.lookup_char_pos(sp.lo);
343343
{V_filename: C_cstr(bcx.ccx(), loc.file.name),
344344
V_line: loc.line as int}
345345
}
@@ -361,7 +361,7 @@ fn trans_fail_bounds_check(bcx: block, sp: span,
361361
let _icx = bcx.insn_ctxt("trans_fail_bounds_check");
362362
let ccx = bcx.ccx();
363363
364-
let loc = codemap::lookup_char_pos(bcx.sess().parse_sess.cm, sp.lo);
364+
let loc = bcx.sess().parse_sess.cm.lookup_char_pos(sp.lo);
365365
let line = C_int(ccx, loc.line as int);
366366
let filename_cstr = C_cstr(bcx.ccx(), loc.file.name);
367367
let filename = PointerCast(bcx, filename_cstr, T_ptr(T_i8()));

branches/snap-stage3/src/librustc/middle/trans/debuginfo.rs

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use trans::build::B;
88
use middle::ty;
99
use syntax::{ast, codemap, ast_util, ast_map};
1010
use syntax::parse::token::ident_interner;
11-
use codemap::span;
11+
use codemap::{span, CharPos};
1212
use ast::Ty;
1313
use pat_util::*;
1414
use util::ppaux::ty_to_str;
@@ -112,7 +112,7 @@ type compile_unit_md = {name: ~str};
112112
type subprogram_md = {id: ast::node_id};
113113
type local_var_md = {id: ast::node_id};
114114
type tydesc_md = {hash: uint};
115-
type block_md = {start: codemap::loc, end: codemap::loc};
115+
type block_md = {start: codemap::Loc, end: codemap::Loc};
116116
type argument_md = {id: ast::node_id};
117117
type retval_md = {id: ast::node_id};
118118

@@ -229,8 +229,8 @@ fn create_file(cx: @crate_ctxt, full_path: ~str) -> @metadata<file_md> {
229229
return mdval;
230230
}
231231

232-
fn line_from_span(cm: codemap::CodeMap, sp: span) -> uint {
233-
codemap::lookup_char_pos(cm, sp.lo).line
232+
fn line_from_span(cm: @codemap::CodeMap, sp: span) -> uint {
233+
cm.lookup_char_pos(sp.lo).line
234234
}
235235

236236
fn create_block(cx: block) -> @metadata<block_md> {
@@ -244,9 +244,9 @@ fn create_block(cx: block) -> @metadata<block_md> {
244244
}
245245
let sp = cx.node_info.get().span;
246246

247-
let start = codemap::lookup_char_pos(cx.sess().codemap, sp.lo);
247+
let start = cx.sess().codemap.lookup_char_pos(sp.lo);
248248
let fname = start.file.name;
249-
let end = codemap::lookup_char_pos(cx.sess().codemap, sp.hi);
249+
let end = cx.sess().codemap.lookup_char_pos(sp.hi);
250250
let tg = LexicalBlockTag;
251251
/*alt cached_metadata::<@metadata<block_md>>(
252252
cache, tg,
@@ -266,8 +266,8 @@ fn create_block(cx: block) -> @metadata<block_md> {
266266
};
267267
let lldata = ~[lltag(tg),
268268
parent,
269-
lli32(start.line as int),
270-
lli32(start.col as int),
269+
lli32(start.line.to_int()),
270+
lli32(start.col.to_int()),
271271
file_node.node,
272272
lli32(unique_id)
273273
];
@@ -597,7 +597,7 @@ fn create_ty(_cx: @crate_ctxt, _t: ty::t, _ty: @ast::Ty)
597597
}
598598

599599
fn filename_from_span(cx: @crate_ctxt, sp: codemap::span) -> ~str {
600-
codemap::lookup_char_pos(cx.sess.codemap, sp.lo).file.name
600+
cx.sess.codemap.lookup_char_pos(sp.lo).file.name
601601
}
602602

603603
fn create_var(type_tag: int, context: ValueRef, name: ~str, file: ValueRef,
@@ -629,8 +629,7 @@ fn create_local_var(bcx: block, local: @ast::local)
629629
// FIXME this should be handled (#2533)
630630
_ => fail ~"no single variable name for local"
631631
};
632-
let loc = codemap::lookup_char_pos(cx.sess.codemap,
633-
local.span.lo);
632+
let loc = cx.sess.codemap.lookup_char_pos(local.span.lo);
634633
let ty = node_id_type(bcx, local.node.id);
635634
let tymd = create_ty(cx, ty, local.node.ty);
636635
let filemd = create_file(cx, loc.file.name);
@@ -674,8 +673,7 @@ fn create_arg(bcx: block, arg: ast::arg, sp: span)
674673
option::None => ()
675674
}
676675

677-
let loc = codemap::lookup_char_pos(cx.sess.codemap,
678-
sp.lo);
676+
let loc = cx.sess.codemap.lookup_char_pos(sp.lo);
679677
let ty = node_id_type(bcx, arg.id);
680678
let tymd = create_ty(cx, ty, arg.ty);
681679
let filemd = create_file(cx, loc.file.name);
@@ -714,9 +712,9 @@ fn update_source_pos(cx: block, s: span) {
714712
}
715713
let cm = cx.sess().codemap;
716714
let blockmd = create_block(cx);
717-
let loc = codemap::lookup_char_pos(cm, s.lo);
718-
let scopedata = ~[lli32(loc.line as int),
719-
lli32(loc.col as int),
715+
let loc = cm.lookup_char_pos(s.lo);
716+
let scopedata = ~[lli32(loc.line.to_int()),
717+
lli32(loc.col.to_int()),
720718
blockmd.node,
721719
llnull()];
722720
let dbgscope = llmdnode(scopedata);
@@ -731,7 +729,7 @@ fn create_function(fcx: fn_ctxt) -> @metadata<subprogram_md> {
731729
log(debug, fcx.id);
732730

733731
let sp = fcx.span.get();
734-
log(debug, codemap::span_to_str(sp, cx.sess.codemap));
732+
log(debug, cx.sess.codemap.span_to_str(sp));
735733

736734
let (ident, ret_ty, id) = match cx.tcx.items.get(fcx.id) {
737735
ast_map::node_item(item, _) => {
@@ -773,8 +771,7 @@ fn create_function(fcx: fn_ctxt) -> @metadata<subprogram_md> {
773771
option::None => ()
774772
}
775773

776-
let loc = codemap::lookup_char_pos(cx.sess.codemap,
777-
sp.lo);
774+
let loc = cx.sess.codemap.lookup_char_pos(sp.lo);
778775
let file_node = create_file(cx, loc.file.name).node;
779776
let ty_node = if cx.sess.opts.extra_debuginfo {
780777
match ret_ty.node {

0 commit comments

Comments
 (0)