Skip to content

Commit

Permalink
Auto merge of #28685 - steveklabnik:rollup, r=steveklabnik
Browse files Browse the repository at this point in the history
- Successful merges: #28666, #28674, #28677, #28678, #28679, #28680
- Failed merges: #28621
  • Loading branch information
bors committed Sep 27, 2015
2 parents 7bf4c88 + cc44d65 commit 90c04d0
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 16 deletions.
7 changes: 4 additions & 3 deletions src/doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

## Building

To generate all the docs, just run `make docs` from the root of the repository.
This will convert the distributed Markdown docs to HTML and generate HTML doc
for the 'std' and 'extra' libraries.
To generate all the docs, follow the "Building Documentation" instructions in
the README in the root of the repository. This will convert the distributed
Markdown docs to HTML and generate HTML doc for the books, 'std' and 'extra'
libraries.

To generate HTML documentation from one source file/crate, do something like:

Expand Down
2 changes: 1 addition & 1 deletion src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ mod foo {
}
use foo::example::iter; // good: foo is at crate root
// use example::iter; // bad: core is not at the crate root
// use example::iter; // bad: example is not at the crate root
use self::baz::foobaz; // good: self refers to module 'foo'
use foo::bar::foobar; // good: foo is at crate root
Expand Down
9 changes: 5 additions & 4 deletions src/doc/trpl/iterators.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,16 @@ let greater_than_forty_two = (0..100)
.find(|x| *x > 42);

match greater_than_forty_two {
Some(_) => println!("We got some numbers!"),
None => println!("No numbers found :("),
Some(_) => println!("Found a match!"),
None => println!("No match found :("),
}
```

`find` takes a closure, and works on a reference to each element of an
iterator. This closure returns `true` if the element is the element we're
looking for, and `false` otherwise. Because we might not find a matching
element, `find` returns an `Option` rather than the element itself.
looking for, and `false` otherwise. `find` returns the first element satisfying
the specified predicate. Because we might not find a matching element, `find`
returns an `Option` rather than the element itself.

Another important consumer is `fold`. Here's what it looks like:

Expand Down
2 changes: 2 additions & 0 deletions src/doc/trpl/structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ You can define a `struct` with no members at all:

```rust
struct Electron;

let x = Electron;
```

Such a `struct` is called ‘unit-like’ because it resembles the empty
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1628,7 +1628,7 @@ impl<Idx: fmt::Debug> fmt::Debug for RangeTo<Idx> {
/// impl<T> Deref for DerefExample<T> {
/// type Target = T;
///
/// fn deref<'a>(&'a self) -> &'a T {
/// fn deref(&self) -> &T {
/// &self.value
/// }
/// }
Expand Down
20 changes: 13 additions & 7 deletions src/librustc/middle/check_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,20 +709,26 @@ fn check_expr<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>,
if !is_const {
v.add_qualif(ConstQualif::NOT_CONST);
if v.mode != Mode::Var {
fn span_limited_call_error(tcx: &ty::ctxt, span: Span, s: &str) {
span_err!(tcx.sess, span, E0015, "{}", s);
}

// FIXME(#24111) Remove this check when const fn stabilizes
if let UnstableFeatures::Disallow = v.tcx.sess.opts.unstable_features {
span_err!(v.tcx.sess, e.span, E0015,
"function calls in {}s are limited to \
struct and enum constructors", v.msg());
span_limited_call_error(&v.tcx, e.span,
&format!("function calls in {}s are limited to \
struct and enum constructors",
v.msg()));
v.tcx.sess.span_note(e.span,
"a limited form of compile-time function \
evaluation is available on a nightly \
compiler via `const fn`");
} else {
span_err!(v.tcx.sess, e.span, E0015,
"function calls in {}s are limited to \
constant functions, \
struct and enum constructors", v.msg());
span_limited_call_error(&v.tcx, e.span,
&format!("function calls in {}s are limited \
to constant functions, \
struct and enum constructors",
v.msg()));
}
}
}
Expand Down

0 comments on commit 90c04d0

Please sign in to comment.