Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
0dc233f
point to Compiler team docs on Forge
tshepang Sep 6, 2025
1806a82
remove confusing parts of sentence
tshepang Sep 8, 2025
755db7f
sembr
tshepang Sep 8, 2025
cb0e26f
fix markup
tshepang Sep 8, 2025
94da520
readability
tshepang Sep 8, 2025
8c324de
Merge pull request #2585 from rust-lang/tshepang/sembr
tshepang Sep 8, 2025
a5575f8
Fix broken Microsoft URL missing slash
ali90h Sep 8, 2025
808595e
Merge pull request #2586 from ali90h/fix-microsoft-link-broken-url
Noratrieb Sep 8, 2025
096ae06
glossary: add entry for rustbuild
lolbinarycat Jul 22, 2025
196b49a
glossary(rustbuild): reword according to code review
lolbinarycat Sep 10, 2025
82ff002
Add missing documentation for running tests with GCC backend
GuillaumeGomez Sep 10, 2025
76c4d68
Merge pull request #2516 from lolbinarycat/patch-4
tshepang Sep 10, 2025
d8f0842
docs: typetree in autodiff
KMJ-007 May 13, 2025
ff59107
Merge pull request #2385 from KMJ-007/master
ZuseZ4 Sep 11, 2025
d588c11
Restructure the docs
Kobzol Sep 11, 2025
7a4b728
Rename "crashes tests" to "crash tests"
fmease Sep 12, 2025
ddfd47a
Merge pull request #2588 from fmease/to-crash-tests
fmease Sep 12, 2025
ee63b07
Merge pull request #2584 from rust-lang/tshepang-patch-5
Noratrieb Sep 12, 2025
7b0b0bb
Clarify that backtick escaping doesn't work for `@bors try jobs`
Kobzol Sep 15, 2025
001f8e3
Update src/tests/ci.md
Kobzol Sep 15, 2025
3a14fb7
Merge pull request #2589 from Kobzol/ci-bors-backticks
Kobzol Sep 15, 2025
1ae720a
Fix spelling of "adaptor"
ctz Sep 16, 2025
325ceef
Fix other uses of "adaptor"
ctz Sep 16, 2025
ee496f2
a valid state is achieved by passing the test suite
tshepang Sep 17, 2025
cea82e3
Merge pull request #2591 from rust-lang/tshepang-patch-5
Noratrieb Sep 17, 2025
b17213a
about-this-guide.md: improve a bit
tshepang Sep 17, 2025
66a84ef
Merge pull request #2592 from rust-lang/tshepang-patch-5
tshepang Sep 17, 2025
9819cea
Merge pull request #2587 from GuillaumeGomez/gcc-backend-missing-docs
GuillaumeGomez Sep 18, 2025
72b0291
Merge pull request #2580 from rust-lang/tshepang-patch-2
jieyouxu Sep 19, 2025
4320de6
fixes for numerous clippy warnings
hkBst Sep 19, 2025
82eed00
chore(compiletest): Use newest anstyle-svg version
Muscraft Sep 16, 2025
4f02ec2
test: Use SVG for terminal url test
Muscraft Sep 16, 2025
bb430f8
mbe: Simplify match in `transcribe_metavar`
joshtriplett Sep 19, 2025
fc41c38
mbe: Factor out a function to transcribe a `ParseNtResult`
joshtriplett Sep 19, 2025
a54111a
mbe: metavar expressions: Use symbols rather than `ident.as_str()`
joshtriplett Sep 20, 2025
d887c57
Correct a misspelling of RUSTC_LOG
cammeresi Sep 21, 2025
a11333a
Merge pull request #2594 from cammeresi/spelling-20250921
tshepang Sep 21, 2025
5658b39
Prepare for merging from rust-lang/rust
invalid-email-address Sep 22, 2025
c3d3074
Merge ref '9f32ccf35fb8' from rust-lang/rust
invalid-email-address Sep 22, 2025
391a2ea
Merge pull request #2595 from rust-lang/rustc-pull
tshepang Sep 22, 2025
62b2bd5
reduce overlong lines
tshepang Sep 22, 2025
45f891d
Merge pull request #2596 from rust-lang/tshepang/sembr
tshepang Sep 22, 2025
1e2594f
various improvements resulting from reading Testing with CI
tshepang Sep 22, 2025
70f3768
Merge pull request #2593 from rust-lang/tshepang/testing-with-ci
tshepang Sep 22, 2025
2dc1354
tests/run-make/crate-loading: Rename source files for clarity
Enselic Sep 5, 2025
5e7d346
Update books
rustbot Sep 22, 2025
2d18c88
Fix a crash/mislex when more than one frontmatter closing possibility…
Teapot4195 Sep 22, 2025
a8f8e4a
Rollup merge of #146632 - ctz:jbp-adaptor-spelling, r=petrochenkov
Kobzol Sep 23, 2025
b3ceb78
Rollup merge of #146731 - Muscraft:svg-test-terminal-url, r=jdonszelmann
Kobzol Sep 23, 2025
e7c4395
Rollup merge of #146775 - hkBst:clippy-fix-11, r=petrochenkov
Kobzol Sep 23, 2025
0e518eb
Rollup merge of #146802 - joshtriplett:mbe-simplifications, r=petroch…
Kobzol Sep 23, 2025
346a295
Rollup merge of #146875 - Enselic:better-file-names, r=jieyouxu
Kobzol Sep 23, 2025
b0c1770
Rollup merge of #146896 - tshepang:rdg-sync, r=tshepang
Kobzol Sep 23, 2025
486540e
Rollup merge of #146898 - rustbot:docs-update, r=ehuss
Kobzol Sep 23, 2025
7b943a9
Rollup merge of #146899 - Teapot4195:issue-146847-fix, r=nnethercote
Kobzol Sep 23, 2025
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
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ dependencies = [

[[package]]
name = "anstyle-svg"
version = "0.1.10"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc03a770ef506fe1396c0e476120ac0e6523cf14b74218dd5f18cd6833326fa9"
checksum = "26b9ec8c976eada1b0f9747a3d7cc4eae3bef10613e443746e7487f26c872fde"
dependencies = [
"anstyle",
"anstyle-lossy",
Expand Down
25 changes: 12 additions & 13 deletions compiler/rustc_expand/src/mbe/metavar_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use rustc_ast_pretty::pprust;
use rustc_errors::{Applicability, PResult};
use rustc_macros::{Decodable, Encodable};
use rustc_session::parse::ParseSess;
use rustc_span::{Ident, Span, Symbol};
use rustc_span::{Ident, Span, Symbol, sym};

use crate::errors;

Expand Down Expand Up @@ -69,15 +69,15 @@ impl MetaVarExpr {
}

let mut iter = args.iter();
let rslt = match ident.as_str() {
"concat" => parse_concat(&mut iter, psess, outer_span, ident.span)?,
"count" => parse_count(&mut iter, psess, ident.span)?,
"ignore" => {
let rslt = match ident.name {
sym::concat => parse_concat(&mut iter, psess, outer_span, ident.span)?,
sym::count => parse_count(&mut iter, psess, ident.span)?,
sym::ignore => {
eat_dollar(&mut iter, psess, ident.span)?;
MetaVarExpr::Ignore(parse_ident(&mut iter, psess, ident.span)?)
}
"index" => MetaVarExpr::Index(parse_depth(&mut iter, psess, ident.span)?),
"len" => MetaVarExpr::Len(parse_depth(&mut iter, psess, ident.span)?),
sym::index => MetaVarExpr::Index(parse_depth(&mut iter, psess, ident.span)?),
sym::len => MetaVarExpr::Len(parse_depth(&mut iter, psess, ident.span)?),
_ => {
let err = errors::MveUnrecognizedExpr {
span: ident.span,
Expand Down Expand Up @@ -119,14 +119,13 @@ fn check_trailing_tokens<'psess>(
}

// `None` for max indicates the arg count must be exact, `Some` indicates a range is accepted.
let (min_or_exact_args, max_args) = match ident.as_str() {
"concat" => panic!("concat takes unlimited tokens but didn't eat them all"),
"ignore" => (1, None),
let (min_or_exact_args, max_args) = match ident.name {
sym::concat => panic!("concat takes unlimited tokens but didn't eat them all"),
sym::ignore => (1, None),
// 1 or 2 args
"count" => (1, Some(2)),
sym::count => (1, Some(2)),
// 0 or 1 arg
"index" => (0, Some(1)),
"len" => (0, Some(1)),
sym::index | sym::len => (0, Some(1)),
other => unreachable!("unknown MVEs should be rejected earlier (got `{other}`)"),
};

Expand Down
45 changes: 27 additions & 18 deletions compiler/rustc_expand/src/mbe/transcribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,19 @@ fn transcribe_metavar<'tx>(
return Ok(());
};

let MatchedSingle(pnr) = cur_matched else {
// We were unable to descend far enough. This is an error.
return Err(dcx.create_err(MacroVarStillRepeating { span: sp, ident }));
};

transcribe_pnr(tscx, sp, pnr)
}

fn transcribe_pnr<'tx>(
tscx: &mut TranscrCtx<'tx, '_>,
mut sp: Span,
pnr: &ParseNtResult,
) -> PResult<'tx, ()> {
// We wrap the tokens in invisible delimiters, unless they are already wrapped
// in invisible delimiters with the same `MetaVarKind`. Because some proc
// macros can't handle multiple layers of invisible delimiters of the same
Expand Down Expand Up @@ -404,33 +417,33 @@ fn transcribe_metavar<'tx>(
)
};

let tt = match cur_matched {
MatchedSingle(ParseNtResult::Tt(tt)) => {
let tt = match pnr {
ParseNtResult::Tt(tt) => {
// `tt`s are emitted into the output stream directly as "raw tokens",
// without wrapping them into groups. Other variables are emitted into
// the output stream as groups with `Delimiter::Invisible` to maintain
// parsing priorities.
maybe_use_metavar_location(tscx.psess, &tscx.stack, sp, tt, &mut tscx.marker)
}
MatchedSingle(ParseNtResult::Ident(ident, is_raw)) => {
ParseNtResult::Ident(ident, is_raw) => {
tscx.marker.mark_span(&mut sp);
with_metavar_spans(|mspans| mspans.insert(ident.span, sp));
let kind = token::NtIdent(*ident, *is_raw);
TokenTree::token_alone(kind, sp)
}
MatchedSingle(ParseNtResult::Lifetime(ident, is_raw)) => {
ParseNtResult::Lifetime(ident, is_raw) => {
tscx.marker.mark_span(&mut sp);
with_metavar_spans(|mspans| mspans.insert(ident.span, sp));
let kind = token::NtLifetime(*ident, *is_raw);
TokenTree::token_alone(kind, sp)
}
MatchedSingle(ParseNtResult::Item(item)) => {
ParseNtResult::Item(item) => {
mk_delimited(item.span, MetaVarKind::Item, TokenStream::from_ast(item))
}
MatchedSingle(ParseNtResult::Block(block)) => {
ParseNtResult::Block(block) => {
mk_delimited(block.span, MetaVarKind::Block, TokenStream::from_ast(block))
}
MatchedSingle(ParseNtResult::Stmt(stmt)) => {
ParseNtResult::Stmt(stmt) => {
let stream = if let StmtKind::Empty = stmt.kind {
// FIXME: Properly collect tokens for empty statements.
TokenStream::token_alone(token::Semi, stmt.span)
Expand All @@ -439,10 +452,10 @@ fn transcribe_metavar<'tx>(
};
mk_delimited(stmt.span, MetaVarKind::Stmt, stream)
}
MatchedSingle(ParseNtResult::Pat(pat, pat_kind)) => {
ParseNtResult::Pat(pat, pat_kind) => {
mk_delimited(pat.span, MetaVarKind::Pat(*pat_kind), TokenStream::from_ast(pat))
}
MatchedSingle(ParseNtResult::Expr(expr, kind)) => {
ParseNtResult::Expr(expr, kind) => {
let (can_begin_literal_maybe_minus, can_begin_string_literal) = match &expr.kind {
ExprKind::Lit(_) => (true, true),
ExprKind::Unary(UnOp::Neg, e) if matches!(&e.kind, ExprKind::Lit(_)) => {
Expand All @@ -460,31 +473,27 @@ fn transcribe_metavar<'tx>(
TokenStream::from_ast(expr),
)
}
MatchedSingle(ParseNtResult::Literal(lit)) => {
ParseNtResult::Literal(lit) => {
mk_delimited(lit.span, MetaVarKind::Literal, TokenStream::from_ast(lit))
}
MatchedSingle(ParseNtResult::Ty(ty)) => {
ParseNtResult::Ty(ty) => {
let is_path = matches!(&ty.kind, TyKind::Path(None, _path));
mk_delimited(ty.span, MetaVarKind::Ty { is_path }, TokenStream::from_ast(ty))
}
MatchedSingle(ParseNtResult::Meta(attr_item)) => {
ParseNtResult::Meta(attr_item) => {
let has_meta_form = attr_item.meta_kind().is_some();
mk_delimited(
attr_item.span(),
MetaVarKind::Meta { has_meta_form },
TokenStream::from_ast(attr_item),
)
}
MatchedSingle(ParseNtResult::Path(path)) => {
ParseNtResult::Path(path) => {
mk_delimited(path.span, MetaVarKind::Path, TokenStream::from_ast(path))
}
MatchedSingle(ParseNtResult::Vis(vis)) => {
ParseNtResult::Vis(vis) => {
mk_delimited(vis.span, MetaVarKind::Vis, TokenStream::from_ast(vis))
}
MatchedSeq(..) => {
// We were unable to descend far enough. This is an error.
return Err(dcx.create_err(MacroVarStillRepeating { span: sp, ident }));
}
};

tscx.result.push(tt);
Expand Down
72 changes: 33 additions & 39 deletions compiler/rustc_hir_typeck/src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ You can read more about trait objects in the Trait Objects section of the Refere
https://doc.rust-lang.org/reference/types.html#trait-objects";

fn is_number(text: &str) -> bool {
text.chars().all(|c: char| c.is_digit(10))
text.chars().all(|c: char| c.is_ascii_digit())
}

/// Information about the expected type at the top level of type checking a pattern.
Expand Down Expand Up @@ -262,8 +262,9 @@ enum InheritedRefMatchRule {
/// pattern matches a given type:
/// - If the underlying type is not a reference, a reference pattern may eat the inherited reference;
/// - If the underlying type is a reference, a reference pattern matches if it can eat either one
/// of the underlying and inherited references. E.g. a `&mut` pattern is allowed if either the
/// underlying type is `&mut` or the inherited reference is `&mut`.
/// of the underlying and inherited references. E.g. a `&mut` pattern is allowed if either the
/// underlying type is `&mut` or the inherited reference is `&mut`.
///
/// If `false`, a reference pattern is only matched against the underlying type.
/// This is `false` for stable Rust and `true` for both the `ref_pat_eat_one_layer_2024` and
/// `ref_pat_eat_one_layer_2024_structural` feature gates.
Expand Down Expand Up @@ -1069,7 +1070,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
{
if !self.tcx.features().mut_ref() {
feature_err(
&self.tcx.sess,
self.tcx.sess,
sym::mut_ref,
pat.span.until(ident.span),
"binding cannot be both mutable and by-reference",
Expand Down Expand Up @@ -1487,31 +1488,24 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
opt_def_id: Option<hir::def_id::DefId>,
ident: Ident,
) -> bool {
match opt_def_id {
Some(def_id) => match self.tcx.hir_get_if_local(def_id) {
Some(hir::Node::Item(hir::Item {
kind: hir::ItemKind::Const(_, _, _, body_id),
..
})) => match self.tcx.hir_node(body_id.hir_id) {
hir::Node::Expr(expr) => {
if hir::is_range_literal(expr) {
let span = self.tcx.hir_span(body_id.hir_id);
if let Ok(snip) = self.tcx.sess.source_map().span_to_snippet(span) {
e.span_suggestion_verbose(
ident.span,
"you may want to move the range into the match block",
snip,
Applicability::MachineApplicable,
);
return true;
}
}
}
_ => (),
},
_ => (),
},
_ => (),
if let Some(def_id) = opt_def_id
&& let Some(hir::Node::Item(hir::Item {
kind: hir::ItemKind::Const(_, _, _, body_id),
..
})) = self.tcx.hir_get_if_local(def_id)
&& let hir::Node::Expr(expr) = self.tcx.hir_node(body_id.hir_id)
&& hir::is_range_literal(expr)
{
let span = self.tcx.hir_span(body_id.hir_id);
if let Ok(snip) = self.tcx.sess.source_map().span_to_snippet(span) {
e.span_suggestion_verbose(
ident.span,
"you may want to move the range into the match block",
snip,
Applicability::MachineApplicable,
);
return true;
}
}
false
}
Expand All @@ -1529,7 +1523,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

if let Some(span) = self.tcx.hir_res_span(pat_res) {
e.span_label(span, format!("{} defined here", res.descr()));
if let [hir::PathSegment { ident, .. }] = &*segments {
if let [hir::PathSegment { ident, .. }] = segments {
e.span_label(
pat_span,
format!(
Expand Down Expand Up @@ -1557,17 +1551,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
_ => (None, None),
};

let is_range = match type_def_id.and_then(|id| self.tcx.as_lang_item(id)) {
let is_range = matches!(
type_def_id.and_then(|id| self.tcx.as_lang_item(id)),
Some(
LangItem::Range
| LangItem::RangeFrom
| LangItem::RangeTo
| LangItem::RangeFull
| LangItem::RangeInclusiveStruct
| LangItem::RangeToInclusive,
) => true,
_ => false,
};
| LangItem::RangeFrom
| LangItem::RangeTo
| LangItem::RangeFull
| LangItem::RangeInclusiveStruct
| LangItem::RangeToInclusive,
)
);
if is_range {
if !self.maybe_suggest_range_literal(&mut e, item_def_id, *ident) {
let msg = "constants only support matching by type, \
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_lexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,14 +599,16 @@ impl Cursor<'_> {
if potential_closing.is_none() {
// a less fortunate recovery if all else fails which finds any dashes preceded by whitespace
// on a standalone line. Might be wrong.
let mut base_index = 0;
while let Some(closing) = rest.find("---") {
let preceding_chars_start = rest[..closing].rfind("\n").map_or(0, |i| i + 1);
if rest[preceding_chars_start..closing].chars().all(is_horizontal_whitespace) {
// candidate found
potential_closing = Some(closing);
potential_closing = Some(closing + base_index);
break;
} else {
rest = &rest[closing + 3..];
base_index += closing + 3;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/iter/adapters/flatten.rs
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ impl<T> OneShot for result::IterMut<'_, T> {}
impl<T> OneShot for Empty<T> {}
impl<T> OneShot for array::IntoIter<T, 0> {}

// These adaptors never increase the number of items.
// These adapters never increase the number of items.
// (There are more possible, but for now this matches BoundedSize above.)
impl<I: OneShot> OneShot for Cloned<I> {}
impl<I: OneShot> OneShot for Copied<I> {}
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ pub trait Read {
default_read_buf_exact(self, cursor)
}

/// Creates a "by reference" adaptor for this instance of `Read`.
/// Creates a "by reference" adapter for this instance of `Read`.
///
/// The returned adapter also implements `Read` and will simply borrow this
/// current reader.
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book
2 changes: 1 addition & 1 deletion src/doc/rust-by-example
2 changes: 1 addition & 1 deletion src/doc/rustc-dev-guide/rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2f3f27bf79ec147fec9d2e7980605307a74067f4
9f32ccf35fb877270bc44a86a126440f04d676d0
1 change: 1 addition & 0 deletions src/doc/rustc-dev-guide/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
- [Installation](./autodiff/installation.md)
- [How to debug](./autodiff/debugging.md)
- [Autodiff flags](./autodiff/flags.md)
- [Type Trees](./autodiff/type-trees.md)

# Source Code Representation

Expand Down
8 changes: 4 additions & 4 deletions src/doc/rustc-dev-guide/src/about-this-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ In addition, many of the ideas discussed throughout this guide are idealized des
that are not fully realized yet.
All this makes keeping this guide completely up to date on everything very hard!

The Guide itself is of course open-source as well,
and the sources can be found at the [GitHub repository].
If you find any mistakes in the guide, please file an issue about it.
The guide itself is of course open source as well,
and the sources are hosted on [a GitHub repository].
If you find any mistakes in the guide, please file an issue.
Even better, open a PR with a correction!

If you do contribute to the guide,
Expand Down Expand Up @@ -105,7 +105,7 @@ You might also find the following sites useful:
[cheatsheet]: https://bors.rust-lang.org/
[Miri]: https://github.com/rust-lang/miri
[@bors]: https://github.com/bors
[GitHub repository]: https://github.com/rust-lang/rustc-dev-guide/
[a GitHub repository]: https://github.com/rust-lang/rustc-dev-guide/
[rustc API docs]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle
[Forge]: https://forge.rust-lang.org/
[compiler-team]: https://github.com/rust-lang/compiler-team/
Expand Down
1 change: 1 addition & 0 deletions src/doc/rustc-dev-guide/src/appendix/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Term | Meaning
<span id="rib">rib</span> | A data structure in the name resolver that keeps track of a single scope for names. ([see more](../name-resolution.md))
<span id="rpit">RPIT</span> | A return-position `impl Trait`. ([see the reference](https://doc.rust-lang.org/reference/types/impl-trait.html#abstract-return-types)).
<span id="rpitit">RPITIT</span> | A return-position `impl Trait` in trait. Unlike RPIT, this is desugared to a generic associated type (GAT). Introduced in [RFC 3425](https://rust-lang.github.io/rfcs/3425-return-position-impl-trait-in-traits.html). ([see more](../return-position-impl-trait-in-trait.md))
<span id="rustbuild">rustbuild</span> | A deprecated term for the part of bootstrap that is written in Rust
<span id="scrutinee">scrutinee</span> | A scrutinee is the expression that is matched on in `match` expressions and similar pattern matching constructs. For example, in `match x { A => 1, B => 2 }`, the expression `x` is the scrutinee.
<span id="sess">`sess`</span> | The compiler _session_, which stores global data used throughout compilation
<span id="side-tables">side tables</span> | Because the [AST](#ast) and HIR are immutable once created, we often carry extra information about them in the form of hashtables, indexed by the id of a particular node.
Expand Down
Loading
Loading