Skip to content

Commit 891e6fe

Browse files
committed
Auto merge of rust-lang#74543 - Manishearth:rollup-m5w6hyg, r=Manishearth
Rollup of 9 pull requests Successful merges: - rust-lang#73618 (Documentation for the false keyword) - rust-lang#74486 (Improve Read::read_exact documentation) - rust-lang#74514 (Do not clobber RUSTDOCFLAGS) - rust-lang#74516 (do not try fetching the ancestors of errored trait impls) - rust-lang#74520 (include backtrace folder in rust-src component) - rust-lang#74523 (Improve documentation for `core::fmt` internals) - rust-lang#74527 (Add myself to toolstate change notifications for rustfmt) - rust-lang#74534 (Only skip impls of foreign unstable traits) - rust-lang#74536 (fix documentation surrounding the `in` and `for` keywords) Failed merges: r? @ghost
2 parents 2c21a6f + 27947b6 commit 891e6fe

File tree

13 files changed

+90
-19
lines changed

13 files changed

+90
-19
lines changed

src/bootstrap/builder.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1444,6 +1444,10 @@ pub struct Cargo {
14441444
}
14451445

14461446
impl Cargo {
1447+
pub fn rustdocflag(&mut self, arg: &str) -> &mut Cargo {
1448+
self.rustdocflags.arg(arg);
1449+
self
1450+
}
14471451
pub fn rustflag(&mut self, arg: &str) -> &mut Cargo {
14481452
self.rustflags.arg(arg);
14491453
self
@@ -1466,6 +1470,9 @@ impl Cargo {
14661470
}
14671471

14681472
pub fn env(&mut self, key: impl AsRef<OsStr>, value: impl AsRef<OsStr>) -> &mut Cargo {
1473+
// These are managed through rustflag/rustdocflag interfaces.
1474+
assert_ne!(key.as_ref(), "RUSTFLAGS");
1475+
assert_ne!(key.as_ref(), "RUSTDOCFLAGS");
14691476
self.command.env(key.as_ref(), value.as_ref());
14701477
self
14711478
}

src/bootstrap/dist.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,7 @@ impl Step for Src {
10051005
// (essentially libstd and all of its path dependencies)
10061006
let std_src_dirs = [
10071007
"src/build_helper",
1008+
"src/backtrace",
10081009
"src/liballoc",
10091010
"src/libcore",
10101011
"src/libpanic_abort",

src/bootstrap/doc.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -527,11 +527,9 @@ impl Step for Rustc {
527527

528528
// Build cargo command.
529529
let mut cargo = builder.cargo(compiler, Mode::Rustc, SourceType::InTree, target, "doc");
530-
cargo.env(
531-
"RUSTDOCFLAGS",
532-
"--document-private-items \
533-
--enable-index-page -Zunstable-options",
534-
);
530+
cargo.rustdocflag("--document-private-items");
531+
cargo.rustdocflag("--enable-index-page");
532+
cargo.rustdocflag("-Zunstable-options");
535533
compile::rustc_cargo(builder, &mut cargo, target);
536534

537535
// Only include compiler crates, no dependencies of those, such as `libc`.
@@ -624,7 +622,7 @@ impl Step for Rustdoc {
624622
cargo.arg("--no-deps");
625623
cargo.arg("-p").arg("rustdoc");
626624

627-
cargo.env("RUSTDOCFLAGS", "--document-private-items");
625+
cargo.rustdocflag("--document-private-items");
628626
builder.run(&mut cargo.into());
629627
}
630628
}

src/libcore/fmt/rt/v1.rs

+4
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ pub enum Alignment {
3333
Unknown,
3434
}
3535

36+
/// Used by [width](https://doc.rust-lang.org/std/fmt/#width) and [precision](https://doc.rust-lang.org/std/fmt/#precision) specifiers.
3637
#[derive(Copy, Clone)]
3738
pub enum Count {
39+
/// Specified with a literal number, stores the value
3840
Is(usize),
41+
/// Specified using `$` and `*` syntaxes, stores the index into `args`
3942
Param(usize),
43+
/// Not specified
4044
Implied,
4145
}

src/librustc_middle/traits/specialization_graph.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::ich::{self, StableHashingContext};
22
use crate::ty::fast_reject::SimplifiedType;
3+
use crate::ty::fold::TypeFoldable;
34
use crate::ty::{self, TyCtxt};
45
use rustc_data_structures::fx::FxHashMap;
56
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
@@ -226,7 +227,8 @@ pub fn ancestors(
226227
start_from_impl: DefId,
227228
) -> Result<Ancestors<'tcx>, ErrorReported> {
228229
let specialization_graph = tcx.specialization_graph_of(trait_def_id);
229-
if specialization_graph.has_errored {
230+
231+
if specialization_graph.has_errored || tcx.type_of(start_from_impl).references_error() {
230232
Err(ErrorReported)
231233
} else {
232234
Ok(Ancestors {

src/librustdoc/clean/inline.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,11 @@ pub fn build_impl(
346346
// such. This helps prevent dependencies of the standard library, for
347347
// example, from getting documented as "traits `u32` implements" which
348348
// isn't really too helpful.
349-
if let Some(stab) = cx.tcx.lookup_stability(did) {
350-
if stab.level.is_unstable() {
351-
return;
349+
if let Some(trait_did) = associated_trait {
350+
if let Some(stab) = cx.tcx.lookup_stability(trait_did.def_id) {
351+
if stab.level.is_unstable() {
352+
return;
353+
}
352354
}
353355
}
354356
}

src/libstd/io/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,9 @@ pub trait Read {
722722
/// No guarantees are provided about the contents of `buf` when this
723723
/// function is called, implementations cannot rely on any property of the
724724
/// contents of `buf` being true. It is recommended that implementations
725-
/// only write data to `buf` instead of reading its contents.
725+
/// only write data to `buf` instead of reading its contents. The
726+
/// documentation on [`read`] has a more detailed explanation on this
727+
/// subject.
726728
///
727729
/// # Errors
728730
///
@@ -745,6 +747,7 @@ pub trait Read {
745747
///
746748
/// [`File`]s implement `Read`:
747749
///
750+
/// [`read`]: Read::read
748751
/// [`File`]: crate::fs::File
749752
///
750753
/// ```no_run

src/libstd/keyword_docs.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,11 @@ mod extern_keyword {}
387387
//
388388
/// A value of type [`bool`] representing logical **false**.
389389
///
390-
/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
390+
/// `false` is the logical opposite of [`true`].
391391
///
392-
/// [`bool`]: primitive.bool.html
393-
/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
392+
/// See the documentation for [`true`] for more information.
393+
///
394+
/// [`true`]: keyword.true.html
394395
mod false_keyword {}
395396

396397
#[doc(keyword = "fn")]
@@ -473,8 +474,8 @@ mod fn_keyword {}
473474
/// * `for` is also used for [higher-ranked trait bounds] as in `for<'a> &'a T: PartialEq<i32>`.
474475
///
475476
/// for-in-loops, or to be more precise, iterator loops, are a simple syntactic sugar over a common
476-
/// practice within Rust, which is to loop over an iterator until that iterator returns `None` (or
477-
/// `break` is called).
477+
/// practice within Rust, which is to loop over anything that implements [`IntoIterator`] until the
478+
/// iterator returned by `.into_iter()` returns `None` (or the loop body uses `break`).
478479
///
479480
/// ```rust
480481
/// for i in 0..5 {
@@ -680,7 +681,7 @@ mod impl_keyword {}
680681
//
681682
/// Iterate over a series of values with [`for`].
682683
///
683-
/// The expression immediately following `in` must implement the [`Iterator`] trait.
684+
/// The expression immediately following `in` must implement the [`IntoIterator`] trait.
684685
///
685686
/// ## Literal Examples:
686687
///
@@ -689,7 +690,7 @@ mod impl_keyword {}
689690
///
690691
/// (Read more about [range patterns])
691692
///
692-
/// [`Iterator`]: ../book/ch13-04-performance.html
693+
/// [`IntoIterator`]: ../book/ch13-04-performance.html
693694
/// [range patterns]: ../reference/patterns.html?highlight=range#range-patterns
694695
/// [`for`]: keyword.for.html
695696
mod in_keyword {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#![feature(staged_api)]
2+
#![stable(feature = "private_general", since = "1.0.0")]
3+
4+
#[unstable(feature = "private_trait", issue = "none")]
5+
pub trait Bar {}
6+
7+
#[stable(feature = "private_general", since = "1.0.0")]
8+
pub struct Foo {
9+
// nothing
10+
}
11+
12+
impl Foo {
13+
#[stable(feature = "private_general", since = "1.0.0")]
14+
pub fn stable_impl() {}
15+
}
16+
17+
impl Foo {
18+
#[unstable(feature = "private_trait", issue = "none")]
19+
pub fn bar() {}
20+
21+
#[stable(feature = "private_general", since = "1.0.0")]
22+
pub fn bar2() {}
23+
}
24+
25+
#[stable(feature = "private_general", since = "1.0.0")]
26+
impl Bar for Foo {}
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// aux-build:unstable-trait.rs
2+
3+
#![crate_name = "foo"]
4+
#![feature(private_trait)]
5+
6+
extern crate unstable_trait;
7+
8+
// @has foo/struct.Foo.html 'bar'
9+
// @has foo/struct.Foo.html 'bar2'
10+
#[doc(inline)]
11+
pub use unstable_trait::Foo;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![feature(min_specialization)]
2+
3+
trait Trait {}
4+
impl Trait for NonExistent {}
5+
//~^ ERROR cannot find type `NonExistent` in this scope
6+
7+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0412]: cannot find type `NonExistent` in this scope
2+
--> $DIR/impl-on-nonexisting.rs:4:16
3+
|
4+
LL | impl Trait for NonExistent {}
5+
| ^^^^^^^^^^^ not found in this scope
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0412`.

src/tools/publish_toolstate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
MAINTAINERS = {
2727
'miri': {'oli-obk', 'RalfJung', 'eddyb'},
2828
'rls': {'Xanewok'},
29-
'rustfmt': {'topecongiro'},
29+
'rustfmt': {'topecongiro', 'calebcartwright'},
3030
'book': {'carols10cents', 'steveklabnik'},
3131
'nomicon': {'frewsxcv', 'Gankra'},
3232
'reference': {'steveklabnik', 'Havvy', 'matthewjasper', 'ehuss'},

0 commit comments

Comments
 (0)