Skip to content

Commit eb16f39

Browse files
committed
---
yaml --- r: 273647 b: refs/heads/beta c: 90f2b69 h: refs/heads/master i: 273645: 04032fc 273643: d5f6e38 273639: dfd7d3d 273631: f417db1
1 parent 2aef984 commit eb16f39

File tree

151 files changed

+2797
-1196
lines changed

Some content is hidden

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

151 files changed

+2797
-1196
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 88ab9382ae79346969d79c15a27c77368a928dd8
26+
refs/heads/beta: 90f2b69cddc92c8b3ff3a51f261d441a58b706bd
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/configure

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -969,11 +969,11 @@ then
969969
LLVM_VERSION=$($LLVM_CONFIG --version)
970970

971971
case $LLVM_VERSION in
972-
(3.[5-8]*)
972+
(3.[6-8]*)
973973
msg "found ok version of LLVM: $LLVM_VERSION"
974974
;;
975975
(*)
976-
err "bad LLVM version: $LLVM_VERSION, need >=3.5"
976+
err "bad LLVM version: $LLVM_VERSION, need >=3.6"
977977
;;
978978
esac
979979
fi

branches/beta/mk/tests.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): \
383383
@$$(call E, rustc: $$@)
384384
$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(2)) \
385385
$$(subst @,,$$(STAGE$(1)_T_$(2)_H_$(3))) -o $$@ $$< --test \
386-
-L "$$(RT_OUTPUT_DIR_$(2))" \
386+
-Cmetadata="test-crate" -L "$$(RT_OUTPUT_DIR_$(2))" \
387387
$$(LLVM_LIBDIR_RUSTFLAGS_$(2)) \
388388
$$(RUSTFLAGS_$(4))
389389

branches/beta/src/compiletest/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ impl fmt::Display for Mode {
6969
#[derive(Clone)]
7070
pub struct Config {
7171
// The library paths required for running the compiler
72-
pub compile_lib_path: String,
72+
pub compile_lib_path: PathBuf,
7373

7474
// The library paths required for running compiled programs
75-
pub run_lib_path: String,
75+
pub run_lib_path: PathBuf,
7676

7777
// The rustc executable
7878
pub rustc_path: PathBuf,

branches/beta/src/compiletest/compiletest.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,17 @@ pub fn parse_config(args: Vec<String> ) -> Config {
118118
}
119119
}
120120

121+
fn make_absolute(path: PathBuf) -> PathBuf {
122+
if path.is_relative() {
123+
env::current_dir().unwrap().join(path)
124+
} else {
125+
path
126+
}
127+
}
128+
121129
Config {
122-
compile_lib_path: matches.opt_str("compile-lib-path").unwrap(),
123-
run_lib_path: matches.opt_str("run-lib-path").unwrap(),
130+
compile_lib_path: make_absolute(opt_path(matches, "compile-lib-path")),
131+
run_lib_path: make_absolute(opt_path(matches, "run-lib-path")),
124132
rustc_path: opt_path(matches, "rustc-path"),
125133
rustdoc_path: opt_path(matches, "rustdoc-path"),
126134
python: matches.opt_str("python").unwrap(),

branches/beta/src/compiletest/runtest.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ fn run_pretty_test_revision(config: &Config,
316316
testpaths,
317317
pretty_type.to_owned()),
318318
props.exec_env.clone(),
319-
&config.compile_lib_path,
319+
config.compile_lib_path.to_str().unwrap(),
320320
Some(aux_dir.to_str().unwrap()),
321321
Some(src))
322322
}
@@ -635,7 +635,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testpaths: &TestPa
635635
testpaths,
636636
proc_args,
637637
environment,
638-
&config.run_lib_path,
638+
config.run_lib_path.to_str().unwrap(),
639639
None,
640640
None);
641641
}
@@ -1315,7 +1315,7 @@ fn exec_compiled_test(config: &Config, props: &TestProps,
13151315
testpaths,
13161316
make_run_args(config, props, testpaths),
13171317
env,
1318-
&config.run_lib_path,
1318+
config.run_lib_path.to_str().unwrap(),
13191319
Some(aux_dir.to_str().unwrap()),
13201320
None)
13211321
}
@@ -1387,7 +1387,7 @@ fn compose_and_run_compiler(config: &Config, props: &TestProps,
13871387
&aux_testpaths,
13881388
aux_args,
13891389
Vec::new(),
1390-
&config.compile_lib_path,
1390+
config.compile_lib_path.to_str().unwrap(),
13911391
Some(aux_dir.to_str().unwrap()),
13921392
None);
13931393
if !auxres.status.success() {
@@ -1410,7 +1410,7 @@ fn compose_and_run_compiler(config: &Config, props: &TestProps,
14101410
testpaths,
14111411
args,
14121412
props.rustc_env.clone(),
1413-
&config.compile_lib_path,
1413+
config.compile_lib_path.to_str().unwrap(),
14141414
Some(aux_dir.to_str().unwrap()),
14151415
input)
14161416
}

branches/beta/src/doc/book/strings.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ let s = "foo\
4444
assert_eq!("foobar", s);
4545
```
4646

47+
Note that you normally cannot access a `str` directly, but only through a `&str`
48+
reference. This is because `str` is an unsized type which requires additional
49+
runtime information to be usable. For more information see the chapter on
50+
[unsized types][ut].
51+
4752
Rust has more than only `&str`s though. A `String` is a heap-allocated string.
4853
This string is growable, and is also guaranteed to be UTF-8. `String`s are
4954
commonly created by converting from a string slice using the `to_string`
@@ -185,5 +190,6 @@ let hello_world = hello + &world;
185190
This is because `&String` can automatically coerce to a `&str`. This is a
186191
feature called ‘[`Deref` coercions][dc]’.
187192

193+
[ut]: unsized-types.html
188194
[dc]: deref-coercions.html
189195
[connect]: ../std/net/struct.TcpStream.html#method.connect

branches/beta/src/doc/reference.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3911,6 +3911,9 @@ The _heap_ is a general term that describes boxes. The lifetime of an
39113911
allocation in the heap depends on the lifetime of the box values pointing to
39123912
it. Since box values may themselves be passed in and out of frames, or stored
39133913
in the heap, heap allocations may outlive the frame they are allocated within.
3914+
An allocation in the heap is guaranteed to reside at a single location in the
3915+
heap for the whole lifetime of the allocation - it will never be relocated as
3916+
a result of moving a box value.
39143917

39153918
### Memory ownership
39163919

branches/beta/src/etc/CONFIGS.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,3 @@ These are some links to repos with configs which ease the use of rust.
1010
* [kate-config](https://github.com/rust-lang/kate-config)
1111
* [nano-config](https://github.com/rust-lang/nano-config)
1212
* [zsh-config](https://github.com/rust-lang/zsh-config)
13-
14-
## Community-maintained Configs
15-
16-
* [.editorconfig](https://gist.github.com/derhuerst/c9d1b9309e308d9851fa) ([what is this?](http://editorconfig.org/))

branches/beta/src/libcore/str/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1953,7 +1953,10 @@ impl StrExt for str {
19531953

19541954
#[inline]
19551955
fn is_char_boundary(&self, index: usize) -> bool {
1956-
if index == self.len() { return true; }
1956+
// 0 and len are always ok.
1957+
// Test for 0 explicitly so that it can optimize out the check
1958+
// easily and skip reading string data for that case.
1959+
if index == 0 || index == self.len() { return true; }
19571960
match self.as_bytes().get(index) {
19581961
None => false,
19591962
Some(&b) => b < 128 || b >= 192,
@@ -2026,6 +2029,7 @@ impl StrExt for str {
20262029
self.find(pat)
20272030
}
20282031

2032+
#[inline]
20292033
fn split_at(&self, mid: usize) -> (&str, &str) {
20302034
// is_char_boundary checks that the index is in [0, .len()]
20312035
if self.is_char_boundary(mid) {

branches/beta/src/librbml/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ impl<'doc> Doc<'doc> {
166166
}
167167
}
168168

169-
pub fn get<'a>(&'a self, tag: usize) -> Doc<'a> {
169+
pub fn get(&self, tag: usize) -> Doc<'doc> {
170170
reader::get_doc(*self, tag)
171171
}
172172

173173
pub fn is_empty(&self) -> bool {
174174
self.start == self.end
175175
}
176176

177-
pub fn as_str_slice<'a>(&'a self) -> &'a str {
177+
pub fn as_str_slice(&self) -> &'doc str {
178178
str::from_utf8(&self.data[self.start..self.end]).unwrap()
179179
}
180180

branches/beta/src/librustc/diagnostics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ compiled:
12611261
fn foo<T: Index<u8>>(x: T){}
12621262
12631263
#[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
1264-
trait Index<Idx> { ... }
1264+
trait Index<Idx> { /* ... */ }
12651265
12661266
foo(true); // `bool` does not implement `Index<u8>`
12671267
```
@@ -1291,7 +1291,7 @@ compiled:
12911291
fn foo<T: Index<u8>>(x: T){}
12921292
12931293
#[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
1294-
trait Index<Idx> { ... }
1294+
trait Index<Idx> { /* ... */ }
12951295
12961296
foo(true); // `bool` does not implement `Index<u8>`
12971297
```
@@ -1319,7 +1319,7 @@ compiled:
13191319
fn foo<T: Index<u8>>(x: T){}
13201320
13211321
#[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
1322-
trait Index<Idx> { ... }
1322+
trait Index<Idx> { /* ... */ }
13231323
13241324
foo(true); // `bool` does not implement `Index<u8>`
13251325
```

branches/beta/src/librustc/front/map/collector.rs

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use super::MapEntry::*;
1414
use rustc_front::hir::*;
1515
use rustc_front::util;
1616
use rustc_front::intravisit::{self, Visitor};
17-
use middle::def_id::{CRATE_DEF_INDEX, DefIndex};
17+
use middle::def_id::{CRATE_DEF_INDEX, DefId, DefIndex};
1818
use std::iter::repeat;
1919
use syntax::ast::{NodeId, CRATE_NODE_ID, DUMMY_NODE_ID};
2020
use syntax::codemap::Span;
@@ -50,6 +50,7 @@ impl<'ast> NodeCollector<'ast> {
5050
parent: &'ast InlinedParent,
5151
parent_node: NodeId,
5252
parent_def_path: DefPath,
53+
parent_def_id: DefId,
5354
map: Vec<MapEntry<'ast>>,
5455
definitions: Definitions)
5556
-> NodeCollector<'ast> {
@@ -60,8 +61,14 @@ impl<'ast> NodeCollector<'ast> {
6061
definitions: definitions,
6162
};
6263

64+
assert_eq!(parent_def_path.krate, parent_def_id.krate);
65+
let root_path = Box::new(InlinedRootPath {
66+
data: parent_def_path.data,
67+
def_id: parent_def_id,
68+
});
69+
6370
collector.insert_entry(parent_node, RootInlinedParent(parent));
64-
collector.create_def(parent_node, DefPathData::InlinedRoot(parent_def_path));
71+
collector.create_def(parent_node, DefPathData::InlinedRoot(root_path));
6572

6673
collector
6774
}
@@ -126,11 +133,16 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
126133
// Pick the def data. This need not be unique, but the more
127134
// information we encapsulate into
128135
let def_data = match i.node {
129-
ItemDefaultImpl(..) | ItemImpl(..) => DefPathData::Impl(i.name),
130-
ItemEnum(..) | ItemStruct(..) | ItemTrait(..) => DefPathData::Type(i.name),
131-
ItemExternCrate(..) | ItemMod(..) => DefPathData::Mod(i.name),
132-
ItemStatic(..) | ItemConst(..) | ItemFn(..) => DefPathData::Value(i.name),
133-
_ => DefPathData::Misc,
136+
ItemDefaultImpl(..) | ItemImpl(..) =>
137+
DefPathData::Impl,
138+
ItemEnum(..) | ItemStruct(..) | ItemTrait(..) |
139+
ItemExternCrate(..) | ItemMod(..) | ItemForeignMod(..) |
140+
ItemTy(..) =>
141+
DefPathData::TypeNs(i.name),
142+
ItemStatic(..) | ItemConst(..) | ItemFn(..) =>
143+
DefPathData::ValueNs(i.name),
144+
ItemUse(..) =>
145+
DefPathData::Misc,
134146
};
135147

136148
self.insert_def(i.id, NodeItem(i), def_data);
@@ -195,7 +207,7 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
195207
fn visit_foreign_item(&mut self, foreign_item: &'ast ForeignItem) {
196208
self.insert_def(foreign_item.id,
197209
NodeForeignItem(foreign_item),
198-
DefPathData::Value(foreign_item.name));
210+
DefPathData::ValueNs(foreign_item.name));
199211

200212
let parent_node = self.parent_node;
201213
self.parent_node = foreign_item.id;
@@ -215,8 +227,8 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
215227

216228
fn visit_trait_item(&mut self, ti: &'ast TraitItem) {
217229
let def_data = match ti.node {
218-
MethodTraitItem(..) | ConstTraitItem(..) => DefPathData::Value(ti.name),
219-
TypeTraitItem(..) => DefPathData::Type(ti.name),
230+
MethodTraitItem(..) | ConstTraitItem(..) => DefPathData::ValueNs(ti.name),
231+
TypeTraitItem(..) => DefPathData::TypeNs(ti.name),
220232
};
221233

222234
self.insert(ti.id, NodeTraitItem(ti));
@@ -239,8 +251,8 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
239251

240252
fn visit_impl_item(&mut self, ii: &'ast ImplItem) {
241253
let def_data = match ii.node {
242-
ImplItemKind::Method(..) | ImplItemKind::Const(..) => DefPathData::Value(ii.name),
243-
ImplItemKind::Type(..) => DefPathData::Type(ii.name),
254+
ImplItemKind::Method(..) | ImplItemKind::Const(..) => DefPathData::ValueNs(ii.name),
255+
ImplItemKind::Type(..) => DefPathData::TypeNs(ii.name),
244256
};
245257

246258
self.insert_def(ii.id, NodeImplItem(ii), def_data);

0 commit comments

Comments
 (0)