Skip to content

Commit 9206756

Browse files
author
blake2-ppc
committed
---
yaml --- r: 64838 b: refs/heads/snap-stage3 c: 4b2931c h: refs/heads/master v: v3
1 parent 67f733a commit 9206756

File tree

28 files changed

+491
-240
lines changed

28 files changed

+491
-240
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: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 4f65fc7ef2cbf7dcd768da60bd13cbf0ee45fe1b
4+
refs/heads/snap-stage3: 4b2931c90fbe152ca1dd3111985057778dad1ba9
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/doc/rustpkg.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ A package ID can also specify a version, like:
7676
`github.com/mozilla/rust#0.3`.
7777
In this case, `rustpkg` will check that the repository `github.com/mozilla/rust` has a tag named `0.3`,
7878
and report an error otherwise.
79+
A package ID can also specify a particular revision of a repository, like:
80+
`github.com/mozilla/rust#release-0.7`.
81+
When the refspec (portion of the package ID after the `#`) can't be parsed as a decimal number,
82+
rustpkg passes the refspec along to the version control system without interpreting it.
83+
rustpkg also interprets any dependencies on such a package ID literally
84+
(as opposed to versions, where a newer version satisfies a dependency on an older version).
85+
Thus, `github.com/mozilla/rust#5c4cd30f80` is also a valid package ID,
86+
since git can deduce that 5c4cd30f80 refers to a revision of the desired repository.
7987

8088
## Source files
8189

branches/snap-stage3/doc/tutorial.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ was taken.
309309

310310
In short, everything that's not a declaration (declarations are `let` for
311311
variables; `fn` for functions; and any top-level named items such as
312-
[traits](#traits), [enum types](#enums), and [constants](#constants)) is an
312+
[traits](#traits), [enum types](#enums), and static items) is an
313313
expression, including function bodies.
314314

315315
~~~~
@@ -992,7 +992,7 @@ task-local garbage collector. It will be destroyed at some point after there
992992
are no references left to the box, no later than the end of the task. Managed
993993
boxes lack an owner, so they start a new ownership tree and don't inherit
994994
mutability. They do own the contained object, and mutability is defined by the
995-
type of the shared box (`@` or `@mut`). An object containing a managed box is
995+
type of the managed box (`@` or `@mut`). An object containing a managed box is
996996
not `Owned`, and can't be sent between tasks.
997997

998998
~~~~
@@ -1089,10 +1089,8 @@ we might like to compute the distance between `on_the_stack` and
10891089
to define a function that takes two arguments of type point—that is,
10901090
it takes the points by value. But this will cause the points to be
10911091
copied when we call the function. For points, this is probably not so
1092-
bad, but often copies are expensive or, worse, if there are mutable
1093-
fields, they can change the semantics of your program. So we’d like to
1094-
define a function that takes the points by pointer. We can use
1095-
borrowed pointers to do this:
1092+
bad, but often copies are expensive. So we’d like to define a function
1093+
that takes the points by pointer. We can use borrowed pointers to do this:
10961094
10971095
~~~
10981096
# struct Point { x: float, y: float }
@@ -1375,7 +1373,7 @@ let exchange_crayons: ~str = ~"Black, BlizzardBlue, Blue";
13751373
~~~
13761374

13771375
Both vectors and strings support a number of useful
1378-
[methods](#functions-and-methods), defined in [`std::vec`]
1376+
[methods](#methods), defined in [`std::vec`]
13791377
and [`std::str`]. Here are some examples.
13801378

13811379
[`std::vec`]: std/vec.html
@@ -1930,7 +1928,7 @@ that implements a trait includes the name of the trait at the start of
19301928
the definition, as in the following impls of `Printable` for `int`
19311929
and `~str`.
19321930

1933-
[impls]: #functions-and-methods
1931+
[impls]: #methods
19341932

19351933
~~~~
19361934
# trait Printable { fn print(&self); }

branches/snap-stage3/src/compiletest/runtest.rs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use util::logv;
2222

2323
use std::io;
2424
use std::os;
25+
use std::str;
2526
use std::uint;
2627
use std::vec;
2728

@@ -355,6 +356,30 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
355356
fmt!("%s:%u:", testfile.to_str(), ee.line)
356357
}).collect::<~[~str]>();
357358

359+
fn to_lower( s : &str ) -> ~str {
360+
let i = s.iter();
361+
let c : ~[char] = i.transform( |c| {
362+
if c.is_ascii() {
363+
c.to_ascii().to_lower().to_char()
364+
} else {
365+
c
366+
}
367+
} ).collect();
368+
str::from_chars( c )
369+
}
370+
371+
#[cfg(target_os = "win32")]
372+
fn prefix_matches( line : &str, prefix : &str ) -> bool {
373+
to_lower(line).starts_with( to_lower(prefix) )
374+
}
375+
376+
#[cfg(target_os = "linux")]
377+
#[cfg(target_os = "macos")]
378+
#[cfg(target_os = "freebsd")]
379+
fn prefix_matches( line : &str, prefix : &str ) -> bool {
380+
line.starts_with( prefix )
381+
}
382+
358383
// Scan and extract our error/warning messages,
359384
// which look like:
360385
// filename:line1:col1: line2:col2: *error:* msg
@@ -367,7 +392,7 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
367392
if !found_flags[i] {
368393
debug!("prefix=%s ee.kind=%s ee.msg=%s line=%s",
369394
prefixes[i], ee.kind, ee.msg, line);
370-
if (line.starts_with(prefixes[i]) &&
395+
if (prefix_matches(line, prefixes[i]) &&
371396
line.contains(ee.kind) &&
372397
line.contains(ee.msg)) {
373398
found_flags[i] = true;

branches/snap-stage3/src/libextra/dlist.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
use std::cast;
2626
use std::ptr;
2727
use std::util;
28-
use std::iterator::{FromIterator, InvertIterator};
28+
use std::iterator::{FromIterator, Invert};
2929

3030
use container::Deque;
3131

@@ -356,7 +356,7 @@ impl<T> DList<T> {
356356

357357
/// Provide a reverse iterator
358358
#[inline]
359-
pub fn rev_iter<'a>(&'a self) -> InvertIterator<DListIterator<'a, T>> {
359+
pub fn rev_iter<'a>(&'a self) -> Invert<DListIterator<'a, T>> {
360360
self.iter().invert()
361361
}
362362

@@ -376,7 +376,7 @@ impl<T> DList<T> {
376376
}
377377
/// Provide a reverse iterator with mutable references
378378
#[inline]
379-
pub fn mut_rev_iter<'a>(&'a mut self) -> InvertIterator<MutDListIterator<'a, T>> {
379+
pub fn mut_rev_iter<'a>(&'a mut self) -> Invert<MutDListIterator<'a, T>> {
380380
self.mut_iter().invert()
381381
}
382382

@@ -389,7 +389,7 @@ impl<T> DList<T> {
389389

390390
/// Consume the list into an iterator yielding elements by value, in reverse
391391
#[inline]
392-
pub fn consume_rev_iter(self) -> InvertIterator<ConsumeIterator<T>> {
392+
pub fn consume_rev_iter(self) -> Invert<ConsumeIterator<T>> {
393393
self.consume_iter().invert()
394394
}
395395
}

branches/snap-stage3/src/libextra/ringbuf.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use std::num;
1717
use std::uint;
1818
use std::vec;
19-
use std::iterator::{FromIterator, InvertIterator};
19+
use std::iterator::{FromIterator, Invert};
2020

2121
use container::Deque;
2222

@@ -181,7 +181,7 @@ impl<T> RingBuf<T> {
181181
}
182182

183183
/// Back-to-front iterator.
184-
pub fn rev_iter<'a>(&'a self) -> InvertIterator<RingBufIterator<'a, T>> {
184+
pub fn rev_iter<'a>(&'a self) -> Invert<RingBufIterator<'a, T>> {
185185
self.iter().invert()
186186
}
187187

@@ -192,7 +192,7 @@ impl<T> RingBuf<T> {
192192
}
193193

194194
/// Back-to-front iterator which returns mutable values.
195-
pub fn mut_rev_iter<'a>(&'a mut self) -> InvertIterator<RingBufMutIterator<'a, T>> {
195+
pub fn mut_rev_iter<'a>(&'a mut self) -> Invert<RingBufMutIterator<'a, T>> {
196196
self.mut_iter().invert()
197197
}
198198
}

branches/snap-stage3/src/libextra/smallintmap.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#[allow(missing_doc)];
1717

18-
use std::iterator::{Iterator, IteratorUtil, EnumerateIterator, FilterMapIterator, InvertIterator};
18+
use std::iterator::{Iterator, IteratorUtil, Enumerate, FilterMap, Invert};
1919
use std::uint;
2020
use std::util::replace;
2121
use std::vec::{VecIterator, VecMutIterator};
@@ -204,8 +204,8 @@ impl<V> SmallIntMap<V> {
204204

205205
/// Empties the hash map, moving all values into the specified closure
206206
pub fn consume(&mut self)
207-
-> FilterMapIterator<(uint, Option<V>), (uint, V),
208-
EnumerateIterator<vec::ConsumeIterator<Option<V>>>>
207+
-> FilterMap<(uint, Option<V>), (uint, V),
208+
Enumerate<vec::ConsumeIterator<Option<V>>>>
209209
{
210210
let values = replace(&mut self.v, ~[]);
211211
values.consume_iter().enumerate().filter_map(|(i, v)| {
@@ -291,7 +291,7 @@ pub struct SmallIntMapIterator<'self, T> {
291291

292292
iterator!(impl SmallIntMapIterator -> (uint, &'self T), get_ref)
293293
double_ended_iterator!(impl SmallIntMapIterator -> (uint, &'self T), get_ref)
294-
pub type SmallIntMapRevIterator<'self, T> = InvertIterator<SmallIntMapIterator<'self, T>>;
294+
pub type SmallIntMapRevIterator<'self, T> = Invert<SmallIntMapIterator<'self, T>>;
295295

296296
pub struct SmallIntMapMutIterator<'self, T> {
297297
priv front: uint,
@@ -301,7 +301,7 @@ pub struct SmallIntMapMutIterator<'self, T> {
301301

302302
iterator!(impl SmallIntMapMutIterator -> (uint, &'self mut T), get_mut_ref)
303303
double_ended_iterator!(impl SmallIntMapMutIterator -> (uint, &'self mut T), get_mut_ref)
304-
pub type SmallIntMapMutRevIterator<'self, T> = InvertIterator<SmallIntMapMutIterator<'self, T>>;
304+
pub type SmallIntMapMutRevIterator<'self, T> = Invert<SmallIntMapMutIterator<'self, T>>;
305305

306306
#[cfg(test)]
307307
mod test_map {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ pub fn check_expr(sess: Session,
160160
expr_field(*) |
161161
expr_index(*) |
162162
expr_tup(*) |
163-
expr_struct(_, _, None) => { }
163+
expr_struct(*) => { }
164164
expr_addr_of(*) => {
165165
sess.span_err(
166166
e.span,

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,20 +485,30 @@ fn const_expr_unadjusted(cx: @mut CrateContext, e: &ast::expr) -> ValueRef {
485485
let vals = es.map(|&e| const_expr(cx, e));
486486
adt::trans_const(cx, repr, 0, vals)
487487
}
488-
ast::expr_struct(_, ref fs, None) => {
488+
ast::expr_struct(_, ref fs, ref base_opt) => {
489489
let ety = ty::expr_ty(cx.tcx, e);
490490
let repr = adt::represent_type(cx, ety);
491491
let tcx = cx.tcx;
492+
493+
let base_val = match *base_opt {
494+
Some(base) => Some(const_expr(cx, base)),
495+
None => None
496+
};
497+
492498
do expr::with_field_tys(tcx, ety, Some(e.id))
493499
|discr, field_tys| {
494-
let cs = field_tys.map(|field_ty| {
500+
let cs: ~[ValueRef] = field_tys.iter().enumerate()
501+
.transform(|(ix, &field_ty)| {
495502
match fs.iter().find_(|f| field_ty.ident == f.ident) {
496503
Some(f) => const_expr(cx, (*f).expr),
497504
None => {
498-
cx.tcx.sess.span_bug(e.span, "missing struct field");
505+
match base_val {
506+
Some(bv) => adt::const_get_field(cx, repr, bv, discr, ix),
507+
None => cx.tcx.sess.span_bug(e.span, "missing struct field")
508+
}
499509
}
500510
}
501-
});
511+
}).collect();
502512
adt::trans_const(cx, repr, discr, cs)
503513
}
504514
}

branches/snap-stage3/src/librustpkg/package_source.rs

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@
1111
use target::*;
1212
use package_id::PkgId;
1313
use std::path::Path;
14-
use std::{os, run, str};
14+
use std::{os, str};
1515
use context::*;
1616
use crate::Crate;
1717
use messages::*;
18-
use source_control::git_clone;
18+
use source_control::{git_clone, git_clone_general};
1919
use path_util::pkgid_src_in_workspace;
2020
use util::compile_crate;
21-
use version::{ExactRevision, SemanticVersion, NoVersion};
2221

2322
// An enumeration of the unpacked source of a package workspace.
2423
// This contains a list of files found in the source workspace.
@@ -102,22 +101,13 @@ impl PkgSrc {
102101
}
103102

104103
let url = fmt!("https://%s", self.id.remote_path.to_str());
105-
let branch_args = match self.id.version {
106-
NoVersion => ~[],
107-
ExactRevision(ref s) => ~[~"--branch", (*s).clone()],
108-
SemanticVersion(ref s) => ~[~"--branch", s.to_str()]
109-
};
110-
111-
112-
note(fmt!("Fetching package: git clone %s %s %?", url, local.to_str(), branch_args));
113-
114-
if run::process_output("git",
115-
~[~"clone", url.clone(), local.to_str()] + branch_args).status != 0 {
116-
note(fmt!("fetching %s failed: can't clone repository", url));
117-
None
104+
note(fmt!("Fetching package: git clone %s %s [version=%s]",
105+
url, local.to_str(), self.id.version.to_str()));
106+
if git_clone_general(url, &local, &self.id.version) {
107+
Some(local)
118108
}
119109
else {
120-
Some(local)
110+
None
121111
}
122112
}
123113

branches/snap-stage3/src/librustpkg/path_util.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ pub fn rust_path() -> ~[Path] {
5252
}
5353
None => ~[]
5454
};
55+
debug!("RUST_PATH entries from environment: %?", env_rust_path);
5556
let cwd = os::getcwd();
5657
// now add in default entries
5758
env_rust_path.push(cwd.clone());
@@ -345,7 +346,12 @@ fn target_file_in_workspace(pkgid: &PkgId, workspace: &Path,
345346
let subdir = match what {
346347
Lib => "lib", Main | Test | Bench => "bin"
347348
};
348-
let result = workspace.push(subdir);
349+
// Artifacts in the build directory live in a package-ID-specific subdirectory,
350+
// but installed ones don't.
351+
let result = match where {
352+
Build => workspace.push(subdir).push_rel(&*pkgid.local_path),
353+
_ => workspace.push(subdir)
354+
};
349355
if !os::path_exists(&result) && !mkdir_recursive(&result, U_RWX) {
350356
cond.raise((result.clone(), fmt!("target_file_in_workspace couldn't \
351357
create the %s dir (pkgid=%s, workspace=%s, what=%?, where=%?",

0 commit comments

Comments
 (0)