Skip to content

Commit 90c04d0

Browse files
committed
Auto merge of #28685 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #28666, #28674, #28677, #28678, #28679, #28680 - Failed merges: #28621
2 parents 7bf4c88 + cc44d65 commit 90c04d0

File tree

6 files changed

+26
-16
lines changed

6 files changed

+26
-16
lines changed

src/doc/README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
## Building
44

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

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

src/doc/reference.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ mod foo {
881881
}
882882
883883
use foo::example::iter; // good: foo is at crate root
884-
// use example::iter; // bad: core is not at the crate root
884+
// use example::iter; // bad: example is not at the crate root
885885
use self::baz::foobaz; // good: self refers to module 'foo'
886886
use foo::bar::foobar; // good: foo is at crate root
887887

src/doc/trpl/iterators.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,16 @@ let greater_than_forty_two = (0..100)
150150
.find(|x| *x > 42);
151151

152152
match greater_than_forty_two {
153-
Some(_) => println!("We got some numbers!"),
154-
None => println!("No numbers found :("),
153+
Some(_) => println!("Found a match!"),
154+
None => println!("No match found :("),
155155
}
156156
```
157157

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

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

src/doc/trpl/structs.md

+2
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ You can define a `struct` with no members at all:
184184

185185
```rust
186186
struct Electron;
187+
188+
let x = Electron;
187189
```
188190

189191
Such a `struct` is called ‘unit-like’ because it resembles the empty

src/libcore/ops.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1628,7 +1628,7 @@ impl<Idx: fmt::Debug> fmt::Debug for RangeTo<Idx> {
16281628
/// impl<T> Deref for DerefExample<T> {
16291629
/// type Target = T;
16301630
///
1631-
/// fn deref<'a>(&'a self) -> &'a T {
1631+
/// fn deref(&self) -> &T {
16321632
/// &self.value
16331633
/// }
16341634
/// }

src/librustc/middle/check_const.rs

+13-7
Original file line numberDiff line numberDiff line change
@@ -709,20 +709,26 @@ fn check_expr<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>,
709709
if !is_const {
710710
v.add_qualif(ConstQualif::NOT_CONST);
711711
if v.mode != Mode::Var {
712+
fn span_limited_call_error(tcx: &ty::ctxt, span: Span, s: &str) {
713+
span_err!(tcx.sess, span, E0015, "{}", s);
714+
}
715+
712716
// FIXME(#24111) Remove this check when const fn stabilizes
713717
if let UnstableFeatures::Disallow = v.tcx.sess.opts.unstable_features {
714-
span_err!(v.tcx.sess, e.span, E0015,
715-
"function calls in {}s are limited to \
716-
struct and enum constructors", v.msg());
718+
span_limited_call_error(&v.tcx, e.span,
719+
&format!("function calls in {}s are limited to \
720+
struct and enum constructors",
721+
v.msg()));
717722
v.tcx.sess.span_note(e.span,
718723
"a limited form of compile-time function \
719724
evaluation is available on a nightly \
720725
compiler via `const fn`");
721726
} else {
722-
span_err!(v.tcx.sess, e.span, E0015,
723-
"function calls in {}s are limited to \
724-
constant functions, \
725-
struct and enum constructors", v.msg());
727+
span_limited_call_error(&v.tcx, e.span,
728+
&format!("function calls in {}s are limited \
729+
to constant functions, \
730+
struct and enum constructors",
731+
v.msg()));
726732
}
727733
}
728734
}

0 commit comments

Comments
 (0)