Skip to content

Commit 59ad179

Browse files
committed
---
yaml --- r: 277151 b: refs/heads/try c: e563359 h: refs/heads/master i: 277149: 5d804f7 277147: d779ec5 277143: 8a20d86 277135: 6c6bda7 277119: 7eaf35e
1 parent 46b5f05 commit 59ad179

File tree

24 files changed

+343
-153
lines changed

24 files changed

+343
-153
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: 6dbb0e86aec11050480beb76eade6fb805010ba7
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
4-
refs/heads/try: 99c05478542c6624d537f587ce34f84d09fd0627
4+
refs/heads/try: e563359396928453db81141bf12dae04a567f2e9
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/bootstrap/bootstrap.py

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import argparse
1212
import contextlib
13+
import hashlib
1314
import os
1415
import shutil
1516
import subprocess
@@ -18,13 +19,29 @@
1819

1920
def get(url, path, verbose=False):
2021
print("downloading " + url)
21-
# see http://serverfault.com/questions/301128/how-to-download
22-
if sys.platform == 'win32':
23-
run(["PowerShell.exe", "/nologo", "-Command",
24-
"(New-Object System.Net.WebClient).DownloadFile('" + url +
25-
"', '" + path + "')"], verbose=verbose)
26-
else:
27-
run(["curl", "-o", path, url], verbose=verbose)
22+
sha_url = url + ".sha256"
23+
sha_path = path + ".sha256"
24+
for _url, _path in ((url, path), (sha_url, sha_path)):
25+
# see http://serverfault.com/questions/301128/how-to-download
26+
if sys.platform == 'win32':
27+
run(["PowerShell.exe", "/nologo", "-Command",
28+
"(New-Object System.Net.WebClient)"
29+
".DownloadFile('{}', '{}')".format(_url, _path)],
30+
verbose=verbose)
31+
else:
32+
run(["curl", "-o", _path, _url], verbose=verbose)
33+
print("verifying " + path)
34+
with open(path, "rb") as f:
35+
found = hashlib.sha256(f.read()).hexdigest()
36+
with open(sha_path, "r") as f:
37+
expected, _ = f.readline().split()
38+
if found != expected:
39+
err = ("invalid checksum:\n"
40+
" found: {}\n"
41+
" expected: {}".format(found, expected))
42+
if verbose:
43+
raise RuntimeError(err)
44+
sys.exit(err)
2845

2946
def unpack(tarball, dst, verbose=False, match=None):
3047
print("extracting " + tarball)
@@ -57,9 +74,10 @@ def run(args, verbose=False):
5774
ret = subprocess.Popen(args)
5875
code = ret.wait()
5976
if code != 0:
60-
if not verbose:
61-
print("failed to run: " + ' '.join(args))
62-
raise RuntimeError("failed to run command")
77+
err = "failed to run: " + ' '.join(args)
78+
if verbose:
79+
raise RuntimeError(err)
80+
sys.exit(err)
6381

6482
class RustBuild:
6583
def download_rust_nightly(self):
@@ -210,7 +228,10 @@ def build_triple(self):
210228
if sys.platform == 'win32':
211229
return 'x86_64-pc-windows-msvc'
212230
else:
213-
raise
231+
err = "uname not found"
232+
if self.verbose:
233+
raise Exception(err)
234+
sys.exit(err)
214235

215236
# Darwin's `uname -s` lies and always returns i386. We have to use
216237
# sysctl instead.
@@ -253,7 +274,10 @@ def build_triple(self):
253274
cputype = 'x86_64'
254275
ostype = 'pc-windows-gnu'
255276
else:
256-
raise ValueError("unknown OS type: " + ostype)
277+
err = "unknown OS type: " + ostype
278+
if self.verbose:
279+
raise ValueError(err)
280+
sys.exit(err)
257281

258282
if cputype in {'i386', 'i486', 'i686', 'i786', 'x86'}:
259283
cputype = 'i686'
@@ -269,7 +293,10 @@ def build_triple(self):
269293
elif cputype in {'amd64', 'x86_64', 'x86-64', 'x64'}:
270294
cputype = 'x86_64'
271295
else:
272-
raise ValueError("unknown cpu type: " + cputype)
296+
err = "unknown cpu type: " + cputype
297+
if self.verbose:
298+
raise ValueError(err)
299+
sys.exit(err)
273300

274301
return cputype + '-' + ostype
275302

branches/try/src/bootstrap/build/check.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
use std::fs;
12+
1113
use build::{Build, Compiler};
1214

1315
pub fn linkcheck(build: &Build, stage: u32, host: &str) {
@@ -29,9 +31,16 @@ pub fn cargotest(build: &Build, stage: u32, host: &str) {
2931
let sep = if cfg!(windows) { ";" } else {":" };
3032
let ref newpath = format!("{}{}{}", path.display(), sep, old_path);
3133

34+
// Note that this is a short, cryptic, and not scoped directory name. This
35+
// is currently to minimize the length of path on Windows where we otherwise
36+
// quickly run into path name limit constraints.
37+
let out_dir = build.out.join("ct");
38+
t!(fs::create_dir_all(&out_dir));
39+
3240
build.run(build.tool_cmd(compiler, "cargotest")
33-
.env("PATH", newpath)
34-
.arg(&build.cargo));
41+
.env("PATH", newpath)
42+
.arg(&build.cargo)
43+
.arg(&out_dir));
3544
}
3645

3746
pub fn tidy(build: &Build, stage: u32, host: &str) {

branches/try/src/bootstrap/build/step.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ impl<'a> Step<'a> {
318318
vec![self.tool_linkchecker(stage), self.doc(stage)]
319319
}
320320
Source::CheckCargoTest { stage } => {
321-
vec![self.tool_cargotest(stage)]
321+
vec![self.tool_cargotest(stage),
322+
self.librustc(self.compiler(stage))]
322323
}
323324
Source::CheckTidy { stage } => {
324325
vec![self.tool_tidy(stage)]
@@ -333,7 +334,7 @@ impl<'a> Step<'a> {
333334
vec![self.librustc(self.compiler(stage))]
334335
}
335336
Source::ToolCargoTest { stage } => {
336-
vec![self.librustc(self.compiler(stage))]
337+
vec![self.libstd(self.compiler(stage))]
337338
}
338339

339340
Source::DistDocs { stage } => vec![self.doc(stage)],

branches/try/src/doc/book/closures.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,12 +492,12 @@ fn factory() -> Box<Fn(i32) -> i32> {
492492

493493
Box::new(move |x| x + num)
494494
}
495-
# fn main() {
495+
fn main() {
496496
let f = factory();
497497

498498
let answer = f(1);
499499
assert_eq!(6, answer);
500-
# }
500+
}
501501
```
502502

503503
By making the inner closure a `move Fn`, we create a new stack frame for our

branches/try/src/doc/book/getting-started.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,12 @@ look something like this:
575575
name = "hello_world"
576576
version = "0.1.0"
577577
authors = ["Your Name <you@example.com>"]
578+
579+
[dependencies]
578580
```
579581

582+
Do not worry about the `[dependencies]` line, we will come back to it later.
583+
580584
Cargo has populated *Cargo.toml* with reasonable defaults based on the arguments
581585
you gave it and your `git` global configuration. You may notice that Cargo has
582586
also initialized the `hello_world` directory as a `git` repository.

branches/try/src/librustc/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ E0072: r##"
292292
When defining a recursive struct or enum, any use of the type being defined
293293
from inside the definition must occur behind a pointer (like `Box` or `&`).
294294
This is because structs and enums must have a well-defined size, and without
295-
the pointer the size of the type would need to be unbounded.
295+
the pointer, the size of the type would need to be unbounded.
296296
297297
Consider the following erroneous definition of a type for a list of bytes:
298298

branches/try/src/librustc/middle/lang_items.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,19 @@ impl<'a, 'tcx> LanguageItemCollector<'a, 'tcx> {
189189
match self.items.items[item_index] {
190190
Some(original_def_id) if original_def_id != item_def_id => {
191191
let cstore = &self.session.cstore;
192-
let span = self.ast_map.span_if_local(item_def_id)
193-
.expect("we should have found local duplicate earlier");
194-
let mut err = struct_span_err!(self.session,
195-
span,
196-
E0152,
197-
"duplicate lang item found: `{}`.",
198-
LanguageItems::item_name(item_index));
192+
let name = LanguageItems::item_name(item_index);
193+
let mut err = match self.ast_map.span_if_local(item_def_id) {
194+
Some(span) => struct_span_err!(
195+
self.session,
196+
span,
197+
E0152,
198+
"duplicate lang item found: `{}`.",
199+
name),
200+
None => self.session.struct_err(&format!(
201+
"duplicate lang item in crate `{}`: `{}`.",
202+
cstore.crate_name(item_def_id.krate),
203+
name)),
204+
};
199205
if let Some(span) = self.ast_map.span_if_local(original_def_id) {
200206
span_note!(&mut err, span,
201207
"first defined here.");

branches/try/src/librustc_trans/callee.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,15 +582,19 @@ fn get_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
582582
debug!("get_fn: not casting pointer!");
583583

584584
attributes::from_fn_attrs(ccx, attrs, llfn);
585-
if let Some(id) = local_item {
585+
if local_item.is_some() {
586586
// FIXME(eddyb) Doubt all extern fn should allow unwinding.
587587
attributes::unwind(llfn, true);
588-
ccx.item_symbols().borrow_mut().insert(id, sym);
589588
}
590589

591590
llfn
592591
};
593592

593+
// Always insert into item_symbols, in case this item is exported.
594+
if let Some(id) = local_item {
595+
ccx.item_symbols().borrow_mut().insert(id, sym);
596+
}
597+
594598
ccx.instances().borrow_mut().insert(instance, llfn);
595599

596600
immediate_rvalue(llfn, fn_ptr_ty)

branches/try/src/librustdoc/html/render.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2489,7 +2489,7 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
24892489
}
24902490

24912491
fn doctraititem(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item,
2492-
link: AssocItemLink, render_static: bool,
2492+
link: AssocItemLink, render_static: bool, is_default_item: bool,
24932493
outer_version: Option<&str>) -> fmt::Result {
24942494
let shortty = shortty(item);
24952495
let name = item.name.as_ref().unwrap();
@@ -2540,17 +2540,16 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
25402540
_ => panic!("can't make docs for trait item with name {:?}", item.name)
25412541
}
25422542

2543-
match link {
2544-
AssocItemLink::Anchor if !is_static || render_static => {
2545-
document(w, cx, item)
2546-
},
2547-
_ => Ok(()),
2543+
if !is_default_item && (!is_static || render_static) {
2544+
document(w, cx, item)
2545+
} else {
2546+
Ok(())
25482547
}
25492548
}
25502549

25512550
write!(w, "<div class='impl-items'>")?;
25522551
for trait_item in &i.impl_.items {
2553-
doctraititem(w, cx, trait_item, link, render_header, outer_version)?;
2552+
doctraititem(w, cx, trait_item, link, render_header, false, outer_version)?;
25542553
}
25552554

25562555
fn render_default_items(w: &mut fmt::Formatter,
@@ -2567,7 +2566,7 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
25672566
let did = i.trait_.as_ref().unwrap().def_id().unwrap();
25682567
let assoc_link = AssocItemLink::GotoSource(did, &i.provided_trait_methods);
25692568

2570-
doctraititem(w, cx, trait_item, assoc_link, render_static,
2569+
doctraititem(w, cx, trait_item, assoc_link, render_static, true,
25712570
outer_version)?;
25722571
}
25732572
Ok(())

branches/try/src/libsyntax/ext/expand.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,13 @@ pub fn expand_item_mac(it: P<ast::Item>,
504504

505505
/// Expand a stmt
506506
fn expand_stmt(stmt: Stmt, fld: &mut MacroExpander) -> SmallVector<Stmt> {
507+
// perform all pending renames
508+
let stmt = {
509+
let pending_renames = &mut fld.cx.syntax_env.info().pending_renames;
510+
let mut rename_fld = IdentRenamer{renames:pending_renames};
511+
rename_fld.fold_stmt(stmt).expect_one("rename_fold didn't return one value")
512+
};
513+
507514
let (mac, style, attrs) = match stmt.node {
508515
StmtKind::Mac(mac, style, attrs) => (mac, style, attrs),
509516
_ => return expand_non_macro_stmt(stmt, fld)
@@ -717,14 +724,8 @@ pub fn expand_block(blk: P<Block>, fld: &mut MacroExpander) -> P<Block> {
717724
pub fn expand_block_elts(b: P<Block>, fld: &mut MacroExpander) -> P<Block> {
718725
b.map(|Block {id, stmts, expr, rules, span}| {
719726
let new_stmts = stmts.into_iter().flat_map(|x| {
720-
// perform all pending renames
721-
let renamed_stmt = {
722-
let pending_renames = &mut fld.cx.syntax_env.info().pending_renames;
723-
let mut rename_fld = IdentRenamer{renames:pending_renames};
724-
rename_fld.fold_stmt(x).expect_one("rename_fold didn't return one value")
725-
};
726-
// expand macros in the statement
727-
fld.fold_stmt(renamed_stmt).into_iter()
727+
// perform pending renames and expand macros in the statement
728+
fld.fold_stmt(x).into_iter()
728729
}).collect();
729730
let new_expr = expr.map(|x| {
730731
let expr = {

branches/try/src/libsyntax/ext/tt/macro_rules.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,7 @@ fn is_in_follow(_: &ExtCtxt, tok: &Token, frag: &str) -> Result<bool, String> {
10141014
match *tok {
10151015
OpenDelim(token::DelimToken::Brace) | OpenDelim(token::DelimToken::Bracket) |
10161016
Comma | FatArrow | Colon | Eq | Gt | Semi | BinOp(token::Or) => Ok(true),
1017+
MatchNt(_, ref frag, _, _) if frag.name.as_str() == "block" => Ok(true),
10171018
Ident(i, _) if (i.name.as_str() == "as" ||
10181019
i.name.as_str() == "where") => Ok(true),
10191020
_ => Ok(false)

branches/try/src/libsyntax/feature_gate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ use std::cmp;
4545
// The version numbers here correspond to the version in which the current status
4646
// was set. This is most important for knowing when a particular feature became
4747
// stable (active).
48-
// NB: The featureck.py script parses this information directly out of the source
49-
// so take care when modifying it.
48+
// NB: The tidy tool parses this information directly out of the source so take
49+
// care when modifying it.
5050
const KNOWN_FEATURES: &'static [(&'static str, &'static str, Option<u32>, Status)] = &[
5151
("globs", "1.0.0", None, Accepted),
5252
("macro_rules", "1.0.0", None, Accepted),

branches/try/src/libsyntax/parse/parser.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,9 +1532,8 @@ impl<'a> Parser<'a> {
15321532
} else {
15331533
let span = self.last_span;
15341534
self.span_err(span,
1535-
"bare raw pointers are no longer allowed, you should \
1536-
likely use `*mut T`, but otherwise `*T` is now \
1537-
known as `*const T`");
1535+
"expected mut or const in raw pointer type (use \
1536+
`*mut T` or `*const T` as appropriate)");
15381537
Mutability::Immutable
15391538
};
15401539
let t = self.parse_ty()?;

branches/try/src/test/auxiliary/foreign_lib.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
#![crate_name="foreign_lib"]
12+
1213
#![feature(libc)]
1314

1415
pub mod rustrt {
@@ -19,3 +20,29 @@ pub mod rustrt {
1920
pub fn rust_get_test_int() -> libc::intptr_t;
2021
}
2122
}
23+
24+
pub mod rustrt2 {
25+
extern crate libc;
26+
27+
extern {
28+
pub fn rust_get_test_int() -> libc::intptr_t;
29+
}
30+
}
31+
32+
pub mod rustrt3 {
33+
// Different type, but same ABI (on all supported platforms).
34+
// Ensures that we don't ICE or trigger LLVM asserts when
35+
// importing the same symbol under different types.
36+
// See https://github.com/rust-lang/rust/issues/32740.
37+
extern {
38+
pub fn rust_get_test_int() -> *const u8;
39+
}
40+
}
41+
42+
pub fn local_uses() {
43+
unsafe {
44+
let x = rustrt::rust_get_test_int();
45+
assert_eq!(x, rustrt2::rust_get_test_int());
46+
assert_eq!(x as *const _, rustrt3::rust_get_test_int());
47+
}
48+
}

0 commit comments

Comments
 (0)