Skip to content

Commit 1c5fd93

Browse files
committed
---
yaml --- r: 274267 b: refs/heads/stable c: ef96037 h: refs/heads/master i: 274265: d1e2f0e 274263: 55a5bfe
1 parent fcef2ce commit 1c5fd93

Some content is hidden

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

62 files changed

+1019
-1016
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
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: fee457d3af355f24ef321ea7250e968638f403c8
32+
refs/heads/stable: ef96037f7e95f344d34252fa70bb10109ad5b285
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/doc/book/error-handling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1512,7 +1512,7 @@ and [`rustc-serialize`](https://crates.io/crates/rustc-serialize) crates.
15121512

15131513
We're not going to spend a lot of time on setting up a project with
15141514
Cargo because it is already covered well in [the Cargo
1515-
section](../book/hello-cargo.html) and [Cargo's documentation][14].
1515+
section](getting-started.html#hello-cargo) and [Cargo's documentation][14].
15161516

15171517
To get started from scratch, run `cargo new --bin city-pop` and make sure your
15181518
`Cargo.toml` looks something like this:

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ variable. If it isn't, run the installer again, select "Change" on the "Change,
167167
repair, or remove installation" page and ensure "Add to PATH" is installed on
168168
the local hard drive.
169169

170+
Rust does not do its own linking, and so you’ll need to have a linker
171+
installed. Doing so will depend on your specific system, consult its
172+
documentation for more details.
173+
170174
If not, there are a number of places where we can get help. The easiest is
171175
[the #rust IRC channel on irc.mozilla.org][irc], which we can access through
172176
[Mibbit][mibbit]. Click that link, and we'll be chatting with other Rustaceans
@@ -604,11 +608,11 @@ This chapter covered the basics that will serve you well through the rest of
604608
this book, and the rest of your time with Rust. Now that you’ve got the tools
605609
down, we'll cover more about the Rust language itself.
606610

607-
You have two options: Dive into a project with ‘[Learn Rust][learnrust]’, or
611+
You have two options: Dive into a project with ‘[Tutorial: Guessing Game][guessinggame]’, or
608612
start from the bottom and work your way up with ‘[Syntax and
609613
Semantics][syntax]’. More experienced systems programmers will probably prefer
610-
Learn Rust’, while those from dynamic backgrounds may enjoy either. Different
614+
Tutorial: Guessing Game’, while those from dynamic backgrounds may enjoy either. Different
611615
people learn differently! Choose whatever’s right for you.
612616

613-
[learnrust]: learn-rust.html
617+
[guessinggame]: guessing-game.html
614618
[syntax]: syntax-and-semantics.html

branches/stable/src/doc/book/learn-rust.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ for x in 0..10 {
195195
You may also encounter situations where you have nested loops and need to
196196
specify which one your `break` or `continue` statement is for. Like most
197197
other languages, by default a `break` or `continue` will apply to innermost
198-
loop. In a situation where you would like to a `break` or `continue` for one
198+
loop. In a situation where you would like to `break` or `continue` for one
199199
of the outer loops, you can use labels to specify which loop the `break` or
200200
`continue` statement applies to. This will only print when both `x` and `y` are
201201
odd:

branches/stable/src/libcore/cell.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,9 @@ impl<T: ?Sized> RefCell<T> {
414414
///
415415
/// let c = RefCell::new(5);
416416
///
417-
/// let borrowed_five = c.borrow_mut();
417+
/// *c.borrow_mut() = 7;
418+
///
419+
/// assert_eq!(*c.borrow(), 7);
418420
/// ```
419421
///
420422
/// An example of panic:

branches/stable/src/libcore/iter.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2740,7 +2740,13 @@ pub trait Extend<A> {
27402740
/// It is important to note that both back and forth work on the same range,
27412741
/// and do not cross: iteration is over when they meet in the middle.
27422742
///
2743+
/// In a similar fashion to the [`Iterator`] protocol, once a
2744+
/// `DoubleEndedIterator` returns `None` from a `next_back()`, calling it again
2745+
/// may or may not ever return `Some` again. `next()` and `next_back()` are
2746+
/// interchangable for this purpose.
2747+
///
27432748
/// [`Iterator`]: trait.Iterator.html
2749+
///
27442750
/// # Examples
27452751
///
27462752
/// Basic usage:
@@ -4246,13 +4252,15 @@ impl<A: Step> RangeFrom<A> {
42464252
///
42474253
/// # Examples
42484254
///
4249-
/// ```ignore
4250-
/// for i in (0u8..).step_by(2) {
4255+
/// ```
4256+
/// # #![feature(step_by)]
4257+
///
4258+
/// for i in (0u8..).step_by(2).take(10) {
42514259
/// println!("{}", i);
42524260
/// }
42534261
/// ```
42544262
///
4255-
/// This prints all even `u8` values.
4263+
/// This prints the first ten even natural integers (0 to 18).
42564264
#[unstable(feature = "step_by", reason = "recent addition",
42574265
issue = "27741")]
42584266
pub fn step_by(self, by: A) -> StepBy<A, Self> {

branches/stable/src/librustc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ pub mod middle {
108108
pub mod free_region;
109109
pub mod intrinsicck;
110110
pub mod infer;
111-
pub mod implicator;
112111
pub mod lang_items;
113112
pub mod liveness;
114113
pub mod mem_categorization;

branches/stable/src/librustc/middle/const_eval.rs

Lines changed: 11 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use util::num::ToPrimitive;
2828
use util::nodemap::NodeMap;
2929

3030
use graphviz::IntoCow;
31-
use syntax::{ast, abi};
31+
use syntax::ast;
3232
use rustc_front::hir::Expr;
3333
use rustc_front::hir;
3434
use rustc_front::intravisit::FnKind;
@@ -1090,19 +1090,16 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
10901090
hir::ExprCall(ref callee, ref args) => {
10911091
let sub_ty_hint = ty_hint.erase_hint();
10921092
let callee_val = try!(eval_const_expr_partial(tcx, callee, sub_ty_hint, fn_args));
1093-
let (decl, block, constness) = try!(get_fn_def(tcx, e, callee_val));
1094-
match (ty_hint, constness) {
1095-
(ExprTypeChecked, _) => {
1096-
// no need to check for constness... either check_const
1097-
// already forbids this or we const eval over whatever
1098-
// we want
1099-
},
1100-
(_, hir::Constness::Const) => {
1101-
// we don't know much about the function, so we force it to be a const fn
1102-
// so compilation will fail later in case the const fn's body is not const
1103-
},
1104-
_ => signal!(e, NonConstPath),
1105-
}
1093+
let did = match callee_val {
1094+
Function(did) => did,
1095+
callee => signal!(e, CallOn(callee)),
1096+
};
1097+
let (decl, result) = if let Some(fn_like) = lookup_const_fn_by_id(tcx, did) {
1098+
(fn_like.decl(), &fn_like.body().expr)
1099+
} else {
1100+
signal!(e, NonConstPath)
1101+
};
1102+
let result = result.as_ref().expect("const fn has no result expression");
11061103
assert_eq!(decl.inputs.len(), args.len());
11071104

11081105
let mut call_args = NodeMap();
@@ -1117,7 +1114,6 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
11171114
let old = call_args.insert(arg.pat.id, arg_val);
11181115
assert!(old.is_none());
11191116
}
1120-
let result = block.expr.as_ref().unwrap();
11211117
debug!("const call({:?})", call_args);
11221118
try!(eval_const_expr_partial(tcx, &**result, ty_hint, Some(&call_args)))
11231119
},
@@ -1389,46 +1385,3 @@ pub fn compare_lit_exprs<'tcx>(tcx: &ty::ctxt<'tcx>,
13891385
};
13901386
compare_const_vals(&a, &b)
13911387
}
1392-
1393-
1394-
// returns Err if callee is not `Function`
1395-
// `e` is only used for error reporting/spans
1396-
fn get_fn_def<'a>(tcx: &'a ty::ctxt,
1397-
e: &hir::Expr,
1398-
callee: ConstVal)
1399-
-> Result<(&'a hir::FnDecl, &'a hir::Block, hir::Constness), ConstEvalErr> {
1400-
let did = match callee {
1401-
Function(did) => did,
1402-
callee => signal!(e, CallOn(callee)),
1403-
};
1404-
debug!("fn call: {:?}", tcx.map.get_if_local(did));
1405-
match tcx.map.get_if_local(did) {
1406-
None => signal!(e, UnimplementedConstVal("calling non-local const fn")), // non-local
1407-
Some(ast_map::NodeItem(it)) => match it.node {
1408-
hir::ItemFn(
1409-
ref decl,
1410-
hir::Unsafety::Normal,
1411-
constness,
1412-
abi::Abi::Rust,
1413-
_, // ducktype generics? types are funky in const_eval
1414-
ref block,
1415-
) => Ok((&**decl, &**block, constness)),
1416-
_ => signal!(e, NonConstPath),
1417-
},
1418-
Some(ast_map::NodeImplItem(it)) => match it.node {
1419-
hir::ImplItemKind::Method(
1420-
hir::MethodSig {
1421-
ref decl,
1422-
unsafety: hir::Unsafety::Normal,
1423-
constness,
1424-
abi: abi::Abi::Rust,
1425-
.. // ducktype generics? types are funky in const_eval
1426-
},
1427-
ref block,
1428-
) => Ok((decl, block, constness)),
1429-
_ => signal!(e, NonConstPath),
1430-
},
1431-
Some(ast_map::NodeTraitItem(..)) => signal!(e, NonConstPath),
1432-
Some(_) => signal!(e, UnimplementedConstVal("calling struct, tuple or variant")),
1433-
}
1434-
}

branches/stable/src/librustc/middle/cstore.rs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -267,24 +267,28 @@ impl InlinedItem {
267267

268268
// FIXME: find a better place for this?
269269
pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option<Span>) {
270-
let say = |s: &str| {
271-
match (sp, sess) {
272-
(_, None) => panic!("{}", s),
273-
(Some(sp), Some(sess)) => sess.span_err(sp, s),
274-
(None, Some(sess)) => sess.err(s),
270+
let mut err_count = 0;
271+
{
272+
let mut say = |s: &str| {
273+
match (sp, sess) {
274+
(_, None) => panic!("{}", s),
275+
(Some(sp), Some(sess)) => sess.span_err(sp, s),
276+
(None, Some(sess)) => sess.err(s),
277+
}
278+
err_count += 1;
279+
};
280+
if s.is_empty() {
281+
say("crate name must not be empty");
282+
}
283+
for c in s.chars() {
284+
if c.is_alphanumeric() { continue }
285+
if c == '_' { continue }
286+
say(&format!("invalid character `{}` in crate name: `{}`", c, s));
275287
}
276-
};
277-
if s.is_empty() {
278-
say("crate name must not be empty");
279-
}
280-
for c in s.chars() {
281-
if c.is_alphanumeric() { continue }
282-
if c == '_' { continue }
283-
say(&format!("invalid character `{}` in crate name: `{}`", c, s));
284288
}
285-
match sess {
286-
Some(sess) => sess.abort_if_errors(),
287-
None => {}
289+
290+
if err_count > 0 {
291+
sess.unwrap().abort_if_errors();
288292
}
289293
}
290294

branches/stable/src/librustc/middle/dataflow.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,7 @@ impl<'a, 'tcx, O:DataFlowOperator+Clone+'static> DataFlowContext<'a, 'tcx, O> {
527527
debug!("{}", {
528528
let mut v = Vec::new();
529529
self.pretty_print_to(box &mut v, blk).unwrap();
530-
println!("{}", String::from_utf8(v).unwrap());
531-
""
530+
String::from_utf8(v).unwrap()
532531
});
533532
}
534533

0 commit comments

Comments
 (0)