Skip to content

Commit 2e495d2

Browse files
committed
Auto merge of rust-lang#84008 - Dylan-DPC:rollup-invxvg8, r=Dylan-DPC
Rollup of 6 pull requests Successful merges: - rust-lang#80733 (Improve links in inline code in `core::pin`.) - rust-lang#81764 (Stabilize `rustdoc::bare_urls` lint) - rust-lang#81938 (Stabilize `peekable_peek_mut`) - rust-lang#83980 (Fix outdated crate names in compiler docs) - rust-lang#83992 (Merge idents when generating source content) - rust-lang#84001 (Update Clippy) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 1255053 + f77be84 commit 2e495d2

File tree

391 files changed

+10738
-6199
lines changed

Some content is hidden

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

391 files changed

+10738
-6199
lines changed

compiler/rustc_ast/src/expand/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
//! Definitions shared by macros / syntax extensions and e.g. librustc_middle.
1+
//! Definitions shared by macros / syntax extensions and e.g. `rustc_middle`.
22
33
pub mod allocator;

compiler/rustc_ast/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
5959

6060
/// Requirements for a `StableHashingContext` to be used in this crate.
6161
/// This is a hack to allow using the `HashStable_Generic` derive macro
62-
/// instead of implementing everything in librustc_middle.
62+
/// instead of implementing everything in `rustc_middle`.
6363
pub trait HashStableContext: rustc_span::HashStableContext {
6464
fn hash_attr(&mut self, _: &ast::Attribute, hasher: &mut StableHasher);
6565
}

compiler/rustc_ast_lowering/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ struct LoweringContext<'a, 'hir: 'a> {
9393

9494
/// HACK(Centril): there is a cyclic dependency between the parser and lowering
9595
/// if we don't have this function pointer. To avoid that dependency so that
96-
/// librustc_middle is independent of the parser, we use dynamic dispatch here.
96+
/// `rustc_middle` is independent of the parser, we use dynamic dispatch here.
9797
nt_to_tokenstream: NtToTokenstream,
9898

9999
/// Used to allocate HIR nodes.

compiler/rustc_codegen_cranelift/src/vtable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Codegen vtables and vtable accesses.
22
//!
3-
//! See librustc_codegen_llvm/meth.rs for reference
3+
//! See `rustc_codegen_ssa/src/meth.rs` for reference.
44
// FIXME dedup this logic between miri, cg_llvm and cg_clif
55

66
use crate::prelude::*;

compiler/rustc_data_structures/src/svh.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub struct Svh {
1919
impl Svh {
2020
/// Creates a new `Svh` given the hash. If you actually want to
2121
/// compute the SVH from some HIR, you want the `calculate_svh`
22-
/// function found in `librustc_incremental`.
22+
/// function found in `rustc_incremental`.
2323
pub fn new(hash: u64) -> Svh {
2424
Svh { hash }
2525
}

compiler/rustc_feature/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! # Feature gates
22
//!
33
//! This crate declares the set of past and present unstable features in the compiler.
4-
//! Feature gate checking itself is done in `librustc_ast_passes/feature_gate.rs`
4+
//! Feature gate checking itself is done in `rustc_ast_passes/src/feature_gate.rs`
55
//! at the moment.
66
//!
77
//! Features are enabled in programs via the crate-level attributes of

compiler/rustc_hir/src/stable_hash_impls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_span::def_id::{DefPathHash, LocalDefId};
99

1010
/// Requirements for a `StableHashingContext` to be used in this crate.
1111
/// This is a hack to allow using the `HashStable_Generic` derive macro
12-
/// instead of implementing everything in librustc_middle.
12+
/// instead of implementing everything in `rustc_middle`.
1313
pub trait HashStableContext:
1414
rustc_ast::HashStableContext + rustc_target::HashStableContext
1515
{

compiler/rustc_hir/src/weak_lang_items.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ pub static WEAK_ITEMS_REFS: SyncLazy<StableMap<Symbol, LangItem>> = SyncLazy::ne
1818
map
1919
});
2020

21-
/// The `check_name` argument avoids the need for `librustc_hir` to depend on
22-
/// `librustc_session`.
21+
/// The `check_name` argument avoids the need for `rustc_hir` to depend on
22+
/// `rustc_session`.
2323
pub fn link_name<'a, F>(check_name: F, attrs: &'a [ast::Attribute]) -> Option<Symbol>
2424
where
2525
F: Fn(&'a ast::Attribute, Symbol) -> bool

compiler/rustc_infer/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! - **Type inference.** The type inference code can be found in the `infer` module;
44
//! this code handles low-level equality and subtyping operations. The
5-
//! type check pass in the compiler is found in the `librustc_typeck` crate.
5+
//! type check pass in the compiler is found in the `rustc_typeck` crate.
66
//!
77
//! For more information about how rustc works, see the [rustc dev guide].
88
//!

compiler/rustc_lexer/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
//! Low-level Rust lexer.
22
//!
3-
//! The idea with `librustc_lexer` is to make a reusable library,
3+
//! The idea with `rustc_lexer` is to make a reusable library,
44
//! by separating out pure lexing and rustc-specific concerns, like spans,
55
//! error reporting, and interning. So, rustc_lexer operates directly on `&str`,
66
//! produces simple tokens which are a pair of type-tag and a bit of original text,
77
//! and does not report errors, instead storing them as flags on the token.
88
//!
99
//! Tokens produced by this lexer are not yet ready for parsing the Rust syntax.
10-
//! For that see [`librustc_parse::lexer`], which converts this basic token stream
10+
//! For that see [`rustc_parse::lexer`], which converts this basic token stream
1111
//! into wide tokens used by actual parser.
1212
//!
1313
//! The purpose of this crate is to convert raw sources into a labeled sequence
@@ -17,7 +17,7 @@
1717
//! The main entity of this crate is the [`TokenKind`] enum which represents common
1818
//! lexeme types.
1919
//!
20-
//! [`librustc_parse::lexer`]: ../rustc_parse/lexer/index.html
20+
//! [`rustc_parse::lexer`]: ../rustc_parse/lexer/index.html
2121
// We want to be able to build this crate with a stable compiler, so no
2222
// `#![feature]` attributes should be added.
2323

compiler/rustc_lint/src/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2280,7 +2280,7 @@ declare_lint! {
22802280
}
22812281

22822282
declare_lint_pass!(
2283-
/// Check for used feature gates in `INCOMPLETE_FEATURES` in `librustc_feature/active.rs`.
2283+
/// Check for used feature gates in `INCOMPLETE_FEATURES` in `rustc_feature/src/active.rs`.
22842284
IncompleteFeatures => [INCOMPLETE_FEATURES]
22852285
);
22862286

compiler/rustc_lint/src/levels.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -464,15 +464,16 @@ impl<'s> LintLevelsBuilder<'s> {
464464
// we don't warn about the name change.
465465
if let CheckLintNameResult::Warning(_, Some(new_name)) = lint_result {
466466
// Ignore any errors or warnings that happen because the new name is inaccurate
467-
if let CheckLintNameResult::Ok(ids) =
468-
store.check_lint_name(&new_name, tool_name)
469-
{
467+
// NOTE: `new_name` already includes the tool name, so we don't have to add it again.
468+
if let CheckLintNameResult::Ok(ids) = store.check_lint_name(&new_name, None) {
470469
let src =
471470
LintLevelSource::Node(Symbol::intern(&new_name), li.span(), reason);
472471
for &id in ids {
473472
self.check_gated_lint(id, attr.span);
474473
self.insert_spec(&mut specs, id, (level, src));
475474
}
475+
} else {
476+
panic!("renamed lint does not exist: {}", new_name);
476477
}
477478
}
478479
}

compiler/rustc_middle/src/ich/impls_syntax.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! This module contains `HashStable` implementations for various data types
2-
//! from librustc_ast in no particular order.
2+
//! from `rustc_ast` in no particular order.
33
44
use crate::ich::StableHashingContext;
55

compiler/rustc_middle/src/mir/interpret/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static_assert_size!(InterpErrorInfo<'_>, 8);
4646
/// Packages the kind of error we got from the const code interpreter
4747
/// up with a Rust-level backtrace of where the error occurred.
4848
/// Thsese should always be constructed by calling `.into()` on
49-
/// a `InterpError`. In `librustc_mir::interpret`, we have `throw_err_*`
49+
/// a `InterpError`. In `rustc_mir::interpret`, we have `throw_err_*`
5050
/// macros for this.
5151
#[derive(Debug)]
5252
pub struct InterpErrorInfo<'tcx>(Box<InterpErrorInfoInner<'tcx>>);

compiler/rustc_middle/src/traits/query.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! which makes a canonical query by replacing unbound inference
44
//! variables and regions, so that results can be reused more broadly.
55
//! The providers for the queries defined here can be found in
6-
//! `librustc_traits`.
6+
//! `rustc_traits`.
77
88
use crate::ich::StableHashingContext;
99
use crate::infer::canonical::{Canonical, QueryResponse};

compiler/rustc_middle/src/ty/fold.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use std::ops::ControlFlow;
4444
/// This trait is implemented for every type that can be folded.
4545
/// Basically, every type that has a corresponding method in `TypeFolder`.
4646
///
47-
/// To implement this conveniently, use the derive macro located in librustc_macros.
47+
/// To implement this conveniently, use the derive macro located in `rustc_macros`.
4848
pub trait TypeFoldable<'tcx>: fmt::Debug + Clone {
4949
fn super_fold_with<F: TypeFolder<'tcx>>(self, folder: &mut F) -> Self;
5050
fn fold_with<F: TypeFolder<'tcx>>(self, folder: &mut F) -> Self {

compiler/rustc_middle/src/ty/sty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl BoundRegionKind {
8080
/// Defines the kinds of types.
8181
///
8282
/// N.B., if you change this, you'll probably want to change the corresponding
83-
/// AST structure in `librustc_ast/ast.rs` as well.
83+
/// AST structure in `rustc_ast/src/ast.rs` as well.
8484
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable, Debug)]
8585
#[derive(HashStable)]
8686
#[rustc_diagnostic_item = "TyKind"]
@@ -2116,7 +2116,7 @@ impl<'tcx> TyS<'tcx> {
21162116
///
21172117
/// Note that during type checking, we use an inference variable
21182118
/// to represent the closure kind, because it has not yet been
2119-
/// inferred. Once upvar inference (in `src/librustc_typeck/check/upvar.rs`)
2119+
/// inferred. Once upvar inference (in `rustc_typeck/src/check/upvar.rs`)
21202120
/// is complete, that type variable will be unified.
21212121
pub fn to_opt_closure_kind(&self) -> Option<ty::ClosureKind> {
21222122
match self.kind() {

compiler/rustc_mir/src/borrow_check/region_infer/graphviz.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! This module provides linkage between RegionInferenceContext and
2-
//! librustc_graphviz traits, specialized to attaching borrowck analysis
2+
//! `rustc_graphviz` traits, specialized to attaching borrowck analysis
33
//! data to rendered labels.
44
55
use std::borrow::Cow;

compiler/rustc_parse/src/lexer/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl<'a> StringReader<'a> {
128128
}
129129

130130
/// Turns simple `rustc_lexer::TokenKind` enum into a rich
131-
/// `librustc_ast::TokenKind`. This turns strings into interned
131+
/// `rustc_ast::TokenKind`. This turns strings into interned
132132
/// symbols and runs additional validation.
133133
fn cook_lexer_token(&self, token: rustc_lexer::TokenKind, start: BytePos) -> Option<TokenKind> {
134134
Some(match token {

compiler/rustc_query_system/src/dep_graph/dep_node.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
//! could not be instantiated because the current compilation session
2727
//! contained no `DefId` for thing that had been removed.
2828
//!
29-
//! `DepNode` definition happens in `librustc_middle` with the `define_dep_nodes!()` macro.
29+
//! `DepNode` definition happens in `rustc_middle` with the `define_dep_nodes!()` macro.
3030
//! This macro defines the `DepKind` enum and a corresponding `DepConstructor` enum. The
3131
//! `DepConstructor` enum links a `DepKind` to the parameters that are needed at runtime in order
3232
//! to construct a valid `DepNode` fingerprint.

compiler/rustc_resolve/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//! Paths in macros, imports, expressions, types, patterns are resolved here.
77
//! Label and lifetime names are resolved here as well.
88
//!
9-
//! Type-relative name resolution (methods, fields, associated items) happens in `librustc_typeck`.
9+
//! Type-relative name resolution (methods, fields, associated items) happens in `rustc_typeck`.
1010
1111
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
1212
#![feature(box_patterns)]

compiler/rustc_target/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
`librustc_target` contains some very low-level details that are
1+
`rustc_target` contains some very low-level details that are
22
specific to different compilation targets and so forth.
33

44
For more information about how rustc works, see the [rustc dev guide].

compiler/rustc_target/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ pub mod spec;
2828

2929
/// Requirements for a `StableHashingContext` to be used in this crate.
3030
/// This is a hack to allow using the `HashStable_Generic` derive macro
31-
/// instead of implementing everything in librustc_middle.
31+
/// instead of implementing everything in `rustc_middle`.
3232
pub trait HashStableContext {}

compiler/rustc_trait_selection/src/traits/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! which makes a canonical query by replacing unbound inference
44
//! variables and regions, so that results can be reused more broadly.
55
//! The providers for the queries defined here can be found in
6-
//! `librustc_traits`.
6+
//! `rustc_traits`.
77
88
pub mod dropck_outlives;
99
pub mod evaluate_obligation;

library/core/src/iter/adapters/peekable.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ impl<I: Iterator> Peekable<I> {
233233
/// Basic usage:
234234
///
235235
/// ```
236-
/// #![feature(peekable_peek_mut)]
237236
/// let mut iter = [1, 2, 3].iter().peekable();
238237
///
239238
/// // Like with `peek()`, we can see into the future without advancing the iterator.
@@ -251,7 +250,7 @@ impl<I: Iterator> Peekable<I> {
251250
/// assert_eq!(iter.collect::<Vec<_>>(), vec![&5, &3]);
252251
/// ```
253252
#[inline]
254-
#[unstable(feature = "peekable_peek_mut", issue = "78302")]
253+
#[stable(feature = "peekable_peek_mut", since = "1.53.0")]
255254
pub fn peek_mut(&mut self) -> Option<&mut I::Item> {
256255
let iter = &mut self.iter;
257256
self.peeked.get_or_insert_with(|| iter.next()).as_mut()

library/core/src/iter/traits/iterator.rs

+34-12
Original file line numberDiff line numberDiff line change
@@ -937,20 +937,16 @@ pub trait Iterator {
937937
Enumerate::new(self)
938938
}
939939

940-
/// Creates an iterator which can use [`peek`] to look at the next element of
941-
/// the iterator without consuming it.
940+
/// Creates an iterator which can use the [`peek`] and [`peek_mut`] methods
941+
/// to look at the next element of the iterator without consuming it. See
942+
/// their documentation for more information.
942943
///
943-
/// Adds a [`peek`] method to an iterator. See its documentation for
944-
/// more information.
944+
/// Note that the underlying iterator is still advanced when [`peek`] or
945+
/// [`peek_mut`] are called for the first time: In order to retrieve the
946+
/// next element, [`next`] is called on the underlying iterator, hence any
947+
/// side effects (i.e. anything other than fetching the next value) of
948+
/// the [`next`] method will occur.
945949
///
946-
/// Note that the underlying iterator is still advanced when [`peek`] is
947-
/// called for the first time: In order to retrieve the next element,
948-
/// [`next`] is called on the underlying iterator, hence any side effects (i.e.
949-
/// anything other than fetching the next value) of the [`next`] method
950-
/// will occur.
951-
///
952-
/// [`peek`]: Peekable::peek
953-
/// [`next`]: Iterator::next
954950
///
955951
/// # Examples
956952
///
@@ -977,6 +973,32 @@ pub trait Iterator {
977973
/// assert_eq!(iter.peek(), None);
978974
/// assert_eq!(iter.next(), None);
979975
/// ```
976+
///
977+
/// Using [`peek_mut`] to mutate the next item without advancing the
978+
/// iterator:
979+
///
980+
/// ```
981+
/// let xs = [1, 2, 3];
982+
///
983+
/// let mut iter = xs.iter().peekable();
984+
///
985+
/// // `peek_mut()` lets us see into the future
986+
/// assert_eq!(iter.peek_mut(), Some(&mut &1));
987+
/// assert_eq!(iter.peek_mut(), Some(&mut &1));
988+
/// assert_eq!(iter.next(), Some(&1));
989+
///
990+
/// if let Some(mut p) = iter.peek_mut() {
991+
/// assert_eq!(*p, &2);
992+
/// // put a value into the iterator
993+
/// *p = &1000;
994+
/// }
995+
///
996+
/// // The value reappears as the iterator continues
997+
/// assert_eq!(iter.collect::<Vec<_>>(), vec![&1000, &3]);
998+
/// ```
999+
/// [`peek`]: Peekable::peek
1000+
/// [`peek_mut`]: Peekable::peek_mut
1001+
/// [`next`]: Iterator::next
9801002
#[inline]
9811003
#[stable(feature = "rust1", since = "1.0.0")]
9821004
fn peekable(self) -> Peekable<Self>

library/core/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,8 @@ pub mod primitive;
298298
unused_imports,
299299
unsafe_op_in_unsafe_fn
300300
)]
301-
#[allow(rustdoc::non_autolinks)]
301+
#[cfg_attr(bootstrap, allow(rustdoc::non_autolinks))]
302+
#[cfg_attr(not(bootstrap), allow(rustdoc::bare_urls))]
302303
// FIXME: This annotation should be moved into rust-lang/stdarch after clashing_extern_declarations is
303304
// merged. It currently cannot because bootstrap fails as the lint hasn't been defined yet.
304305
#[allow(clashing_extern_declarations)]

0 commit comments

Comments
 (0)