Skip to content

Rollup of 7 pull requests #31210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 40 commits into from
Jan 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f2c0ecd
enable cross crate and unsafe const fn
oli-obk Jan 14, 2016
b1b6b33
Some basic error correction in the parser after a dot
nrc Jan 20, 2016
0ac8915
The war on abort_if_errors
nrc Jan 20, 2016
585cf6f
Prevent missing idents from causing problems down the line
nrc Jan 20, 2016
f3b525f
test fallout
nrc Jan 20, 2016
ff009d1
test
nrc Jan 20, 2016
616bfb6
Extended save-analysis to support generated code, alterned some spans…
DanielJCampbell Jan 21, 2016
276fae1
thorough follow-set tests
durka Jan 23, 2016
e1e0de8
add `[` to FOLLOW(ty) and FOLLOW(path)
durka Jan 23, 2016
a469cef
Clarify when `Cargo.lock` is created by `cargo build` in the book
dirk Jan 24, 2016
012d68a
doc: miscellaneous OpenOptions:append improvements
tshepang Jan 21, 2016
c0984e4
fix condition for clang
mopp Jan 24, 2016
47593da
Improve the error explanations for check_const
arielb1 Jan 24, 2016
5a81d9a
Auto merge of #30932 - arielb1:raw-const-errors, r=nagisa
bors Jan 24, 2016
73854b1
sys/unix/process.rs: Update comments in make_argv and make_envp
geofft Jan 20, 2016
289020b
Auto merge of #31162 - mopp:fix_configure_for_new_clang, r=alexcrichton
bors Jan 24, 2016
4043c02
Auto merge of #31093 - tshepang:misc-doc-improvements, r=steveklabnik
bors Jan 24, 2016
ba356ff
Auto merge of #31166 - geofft:process-comments, r=alexcrichton
bors Jan 24, 2016
6866f13
Auto merge of #31159 - dirk:dirk/clarify-cargo-lock, r=steveklabnik
bors Jan 25, 2016
d942621
Register LLVM passes with the correct LLVM pass manager.
frewsxcv Jan 25, 2016
71656d2
librustc/middle/dataflow.rs: Debug to STDERR
adrianheine Jan 25, 2016
c22cb53
Auto merge of #31176 - frewsxcv:incorrect-pass-kind, r=dotdash
bors Jan 25, 2016
86ffe5d
Auto merge of #31182 - adrianheine:master, r=pnkfelix
bors Jan 25, 2016
e0fd9c3
remove implicator
Jan 25, 2016
62a3a6e
Auto merge of #30899 - oli-obk:non-local-const-fn, r=pnkfelix
bors Jan 25, 2016
43b3681
Fix a rebasing issue and addressed reviewer comment
nrc Jan 21, 2016
03681b1
Fix link to hello-cargo in the book
ollie27 Jan 25, 2016
ace39cb
Replace link to learn-rust in the book
ollie27 Jan 25, 2016
eceb96b
Auto merge of #31097 - DanielJCampbell:SaveAnalysis, r=nrc
bors Jan 25, 2016
a193536
RefCell::borrow_mut example should demonstrate mut
frewsxcv Jan 25, 2016
faf6d1e
Auto merge of #31065 - nrc:ident-correct, r=pnkfelix
bors Jan 26, 2016
b3ebe94
Fix typo in "Loops" section of the book
apasel422 Jan 26, 2016
6c56260
Mention the need for a linker
steveklabnik Jan 26, 2016
b46bd2f
Rollup merge of #31152 - durka:ty-follow-bracket, r=pnkfelix
Manishearth Jan 26, 2016
ced313c
Rollup merge of #31184 - arielb1:remove-implicator, r=nikomatsakis
Manishearth Jan 26, 2016
74ef5aa
Rollup merge of #31189 - ollie27:book_links, r=steveklabnik
Manishearth Jan 26, 2016
37b48ed
Rollup merge of #31192 - frewsxcv:patch-27, r=alexcrichton
Manishearth Jan 26, 2016
24931a3
Rollup merge of #31197 - apasel422:issue-31195, r=steveklabnik
Manishearth Jan 26, 2016
486fd89
Rollup merge of #31199 - steveklabnik:gh31181, r=Manishearth
Manishearth Jan 26, 2016
79157b3
Rollup merge of #31201 - steveklabnik:gh30633, r=alexcrichton
Manishearth Jan 26, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ then
esac
else
case $CFG_CLANG_VERSION in
(3.2* | 3.3* | 3.4* | 3.5* | 3.6* | 3.7* | 3.8*)
(3.2* | 3.3* | 3.4* | 3.5* | 3.6* | 3.7* | 3.8* | 3.9*)
step_msg "found ok version of CLANG: $CFG_CLANG_VERSION"
;;
(*)
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -1512,7 +1512,7 @@ and [`rustc-serialize`](https://crates.io/crates/rustc-serialize) crates.

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

To get started from scratch, run `cargo new --bin city-pop` and make sure your
`Cargo.toml` looks something like this:
Expand Down
18 changes: 12 additions & 6 deletions src/doc/book/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ variable. If it isn't, run the installer again, select "Change" on the "Change,
repair, or remove installation" page and ensure "Add to PATH" is installed on
the local hard drive.

Rust does not do its own linking, and so you’ll need to have a linker
installed. Doing so will depend on your specific system, consult its
documentation for more details.

If not, there are a number of places where we can get help. The easiest is
[the #rust IRC channel on irc.mozilla.org][irc], which we can access through
[Mibbit][mibbit]. Click that link, and we'll be chatting with other Rustaceans
Expand Down Expand Up @@ -511,15 +515,17 @@ programming languages. For complex projects composed of multiple crates, it’s
much easier to let Cargo coordinate the build. Using Cargo, you can run `cargo
build`, and it should work the right way.

## Building for Release
### Building for Release

When your project is finally ready for release, you can use `cargo build
When your project is ready for release, you can use `cargo build
--release` to compile your project with optimizations. These optimizations make
your Rust code run faster, but turning them on makes your program take longer
to compile. This is why there are two different profiles, one for development,
and one for building the final program you’ll give to a user.

Running this command also causes Cargo to create a new file called
### What Is That `Cargo.lock`?

Running `cargo build` also causes Cargo to create a new file called
*Cargo.lock*, which looks like this:

```toml
Expand Down Expand Up @@ -602,11 +608,11 @@ This chapter covered the basics that will serve you well through the rest of
this book, and the rest of your time with Rust. Now that you’ve got the tools
down, we'll cover more about the Rust language itself.

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

[learnrust]: learn-rust.html
[guessinggame]: guessing-game.html
[syntax]: syntax-and-semantics.html
9 changes: 0 additions & 9 deletions src/doc/book/learn-rust.md

This file was deleted.

2 changes: 1 addition & 1 deletion src/doc/book/loops.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ for x in 0..10 {
You may also encounter situations where you have nested loops and need to
specify which one your `break` or `continue` statement is for. Like most
other languages, by default a `break` or `continue` will apply to innermost
loop. In a situation where you would like to a `break` or `continue` for one
loop. In a situation where you would like to `break` or `continue` for one
of the outer loops, you can use labels to specify which loop the `break` or
`continue` statement applies to. This will only print when both `x` and `y` are
odd:
Expand Down
4 changes: 3 additions & 1 deletion src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,9 @@ impl<T: ?Sized> RefCell<T> {
///
/// let c = RefCell::new(5);
///
/// let borrowed_five = c.borrow_mut();
/// *c.borrow_mut() = 7;
///
/// assert_eq!(*c.borrow(), 7);
/// ```
///
/// An example of panic:
Expand Down
1 change: 0 additions & 1 deletion src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ pub mod middle {
pub mod free_region;
pub mod intrinsicck;
pub mod infer;
pub mod implicator;
pub mod lang_items;
pub mod liveness;
pub mod mem_categorization;
Expand Down
69 changes: 11 additions & 58 deletions src/librustc/middle/const_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use util::num::ToPrimitive;
use util::nodemap::NodeMap;

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

let mut call_args = NodeMap();
Expand All @@ -1117,7 +1114,6 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
let old = call_args.insert(arg.pat.id, arg_val);
assert!(old.is_none());
}
let result = block.expr.as_ref().unwrap();
debug!("const call({:?})", call_args);
try!(eval_const_expr_partial(tcx, &**result, ty_hint, Some(&call_args)))
},
Expand Down Expand Up @@ -1389,46 +1385,3 @@ pub fn compare_lit_exprs<'tcx>(tcx: &ty::ctxt<'tcx>,
};
compare_const_vals(&a, &b)
}


// returns Err if callee is not `Function`
// `e` is only used for error reporting/spans
fn get_fn_def<'a>(tcx: &'a ty::ctxt,
e: &hir::Expr,
callee: ConstVal)
-> Result<(&'a hir::FnDecl, &'a hir::Block, hir::Constness), ConstEvalErr> {
let did = match callee {
Function(did) => did,
callee => signal!(e, CallOn(callee)),
};
debug!("fn call: {:?}", tcx.map.get_if_local(did));
match tcx.map.get_if_local(did) {
None => signal!(e, UnimplementedConstVal("calling non-local const fn")), // non-local
Some(ast_map::NodeItem(it)) => match it.node {
hir::ItemFn(
ref decl,
hir::Unsafety::Normal,
constness,
abi::Abi::Rust,
_, // ducktype generics? types are funky in const_eval
ref block,
) => Ok((&**decl, &**block, constness)),
_ => signal!(e, NonConstPath),
},
Some(ast_map::NodeImplItem(it)) => match it.node {
hir::ImplItemKind::Method(
hir::MethodSig {
ref decl,
unsafety: hir::Unsafety::Normal,
constness,
abi: abi::Abi::Rust,
.. // ducktype generics? types are funky in const_eval
},
ref block,
) => Ok((decl, block, constness)),
_ => signal!(e, NonConstPath),
},
Some(ast_map::NodeTraitItem(..)) => signal!(e, NonConstPath),
Some(_) => signal!(e, UnimplementedConstVal("calling struct, tuple or variant")),
}
}
36 changes: 20 additions & 16 deletions src/librustc/middle/cstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,24 +267,28 @@ impl InlinedItem {

// FIXME: find a better place for this?
pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option<Span>) {
let say = |s: &str| {
match (sp, sess) {
(_, None) => panic!("{}", s),
(Some(sp), Some(sess)) => sess.span_err(sp, s),
(None, Some(sess)) => sess.err(s),
let mut err_count = 0;
{
let mut say = |s: &str| {
match (sp, sess) {
(_, None) => panic!("{}", s),
(Some(sp), Some(sess)) => sess.span_err(sp, s),
(None, Some(sess)) => sess.err(s),
}
err_count += 1;
};
if s.is_empty() {
say("crate name must not be empty");
}
for c in s.chars() {
if c.is_alphanumeric() { continue }
if c == '_' { continue }
say(&format!("invalid character `{}` in crate name: `{}`", c, s));
}
};
if s.is_empty() {
say("crate name must not be empty");
}
for c in s.chars() {
if c.is_alphanumeric() { continue }
if c == '_' { continue }
say(&format!("invalid character `{}` in crate name: `{}`", c, s));
}
match sess {
Some(sess) => sess.abort_if_errors(),
None => {}

if err_count > 0 {
sess.unwrap().abort_if_errors();
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/librustc/middle/dataflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,7 @@ impl<'a, 'tcx, O:DataFlowOperator+Clone+'static> DataFlowContext<'a, 'tcx, O> {
debug!("{}", {
let mut v = Vec::new();
self.pretty_print_to(box &mut v, blk).unwrap();
println!("{}", String::from_utf8(v).unwrap());
""
String::from_utf8(v).unwrap()
});
}

Expand Down
Loading