Skip to content

Commit e64a3cc

Browse files
committed
---
yaml --- r: 148314 b: refs/heads/try2 c: f98f76e h: refs/heads/master v: v3
1 parent e634bc4 commit e64a3cc

File tree

10 files changed

+125
-64
lines changed

10 files changed

+125
-64
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: e6a27424adba041d64d29c4339edc5015536f285
8+
refs/heads/try2: f98f76e3a75b4d75d809601ce1d6fa62d3eca428
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/Makefile.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,6 @@ DRIVER_CRATE := $(S)src/driver/driver.rs
371371
LLVM_COMPONENTS=x86 arm mips ipo bitreader bitwriter linker asmparser jit mcjit \
372372
interpreter instrumentation
373373

374-
# Only build these LLVM tools
375-
LLVM_TOOLS=bugpoint llc llvm-ar llvm-as llvm-dis llvm-mc opt
376-
377374
define DEF_LLVM_VARS
378375
# The configure script defines these variables with the target triples
379376
# separated by Z. This defines new ones with the expected format.

branches/try2/doc/index.md

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,52 @@
44
<style type="text/css">
55
#TOC { display: none; }
66
.header-section-number { display: none; }
7-
li {list-style-type: none; }
87
</style>
98

10-
* [The Rust tutorial](tutorial.html) (* [PDF](tutorial.pdf))
11-
* [The Rust reference manual](rust.html) (* [PDF](rust.pdf))
9+
[The Rust tutorial](tutorial.html) ([PDF](tutorial.pdf))
10+
[The Rust reference manual](rust.html) ([PDF](rust.pdf))
1211

1312
# Guides
1413

15-
* [Pointers](guide-pointers.html)
16-
* [References and Lifetimes](guide-lifetimes.html)
17-
* [Containers and Iterators](guide-container.html)
18-
* [Tasks and Communication](guide-tasks.html)
19-
* [Foreign Function Interface](guide-ffi.html)
20-
* [Macros](guide-macros.html)
21-
* [Packaging](guide-rustpkg.html)
22-
* [Testing](guide-testing.html)
23-
* [Conditions](guide-conditions.html)
24-
* [Rust's Runtime](guide-runtime.html)
14+
[Pointers](guide-pointers.html)
15+
[References and Lifetimes](guide-lifetimes.html)
16+
[Containers and Iterators](guide-container.html)
17+
[Tasks and Communication](guide-tasks.html)
18+
[Foreign Function Interface](guide-ffi.html)
19+
[Macros](guide-macros.html)
20+
[Packaging](guide-rustpkg.html)
21+
[Testing](guide-testing.html)
22+
[Conditions](guide-conditions.html)
23+
[Rust's Runtime](guide-runtime.html)
2524

2625
# Libraries
2726

28-
* [The standard library, `libstd`](std/index.html)
29-
* [The extra library, `libextra`](extra/index.html)
27+
[The standard library, `libstd`](std/index.html)
28+
[The extra library, `libextra`](extra/index.html)
3029

31-
* [The M:N runtime library, `libgreen`](green/index.html)
32-
* [The 1:1 runtime library, `libnative`](native/index.html)
30+
[The M:N runtime library, `libgreen`](green/index.html)
31+
[The 1:1 runtime library, `libnative`](native/index.html)
3332

34-
* [The Rust libuv library, `librustuv`](rustuv/index.html)
35-
* [The Rust packaging library, `librustpkg`](rustpkg/index.html)
33+
[The Rust libuv library, `librustuv`](rustuv/index.html)
34+
[The Rust packaging library, `librustpkg`](rustpkg/index.html)
3635

37-
* [The Rust parser, `libsyntax`](syntax/index.html)
38-
* [The Rust compiler, `librustc`](rustc/index.html)
36+
[The Rust parser, `libsyntax`](syntax/index.html)
37+
[The Rust compiler, `librustc`](rustc/index.html)
3938

4039
# Tooling
4140

42-
* [The `rustdoc` manual](rustdoc.html)
43-
* [The `rustpkg` manual](rustpkg.html)
41+
[The `rustpkg` manual](rustpkg.html)
4442

4543
# FAQs
4644

47-
* [Language FAQ](complement-lang-faq.html)
48-
* [Project FAQ](complement-project-faq.html)
49-
* [Usage FAQ](complement-usage-faq.html)
50-
* [Code cheatsheet](complement-cheatsheet.html) - "How do I do X?"
51-
* [How to submit a bug report](complement-bugreport.html)
45+
[Language FAQ](complement-lang-faq.html)
46+
[Project FAQ](complement-project-faq.html)
47+
[Usage FAQ](complement-usage-faq.html)
48+
[Code cheatsheet](complement-cheatsheet.html) - "How do I do X?"
49+
[How to submit a bug report](complement-bugreport.html)
5250

5351
# External resources
5452

55-
* The Rust [IRC channel](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust) - `#rust` on irc.mozilla.org
56-
* The Rust community on [Reddit](http://reddit.com/r/rust)
57-
* The Rust [wiki](http://github.com/mozilla/rust/wiki)
53+
The Rust [IRC channel](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust) - `#rust` on irc.mozilla.org
54+
The Rust community on [Reddit](http://reddit.com/r/rust)
55+
The Rust [wiki](http://github.com/mozilla/rust/wiki)

branches/try2/mk/llvm.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ LLVM_STAMP_$(1) = $$(CFG_LLVM_BUILD_DIR_$(1))/llvm-auto-clean-stamp
2828

2929
$$(LLVM_CONFIG_$(1)): $$(LLVM_DEPS) $$(LLVM_STAMP_$(1))
3030
@$$(call E, make: llvm)
31-
$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) $$(CFG_LLVM_BUILD_ENV_$(1)) ONLY_TOOLS="$$(LLVM_TOOLS)"
31+
$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) $$(CFG_LLVM_BUILD_ENV_$(1))
3232
$$(Q)touch $$(LLVM_CONFIG_$(1))
3333
endif
3434

branches/try2/src/libnative/bookeeping.rs renamed to branches/try2/src/libnative/bookkeeping.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -8,13 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! 1:1 Task bookeeping
11+
//! 1:1 Task bookkeeping
1212
//!
1313
//! This module keeps track of the number of running 1:1 tasks so that entry
1414
//! points with libnative know when it's possible to exit the program (once all
1515
//! tasks have exited).
1616
//!
17-
//! The green counterpart for this is bookeeping on sched pools.
17+
//! The green counterpart for this is bookkeeping on sched pools.
1818
1919
use std::sync::atomics;
2020
use std::unstable::mutex::{Mutex, MUTEX_INIT};

branches/try2/src/libnative/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -29,7 +29,7 @@
2929
use std::os;
3030
use std::rt;
3131

32-
mod bookeeping;
32+
mod bookkeeping;
3333
pub mod io;
3434
pub mod task;
3535

@@ -75,6 +75,6 @@ pub fn start(argc: int, argv: **u8, main: proc()) -> int {
7575
/// number of arguments.
7676
pub fn run(main: proc()) -> int {
7777
main();
78-
bookeeping::wait_for_other_tasks();
78+
bookkeeping::wait_for_other_tasks();
7979
os::get_exit_status()
8080
}

branches/try2/src/libnative/task.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -27,7 +27,7 @@ use std::unstable::stack;
2727

2828
use io;
2929
use task;
30-
use bookeeping;
30+
use bookkeeping;
3131

3232
/// Creates a new Task which is ready to execute as a 1:1 task.
3333
pub fn new(stack_bounds: (uint, uint)) -> ~Task {
@@ -82,7 +82,7 @@ pub fn spawn_opts(opts: TaskOpts, f: proc()) {
8282
// Note that this increment must happen *before* the spawn in order to
8383
// guarantee that if this task exits it will always end up waiting for the
8484
// spawned task to exit.
85-
bookeeping::increment();
85+
bookkeeping::increment();
8686

8787
// Spawning a new OS thread guarantees that __morestack will never get
8888
// triggered, but we must manually set up the actual stack bounds once this
@@ -104,7 +104,7 @@ pub fn spawn_opts(opts: TaskOpts, f: proc()) {
104104
let mut task = task;
105105
task.put_runtime(ops as ~rt::Runtime);
106106
task.run(|| { f.take_unwrap()() });
107-
bookeeping::decrement();
107+
bookkeeping::decrement();
108108
})
109109
}
110110

branches/try2/src/libstd/path/windows.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,8 @@ impl GenericPathUnsafe for Path {
261261
let mut s = str::with_capacity(me.repr.len() + 1 + pathlen);
262262
s.push_str(me.repr);
263263
let plen = me.prefix_len();
264-
// if me is "C:" we don't want to add a path separator
265-
match me.prefix {
266-
Some(DiskPrefix) if me.repr.len() == plen => (),
267-
_ if !(me.repr.len() > plen && me.repr[me.repr.len()-1] == sep as u8) => {
268-
s.push_char(sep);
269-
}
270-
_ => ()
264+
if !(me.repr.len() > plen && me.repr[me.repr.len()-1] == sep as u8) {
265+
s.push_char(sep);
271266
}
272267
match path_ {
273268
None => s.push_str(path),
@@ -1554,8 +1549,6 @@ mod tests {
15541549
t!(s: "C:a\\b\\c", "C:d", "C:a\\b\\c\\d");
15551550
t!(s: "C:a\\b", "..\\..\\..\\c", "C:..\\c");
15561551
t!(s: "C:\\a\\b", "..\\..\\..\\c", "C:\\c");
1557-
t!(s: "C:", r"a\b\c", r"C:a\b\c");
1558-
t!(s: "C:", r"..\a", r"C:..\a");
15591552
t!(s: "\\\\server\\share\\foo", "bar", "\\\\server\\share\\foo\\bar");
15601553
t!(s: "\\\\server\\share\\foo", "..\\..\\bar", "\\\\server\\share\\bar");
15611554
t!(s: "\\\\server\\share\\foo", "C:baz", "C:baz");

branches/try2/src/libsyntax/codemap.rs

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,15 @@ pub struct FileLines
191191
lines: ~[uint]
192192
}
193193

194+
// represents the origin of a file:
195+
pub enum FileSubstr {
196+
// indicates that this is a normal standalone file:
197+
FssNone,
198+
// indicates that this "file" is actually a substring
199+
// of another file that appears earlier in the codemap
200+
FssInternal(Span),
201+
}
202+
194203
/// Identifies an offset of a multi-byte character in a FileMap
195204
pub struct MultiByteChar {
196205
/// The absolute offset of the character in the CodeMap
@@ -205,6 +214,8 @@ pub struct FileMap {
205214
/// originate from files has names between angle brackets by convention,
206215
/// e.g. `<anon>`
207216
name: FileName,
217+
/// Extra information used by qquote
218+
substr: FileSubstr,
208219
/// The complete source code
209220
src: @str,
210221
/// The start position of this source in the CodeMap
@@ -267,7 +278,16 @@ impl CodeMap {
267278
}
268279
}
269280

281+
/// Add a new FileMap to the CodeMap and return it
270282
pub fn new_filemap(&self, filename: FileName, src: @str) -> @FileMap {
283+
return self.new_filemap_w_substr(filename, FssNone, src);
284+
}
285+
286+
pub fn new_filemap_w_substr(&self,
287+
filename: FileName,
288+
substr: FileSubstr,
289+
src: @str)
290+
-> @FileMap {
271291
let mut files = self.files.borrow_mut();
272292
let start_pos = if files.get().len() == 0 {
273293
0
@@ -278,8 +298,7 @@ impl CodeMap {
278298
};
279299

280300
let filemap = @FileMap {
281-
name: filename,
282-
src: src,
301+
name: filename, substr: substr, src: src,
283302
start_pos: Pos::from_uint(start_pos),
284303
lines: RefCell::new(~[]),
285304
multibyte_chars: RefCell::new(~[]),
@@ -303,16 +322,31 @@ impl CodeMap {
303322

304323
pub fn lookup_char_pos_adj(&self, pos: BytePos) -> LocWithOpt {
305324
let loc = self.lookup_char_pos(pos);
306-
LocWithOpt {
307-
filename: loc.file.name,
308-
line: loc.line,
309-
col: loc.col,
310-
file: Some(loc.file)
325+
match (loc.file.substr) {
326+
FssNone =>
327+
LocWithOpt {
328+
filename: loc.file.name,
329+
line: loc.line,
330+
col: loc.col,
331+
file: Some(loc.file)},
332+
FssInternal(sp) =>
333+
self.lookup_char_pos_adj(
334+
sp.lo + (pos - loc.file.start_pos)),
311335
}
312336
}
313337

314338
pub fn adjust_span(&self, sp: Span) -> Span {
315-
sp
339+
let line = self.lookup_line(sp.lo);
340+
match (line.fm.substr) {
341+
FssNone => sp,
342+
FssInternal(s) => {
343+
self.adjust_span(Span {
344+
lo: s.lo + (sp.lo - line.fm.start_pos),
345+
hi: s.lo + (sp.hi - line.fm.start_pos),
346+
expn_info: sp.expn_info
347+
})
348+
}
349+
}
316350
}
317351

318352
pub fn span_to_str(&self, sp: Span) -> ~str {

branches/try2/src/libsyntax/parse/mod.rs

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
1313

1414
use ast;
15-
use codemap::{Span, CodeMap, FileMap};
15+
use codemap::{Span, CodeMap, FileMap, FileSubstr};
1616
use codemap;
1717
use diagnostic::{SpanHandler, mk_span_handler, mk_handler, Emitter};
1818
use parse::attr::ParserAttr;
@@ -180,6 +180,27 @@ pub fn parse_tts_from_source_str(
180180
maybe_aborted(p.parse_all_token_trees(),p)
181181
}
182182

183+
// given a function and parsing information (source str,
184+
// filename, crate cfg, and sess), create a parser,
185+
// apply the function, and check that the parser
186+
// consumed all of the input before returning the function's
187+
// result.
188+
pub fn parse_from_source_str<T>(
189+
f: |&mut Parser| -> T,
190+
name: @str,
191+
ss: codemap::FileSubstr,
192+
source: @str,
193+
cfg: ast::CrateConfig,
194+
sess: @ParseSess)
195+
-> T {
196+
let mut p = new_parser_from_source_substr(sess, cfg, name, ss, source);
197+
let r = f(&mut p);
198+
if !p.reader.is_eof() {
199+
p.reader.fatal(~"expected end-of-string");
200+
}
201+
maybe_aborted(r,p)
202+
}
203+
183204
// Create a new parser from a source string
184205
pub fn new_parser_from_source_str(sess: @ParseSess,
185206
cfg: ast::CrateConfig,
@@ -189,6 +210,17 @@ pub fn new_parser_from_source_str(sess: @ParseSess,
189210
filemap_to_parser(sess,string_to_filemap(sess,source,name),cfg)
190211
}
191212

213+
// Create a new parser from a source string where the origin
214+
// is specified as a substring of another file.
215+
pub fn new_parser_from_source_substr(sess: @ParseSess,
216+
cfg: ast::CrateConfig,
217+
name: @str,
218+
ss: codemap::FileSubstr,
219+
source: @str)
220+
-> Parser {
221+
filemap_to_parser(sess,substring_to_filemap(sess,source,name,ss),cfg)
222+
}
223+
192224
/// Create a new parser, handling errors as appropriate
193225
/// if the file doesn't exist
194226
pub fn new_parser_from_file(
@@ -265,6 +297,13 @@ pub fn string_to_filemap(sess: @ParseSess, source: @str, path: @str)
265297
sess.cm.new_filemap(path, source)
266298
}
267299

300+
// given a session and a string and a path and a FileSubStr, add
301+
// the string to the CodeMap and return the new FileMap
302+
pub fn substring_to_filemap(sess: @ParseSess, source: @str, path: @str,
303+
filesubstr: FileSubstr) -> @FileMap {
304+
sess.cm.new_filemap_w_substr(path,filesubstr,source)
305+
}
306+
268307
// given a filemap, produce a sequence of token-trees
269308
pub fn filemap_to_tts(sess: @ParseSess, filemap: @FileMap)
270309
-> ~[ast::TokenTree] {

0 commit comments

Comments
 (0)