Skip to content

Commit 3f1fa56

Browse files
committed
---
yaml --- r: 274980 b: refs/heads/stable c: 94ecd48 h: refs/heads/master
1 parent 3040621 commit 3f1fa56

File tree

30 files changed

+248
-88
lines changed

30 files changed

+248
-88
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 040cbc4566962faa402780b68918b188a5346522
32+
refs/heads/stable: 94ecd483e5ed692a6424b882b706e6615efa8336
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/mk/crates.mk

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ RUSTC_CRATES := rustc rustc_typeck rustc_mir rustc_borrowck rustc_resolve rustc_
5959
rustc_data_structures rustc_front rustc_platform_intrinsics \
6060
rustc_plugin rustc_metadata rustc_passes
6161
HOST_CRATES := syntax syntax_ext $(RUSTC_CRATES) rustdoc fmt_macros
62-
TOOLS := compiletest rustdoc rustc rustbook error-index-generator
62+
TOOLS := compiletest rustdoc rustc rustbook error_index_generator
6363

6464
DEPS_core :=
6565
DEPS_alloc := core libc alloc_system
@@ -120,12 +120,12 @@ TOOL_DEPS_compiletest := test getopts
120120
TOOL_DEPS_rustdoc := rustdoc
121121
TOOL_DEPS_rustc := rustc_driver
122122
TOOL_DEPS_rustbook := std rustdoc
123-
TOOL_DEPS_error-index-generator := rustdoc syntax serialize
123+
TOOL_DEPS_error_index_generator := rustdoc syntax serialize
124124
TOOL_SOURCE_compiletest := $(S)src/compiletest/compiletest.rs
125125
TOOL_SOURCE_rustdoc := $(S)src/driver/driver.rs
126126
TOOL_SOURCE_rustc := $(S)src/driver/driver.rs
127127
TOOL_SOURCE_rustbook := $(S)src/rustbook/main.rs
128-
TOOL_SOURCE_error-index-generator := $(S)src/error-index-generator/main.rs
128+
TOOL_SOURCE_error_index_generator := $(S)src/error_index_generator/main.rs
129129

130130
ONLY_RLIB_core := 1
131131
ONLY_RLIB_libc := 1

branches/stable/mk/dist.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ PKG_FILES := \
5252
doc \
5353
driver \
5454
etc \
55-
error-index-generator \
55+
error_index_generator \
5656
$(foreach crate,$(CRATES),lib$(crate)) \
5757
libcollectionstest \
5858
libcoretest \

branches/stable/mk/docs.mk

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ RUSTBOOK_EXE = $(HBIN2_H_$(CFG_BUILD))/rustbook$(X_$(CFG_BUILD))
5959
# ./configure
6060
RUSTBOOK = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(RUSTBOOK_EXE)
6161

62-
# The error-index-generator executable...
63-
ERR_IDX_GEN_EXE = $(HBIN2_H_$(CFG_BUILD))/error-index-generator$(X_$(CFG_BUILD))
62+
# The error_index_generator executable...
63+
ERR_IDX_GEN_EXE = $(HBIN2_H_$(CFG_BUILD))/error_index_generator$(X_$(CFG_BUILD))
6464
ERR_IDX_GEN = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(ERR_IDX_GEN_EXE)
6565
ERR_IDX_GEN_MD = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(ERR_IDX_GEN_EXE) markdown
6666

@@ -221,9 +221,9 @@ error-index: doc/error-index.html
221221
# Metadata used to generate the index is created as a side effect of
222222
# the build so this depends on every crate being up to date.
223223
doc/error-index.html: $(ERR_IDX_GEN_EXE) $(CSREQ$(2)_T_$(CFG_BUILD)_H_$(CFG_BUILD)) | doc/
224-
$(Q)$(call E, error-index-generator: $@)
224+
$(Q)$(call E, error_index_generator: $@)
225225
$(Q)$(ERR_IDX_GEN)
226226

227227
doc/error-index.md: $(ERR_IDX_GEN_EXE) $(CSREQ$(2)_T_$(CFG_BUILD)_H_$(CFG_BUILD)) | doc/
228-
$(Q)$(call E, error-index-generator: $@)
228+
$(Q)$(call E, error_index_generator: $@)
229229
$(Q)$(ERR_IDX_GEN_MD)

branches/stable/mk/prepare.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ define PREPARE_MAN
8282

8383
endef
8484

85-
PREPARE_TOOLS = $(filter-out compiletest rustbook error-index-generator, $(TOOLS))
85+
PREPARE_TOOLS = $(filter-out compiletest rustbook error_index_generator, $(TOOLS))
8686

8787

8888
# $(1) is tool

branches/stable/mk/tests.mk

+2-1
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,8 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
10721072
$(3) \
10731073
"$$(LLVM_LIBDIR_RUSTFLAGS_$(3))" \
10741074
"$$(LLVM_ALL_COMPONENTS_$(3))" \
1075-
"$$(LLVM_CXXFLAGS_$(3))"
1075+
"$$(LLVM_CXXFLAGS_$(3))" \
1076+
'$$(CXX_$(3))'
10761077
@touch -r $$@.start_time $$@ && rm $$@.start_time
10771078
else
10781079
# FIXME #11094 - The above rule doesn't work right for multiple targets

branches/stable/src/doc/book/vectors.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,21 @@ let v = vec![1, 2, 3, 4, 5]; // v: Vec<i32>
1111
```
1212

1313
(Notice that unlike the `println!` macro we’ve used in the past, we use square
14-
brackets `[]` with `vec!` macro. Rust allows you to use either in either situation,
15-
this is just convention.)
14+
brackets `[]` with `vec!` macro. Rust allows you to use either in either
15+
situation, this is just convention.)
1616

1717
There’s an alternate form of `vec!` for repeating an initial value:
1818

1919
```rust
2020
let v = vec![0; 10]; // ten zeroes
2121
```
2222

23+
Vectors store their contents as contiguous arrays of `T` on the heap. This means
24+
that they must be able to know the size of `T` at compile time (that is, how
25+
many bytes are needed to store a `T`?). The size of some things can't be known
26+
at compile time. For these you'll have to store a pointer to that thing:
27+
thankfully, the [`Box`][box] type works perfectly for this.
28+
2329
## Accessing elements
2430

2531
To get the value at a particular index in the vector, we use `[]`s:
@@ -113,6 +119,7 @@ Vectors have many more useful methods, which you can read about in [their
113119
API documentation][vec].
114120

115121
[vec]: ../std/vec/index.html
122+
[box]: ../std/boxed/index.html
116123
[generic]: generics.html
117124
[panic]: concurrency.html#panics
118125
[get]: http://doc.rust-lang.org/std/vec/struct.Vec.html#method.get

branches/stable/src/etc/maketest.py

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def convert_path_spec(name, value):
5757
putenv('RUSTFLAGS', sys.argv[15])
5858
putenv('LLVM_COMPONENTS', sys.argv[16])
5959
putenv('LLVM_CXXFLAGS', sys.argv[17])
60+
putenv('CXX', sys.argv[18])
6061
putenv('PYTHON', sys.executable)
6162
os.putenv('TARGET', target_triple)
6263

branches/stable/src/etc/tidy.py

+18
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@
2424

2525
interesting_files = ['.rs', '.py', '.js', '.sh', '.c', '.h']
2626
uninteresting_files = ['miniz.c', 'jquery', 'rust_android_dummy']
27+
stable_whitelist = {
28+
'src/bootstrap',
29+
'src/build_helper',
30+
'src/libcollectionstest',
31+
'src/libcore',
32+
'src/libstd',
33+
'src/rustc/std_shim',
34+
'src/test'
35+
}
2736

2837

2938
def report_error_name_no(name, no, s):
@@ -93,6 +102,7 @@ def interesting_file(f):
93102
file_counts = {ext: 0 for ext in interesting_files}
94103

95104
all_paths = set()
105+
needs_unstable_attr = set()
96106

97107
try:
98108
for (dirpath, dirnames, filenames) in os.walk(src_dir):
@@ -149,6 +159,9 @@ def interesting_file(f):
149159
else:
150160
if "SNAP " in line:
151161
report_warn("unmatched SNAP line: " + line)
162+
search = re.search(r'^#!\[unstable', line)
163+
if search:
164+
needs_unstable_attr.discard(filename)
152165

153166
if cr_flag in line:
154167
check_cr = False
@@ -181,6 +194,9 @@ def interesting_file(f):
181194
check_cr = True
182195
check_tab = True
183196
check_linelength = True
197+
if all(f not in filename for f in stable_whitelist) and \
198+
re.search(r'src/.*/lib\.rs', filename):
199+
needs_unstable_attr.add(filename)
184200

185201
# Put a reasonable limit on the amount of header data we use for
186202
# the licenseck
@@ -195,6 +211,8 @@ def interesting_file(f):
195211
update_counts(current_name)
196212
assert len(current_contents) > 0
197213
do_license_check(current_name, current_contents)
214+
for f in needs_unstable_attr:
215+
report_error_name_no(f, 1, "requires unstable attribute")
198216

199217
except UnicodeDecodeError as e:
200218
report_err("UTF-8 decoding error " + str(e))

branches/stable/src/libcollections/vec.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! A growable list type with heap-allocated contents, written `Vec<T>` but
12-
//! pronounced 'vector.'
11+
//! A contiguous growable array type with heap-allocated contents, written
12+
//! `Vec<T>` but pronounced 'vector.'
1313
//!
1414
//! Vectors have `O(1)` indexing, amortized `O(1)` push (to the end) and
1515
//! `O(1)` pop (from the end).
@@ -78,7 +78,7 @@ use borrow::{Cow, IntoCow};
7878

7979
use super::range::RangeArgument;
8080

81-
/// A growable list type, written `Vec<T>` but pronounced 'vector.'
81+
/// A contiguous growable array type, written `Vec<T>` but pronounced 'vector.'
8282
///
8383
/// # Examples
8484
///

branches/stable/src/libcore/num/u16.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
1515
#![stable(feature = "rust1", since = "1.0.0")]
1616

17-
uint_module! { u16, i16, 16 }
17+
uint_module! { u16, 16 }

branches/stable/src/libcore/num/u32.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
1515
#![stable(feature = "rust1", since = "1.0.0")]
1616

17-
uint_module! { u32, i32, 32 }
17+
uint_module! { u32, 32 }

branches/stable/src/libcore/num/u64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
1515
#![stable(feature = "rust1", since = "1.0.0")]
1616

17-
uint_module! { u64, i64, 64 }
17+
uint_module! { u64, 64 }

branches/stable/src/libcore/num/u8.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
1515
#![stable(feature = "rust1", since = "1.0.0")]
1616

17-
uint_module! { u8, i8, 8 }
17+
uint_module! { u8, 8 }

branches/stable/src/libcore/num/uint_macros.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#![doc(hidden)]
1212

13-
macro_rules! uint_module { ($T:ty, $T_SIGNED:ty, $bits:expr) => (
13+
macro_rules! uint_module { ($T:ty, $bits:expr) => (
1414

1515
#[unstable(feature = "num_bits_bytes",
1616
reason = "may want to be an associated function",

branches/stable/src/libcore/num/usize.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
#![stable(feature = "rust1", since = "1.0.0")]
1616

1717
#[cfg(target_pointer_width = "32")]
18-
uint_module! { usize, isize, 32 }
18+
uint_module! { usize, 32 }
1919
#[cfg(target_pointer_width = "64")]
20-
uint_module! { usize, isize, 64 }
20+
uint_module! { usize, 64 }

branches/stable/src/librustc/session/config.rs

+14-4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use syntax::attr;
2828
use syntax::attr::AttrMetaMethods;
2929
use syntax::errors::{ColorConfig, Handler};
3030
use syntax::parse;
31+
use syntax::parse::lexer::Reader;
3132
use syntax::parse::token::InternedString;
3233
use syntax::feature_gate::UnstableFeatures;
3334

@@ -906,10 +907,19 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
906907
// Convert strings provided as --cfg [cfgspec] into a crate_cfg
907908
pub fn parse_cfgspecs(cfgspecs: Vec<String> ) -> ast::CrateConfig {
908909
cfgspecs.into_iter().map(|s| {
909-
parse::parse_meta_from_source_str("cfgspec".to_string(),
910-
s.to_string(),
911-
Vec::new(),
912-
&parse::ParseSess::new())
910+
let sess = parse::ParseSess::new();
911+
let mut parser = parse::new_parser_from_source_str(&sess,
912+
Vec::new(),
913+
"cfgspec".to_string(),
914+
s.to_string());
915+
let meta_item = panictry!(parser.parse_meta_item());
916+
917+
if !parser.reader.is_eof() {
918+
early_error(ErrorOutputType::default(), &format!("invalid --cfg argument: {}",
919+
s))
920+
}
921+
922+
meta_item
913923
}).collect::<ast::CrateConfig>()
914924
}
915925

branches/stable/src/librustc_driver/pretty.rs

+49-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ use rustc_borrowck::graphviz as borrowck_dot;
3030
use rustc_resolve as resolve;
3131
use rustc_metadata::cstore::CStore;
3232

33+
use rustc_mir::pretty::write_mir_pretty;
34+
3335
use syntax::ast::{self, BlockCheckMode};
3436
use syntax::codemap;
3537
use syntax::fold::{self, Folder};
@@ -77,6 +79,7 @@ pub enum PpMode {
7779
PpmSource(PpSourceMode),
7880
PpmHir(PpSourceMode),
7981
PpmFlowGraph(PpFlowGraphMode),
82+
PpmMir,
8083
}
8184

8285
pub fn parse_pretty(sess: &Session,
@@ -96,14 +99,15 @@ pub fn parse_pretty(sess: &Session,
9699
("hir", true) => PpmHir(PpmNormal),
97100
("hir,identified", true) => PpmHir(PpmIdentified),
98101
("hir,typed", true) => PpmHir(PpmTyped),
102+
("mir", true) => PpmMir,
99103
("flowgraph", true) => PpmFlowGraph(PpFlowGraphMode::Default),
100104
("flowgraph,unlabelled", true) => PpmFlowGraph(PpFlowGraphMode::UnlabelledEdges),
101105
_ => {
102106
if extended {
103107
sess.fatal(&format!("argument to `unpretty` must be one of `normal`, \
104108
`expanded`, `flowgraph[,unlabelled]=<nodeid>`, \
105109
`identified`, `expanded,identified`, `everybody_loops`, \
106-
`hir`, `hir,identified`, or `hir,typed`; got {}",
110+
`hir`, `hir,identified`, `hir,typed`, or `mir`; got {}",
107111
name));
108112
} else {
109113
sess.fatal(&format!("argument to `pretty` must be one of `normal`, `expanded`, \
@@ -569,6 +573,7 @@ fn needs_ast_map(ppm: &PpMode, opt_uii: &Option<UserIdentifiedItem>) -> bool {
569573
PpmSource(PpmExpandedIdentified) |
570574
PpmSource(PpmExpandedHygiene) |
571575
PpmHir(_) |
576+
PpmMir |
572577
PpmFlowGraph(_) => true,
573578
PpmSource(PpmTyped) => panic!("invalid state"),
574579
}
@@ -584,6 +589,7 @@ fn needs_expansion(ppm: &PpMode) -> bool {
584589
PpmSource(PpmExpandedIdentified) |
585590
PpmSource(PpmExpandedHygiene) |
586591
PpmHir(_) |
592+
PpmMir |
587593
PpmFlowGraph(_) => true,
588594
PpmSource(PpmTyped) => panic!("invalid state"),
589595
}
@@ -801,6 +807,48 @@ pub fn pretty_print_input(sess: Session,
801807
})
802808
}
803809

810+
(PpmMir, None) => {
811+
debug!("pretty printing MIR for whole crate");
812+
let ast_map = ast_map.expect("--unpretty mir missing ast_map");
813+
abort_on_err(driver::phase_3_run_analysis_passes(&sess,
814+
&cstore,
815+
ast_map,
816+
&arenas,
817+
&id,
818+
resolve::MakeGlobMap::No,
819+
|tcx, mir_map, _, _| {
820+
let mir_map = mir_map.unwrap();
821+
822+
for (nodeid, mir) in &mir_map.map {
823+
try!(writeln!(out, "MIR for {}", tcx.map.node_to_string(*nodeid)));
824+
try!(write_mir_pretty(mir, &mut out));
825+
}
826+
827+
Ok(())
828+
}), &sess)
829+
}
830+
831+
(PpmMir, Some(uii)) => {
832+
debug!("pretty printing MIR for {:?}", uii);
833+
let ast_map = ast_map.expect("--unpretty mir missing ast_map");
834+
let nodeid = uii.to_one_node_id("--unpretty", &sess, &ast_map);
835+
836+
abort_on_err(driver::phase_3_run_analysis_passes(&sess,
837+
&cstore,
838+
ast_map,
839+
&arenas,
840+
&id,
841+
resolve::MakeGlobMap::No,
842+
|tcx, mir_map, _, _| {
843+
let mir_map = mir_map.unwrap();
844+
try!(writeln!(out, "MIR for {}", tcx.map.node_to_string(nodeid)));
845+
let mir = mir_map.map.get(&nodeid).unwrap_or_else(|| {
846+
sess.fatal(&format!("no MIR map entry for node {}", nodeid))
847+
});
848+
write_mir_pretty(mir, &mut out)
849+
}), &sess)
850+
}
851+
804852
(PpmFlowGraph(mode), opt_uii) => {
805853
debug!("pretty printing flow graph for {:?}", opt_uii);
806854
let uii = opt_uii.unwrap_or_else(|| {

branches/stable/src/librustdoc/html/layout.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ r##"<!DOCTYPE html>
122122
123123
<p>
124124
Search functions by type signature (e.g.
125-
<code>vec -> usize</code>)
125+
<code>vec -> usize</code> or <code>* -> vec</code>)
126126
</p>
127127
</div>
128128
</div>

branches/stable/src/librustdoc/html/static/main.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@
280280
var parts = val.split("->").map(trimmer);
281281
var input = parts[0];
282282
// sort inputs so that order does not matter
283-
var inputs = input.split(",").map(trimmer).sort();
283+
var inputs = input.split(",").map(trimmer).sort().toString();
284284
var output = parts[1];
285285

286286
for (var i = 0; i < nSearchWords; ++i) {
@@ -296,8 +296,8 @@
296296

297297
// allow searching for void (no output) functions as well
298298
var typeOutput = type.output ? type.output.name : "";
299-
if (inputs.toString() === typeInputs.toString() &&
300-
output == typeOutput) {
299+
if ((inputs === "*" || inputs === typeInputs.toString()) &&
300+
(output === "*" || output == typeOutput)) {
301301
results.push({id: i, index: -1, dontValidate: true});
302302
}
303303
}

0 commit comments

Comments
 (0)