Skip to content

subtree-push nightly-2025-04-02 #6531

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 38 commits into from
Apr 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
840eb96
rustfmt: drop nightly-gating of the `--style-edition` flag registration
jieyouxu Jan 7, 2025
06ff325
Rename PatKind::Lit to Expr
oli-obk Jan 7, 2025
ad8b776
Only treat plain literal patterns as short
oli-obk Jan 8, 2025
31a9a27
Only treat plain literal patterns as short
oli-obk Jan 8, 2025
0c91d0c
Rollup merge of #135251 - oli-obk:push-lmpyvvyrtplk, r=ytmimi
matthiaskrgr Jan 16, 2025
f19e826
Refactor FnKind variant to hold &Fn
celinval Jan 28, 2025
7de0ca8
Disable overflow_delimited_expr in edition 2024
compiler-errors Jan 30, 2025
5e05493
Slightly simplify DiagCtxt::make_silent
bjorn3 Feb 2, 2025
0eadd99
Use fallback fluent bundle from inner emitter in SilentEmitter
bjorn3 Feb 2, 2025
58ba360
tree-wide: parallel: Fully removed all `Lrc`, replaced with `Arc`
safinaskar Feb 3, 2025
35f9799
Add a TyPat in the AST to reuse the generic arg lowering logic
oli-obk Feb 6, 2025
6dcc68f
Do not yeet unsafe<> from type
compiler-errors Feb 28, 2025
326e321
Implment `#[cfg]` and `#[cfg_attr]` in `where` clauses
frank-king Feb 5, 2025
7be7efa
Replace `ast::TokenKind::BinOp{,Eq}` and remove `BinOpToken`.
nnethercote Dec 19, 2024
88e23c9
Rename `ast::TokenKind::Not` as `ast::TokenKind::Bang`.
nnethercote Dec 20, 2024
71310c1
Rollup merge of #132388 - frank-king:feature/where-cfg, r=petrochenkov
matthiaskrgr Mar 3, 2025
a28a422
Auto merge of #137959 - matthiaskrgr:rollup-62vjvwr, r=matthiaskrgr
bors Mar 4, 2025
0ae8340
Implement `&pin const self` and `&pin mut self` sugars
frank-king Jan 19, 2025
facc42a
Simplify `rewrite_explicit_self`
frank-king Mar 5, 2025
ebd6372
Fix rustfmt
spastorino Dec 27, 2024
f9f0ac2
Rollup merge of #134797 - spastorino:ergonomic-ref-counting-1, r=niko…
matthiaskrgr Mar 7, 2025
d038fb8
Preserve yield position during pretty printing
eholk Mar 12, 2025
e377632
Teach rustfmt to handle postfix yield
eholk Mar 13, 2025
96f68d1
Teach rustfmt to handle postfix yield
eholk Mar 18, 2025
ad0b41c
Refactor YieldKind so postfix yield must have an expression
eholk Mar 18, 2025
c4eaced
update rustfmt test
lcnr Mar 21, 2025
b661e49
Remove `is_any_keyword` methods.
nnethercote Mar 12, 2025
de6e2d7
Remove fields that are dead since the removal of type ascription syntax
fmease Mar 23, 2025
b3b26f4
Track whether an assoc item is in a trait impl or an inherent impl
oli-obk Mar 25, 2025
7590f5c
Rollup merge of #138929 - oli-obk:assoc-ctxt-of-trait, r=compiler-errors
matthiaskrgr Mar 25, 2025
c8609d9
Rollup merge of #138898 - fmease:decrustify-parser-post-ty-ascr, r=co…
Zalathar Mar 26, 2025
fd7b9a4
Simplify `ItemVisitorKind`.
nnethercote Mar 20, 2025
6bcd711
Remove useless `Option<Ident>` arg.
nnethercote Mar 20, 2025
a535a31
Move `ast::Item::ident` into `ast::ItemKind`.
nnethercote Mar 20, 2025
ec55da1
Address review comments.
nnethercote Apr 1, 2025
1963641
Auto merge of #138492 - lcnr:rm-inline_const_pat, r=oli-obk
bors Apr 1, 2025
3955c2e
Merge remote-tracking branch 'upstream/master' into subtree-push-nigh…
ytmimi Apr 2, 2025
ab78ef6
chore: bump rustfmt toolchain to nightly-2025-04-02
ytmimi Apr 2, 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
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2025-01-02"
channel = "nightly-2025-04-02"
components = ["llvm-tools", "rustc-dev"]
12 changes: 11 additions & 1 deletion src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ fn make_opts() -> Options {
"Set options from command line. These settings take priority over .rustfmt.toml",
"[key1=val1,key2=val2...]",
);
opts.optopt(
"",
"style-edition",
"The edition of the Style Guide.",
"[2015|2018|2021|2024]",
);

if is_nightly {
opts.optflag(
Expand Down Expand Up @@ -945,6 +951,9 @@ mod test {
let config_file = Some(Path::new("tests/config/style-edition/overrides"));
let config = get_config(config_file, Some(options));
assert_eq!(config.style_edition(), StyleEdition::Edition2024);
// FIXME: this test doesn't really exercise anything, since
// `overflow_delimited_expr` is disabled by default in edition 2024.
assert_eq!(config.overflow_delimited_expr(), false);
}

#[nightly_only_test]
Expand All @@ -955,7 +964,8 @@ mod test {
options.inline_config =
HashMap::from([("overflow_delimited_expr".to_owned(), "true".to_owned())]);
let config = get_config(config_file, Some(options));
assert_eq!(config.style_edition(), StyleEdition::Edition2024);
// FIXME: this test doesn't really exercise anything, since
// `overflow_delimited_expr` is disabled by default in edition 2024.
assert_eq!(config.overflow_delimited_expr(), true);
}
}
10 changes: 9 additions & 1 deletion src/chains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ enum ChainItemKind {
StructField(symbol::Ident),
TupleField(symbol::Ident, bool),
Await,
Yield,
Comment(String, CommentPosition),
}

Expand All @@ -206,6 +207,7 @@ impl ChainItemKind {
| ChainItemKind::StructField(..)
| ChainItemKind::TupleField(..)
| ChainItemKind::Await
| ChainItemKind::Yield
| ChainItemKind::Comment(..) => false,
}
}
Expand Down Expand Up @@ -260,6 +262,10 @@ impl ChainItemKind {
let span = mk_sp(nested.span.hi(), expr.span.hi());
(ChainItemKind::Await, span)
}
ast::ExprKind::Yield(ast::YieldKind::Postfix(ref nested)) => {
let span = mk_sp(nested.span.hi(), expr.span.hi());
(ChainItemKind::Yield, span)
}
_ => {
return (
ChainItemKind::Parent {
Expand Down Expand Up @@ -307,6 +313,7 @@ impl Rewrite for ChainItem {
rewrite_ident(context, ident)
),
ChainItemKind::Await => ".await".to_owned(),
ChainItemKind::Yield => ".yield".to_owned(),
ChainItemKind::Comment(ref comment, _) => {
rewrite_comment(comment, false, shape, context.config)?
}
Expand Down Expand Up @@ -509,7 +516,8 @@ impl Chain {
}),
ast::ExprKind::Field(ref subexpr, _)
| ast::ExprKind::Try(ref subexpr)
| ast::ExprKind::Await(ref subexpr, _) => Some(SubExpr {
| ast::ExprKind::Await(ref subexpr, _)
| ast::ExprKind::Yield(ast::YieldKind::Postfix(ref subexpr)) => Some(SubExpr {
expr: Self::convert_try(subexpr, context),
is_method_call_receiver: false,
}),
Expand Down
1 change: 0 additions & 1 deletion src/closures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ fn rewrite_closure_with_block(
.first()
.map(|attr| attr.span.to(body.span))
.unwrap_or(body.span),
could_be_bare_literal: false,
};
let block = crate::expr::rewrite_block_with_visitor(
context,
Expand Down
4 changes: 2 additions & 2 deletions src/config/file_lines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
use itertools::Itertools;
use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Arc;
use std::{cmp, fmt, iter, str};

use rustc_data_structures::sync::Lrc;
use rustc_span::SourceFile;
use serde::{Deserialize, Deserializer, Serialize, Serializer, ser};
use serde_json as json;
use thiserror::Error;

/// A range of lines in a file, inclusive of both ends.
pub struct LineRange {
pub(crate) file: Lrc<SourceFile>,
pub(crate) file: Arc<SourceFile>,
pub(crate) lo: usize,
pub(crate) hi: usize,
}
Expand Down
2 changes: 1 addition & 1 deletion src/config/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ config_option_with_style_edition_default!(
BlankLinesLowerBound, usize, _ => 0;
EditionConfig, Edition, _ => Edition::Edition2015;
StyleEditionConfig, StyleEdition,
Edition2024 => StyleEdition::Edition2024, _ => StyleEdition::Edition2015;
Edition2024 => StyleEdition::Edition2024, _ => StyleEdition::Edition2015;
VersionConfig, Version, Edition2024 => Version::Two, _ => Version::One;
InlineAttributeWidth, usize, _ => 0;
FormatGeneratedFiles, bool, _ => true;
Expand Down
11 changes: 8 additions & 3 deletions src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ pub(crate) fn format_expr(
ast::ExprKind::Tup(ref items) => {
rewrite_tuple(context, items.iter(), expr.span, shape, items.len() == 1)
}
ast::ExprKind::Use(_, _) => {
// FIXME: properly implement this
Ok(context.snippet(expr.span()).to_owned())
}
ast::ExprKind::Let(ref pat, ref expr, _span, _) => rewrite_let(context, shape, pat, expr),
ast::ExprKind::If(..)
| ast::ExprKind::ForLoop { .. }
Expand Down Expand Up @@ -249,7 +253,7 @@ pub(crate) fn format_expr(
Ok(format!("break{id_str}"))
}
}
ast::ExprKind::Yield(ref opt_expr) => {
ast::ExprKind::Yield(ast::YieldKind::Prefix(ref opt_expr)) => {
if let Some(ref expr) = *opt_expr {
rewrite_unary_prefix(context, "yield ", &**expr, shape)
} else {
Expand All @@ -271,9 +275,10 @@ pub(crate) fn format_expr(
ast::ExprKind::Try(..)
| ast::ExprKind::Field(..)
| ast::ExprKind::MethodCall(..)
| ast::ExprKind::Await(_, _) => rewrite_chain(expr, context, shape),
| ast::ExprKind::Await(_, _)
| ast::ExprKind::Yield(ast::YieldKind::Postfix(_)) => rewrite_chain(expr, context, shape),
ast::ExprKind::MacCall(ref mac) => {
rewrite_macro(mac, None, context, shape, MacroPosition::Expression).or_else(|_| {
rewrite_macro(mac, context, shape, MacroPosition::Expression).or_else(|_| {
wrap_str(
context.snippet(expr.span).to_owned(),
context.config.max_width(),
Expand Down
Loading
Loading