Skip to content

Commit 4489061

Browse files
authored
Merge pull request #6285 from ytmimi/subtree-push-nightly-2024-08-17
subtree-push nightly-2024-08-17
2 parents fbe0424 + d34fca4 commit 4489061

File tree

12 files changed

+45
-55
lines changed

12 files changed

+45
-55
lines changed

Diff for: rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2024-06-25"
2+
channel = "nightly-2024-08-17"
33
components = ["llvm-tools", "rustc-dev"]

Diff for: src/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ pub(crate) fn format_expr(
386386
))
387387
}
388388
}
389-
ast::ExprKind::Gen(capture_by, ref block, ref kind) => {
389+
ast::ExprKind::Gen(capture_by, ref block, ref kind, _) => {
390390
let mover = if matches!(capture_by, ast::CaptureBy::Value { .. }) {
391391
"move "
392392
} else {

Diff for: src/git-rustfmt/main.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// We need this feature as it changes `dylib` linking behavior and allows us to link to
2+
// `rustc_driver`.
3+
#![feature(rustc_private)]
4+
15
#[macro_use]
26
extern crate tracing;
37

Diff for: src/parse/macros/lazy_static.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,17 @@ pub(crate) fn parse_lazy_static(
3333
}
3434
while parser.token.kind != TokenKind::Eof {
3535
// Parse a `lazy_static!` item.
36+
// FIXME: These `eat_*` calls should be converted to `parse_or` to avoid
37+
// silently formatting malformed lazy-statics.
3638
let vis = parse_or!(parse_visibility, rustc_parse::parser::FollowedByType::No);
37-
parser.eat_keyword(kw::Static);
38-
parser.eat_keyword(kw::Ref);
39+
let _ = parser.eat_keyword(kw::Static);
40+
let _ = parser.eat_keyword(kw::Ref);
3941
let id = parse_or!(parse_ident);
40-
parser.eat(&TokenKind::Colon);
42+
let _ = parser.eat(&TokenKind::Colon);
4143
let ty = parse_or!(parse_ty);
42-
parser.eat(&TokenKind::Eq);
44+
let _ = parser.eat(&TokenKind::Eq);
4345
let expr = parse_or!(parse_expr);
44-
parser.eat(&TokenKind::Semi);
46+
let _ = parser.eat(&TokenKind::Semi);
4547
result.push((vis, id, ty, expr));
4648
}
4749

Diff for: src/parse/macros/mod.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@ pub(crate) struct ParsedMacroArgs {
8484
fn check_keyword<'a, 'b: 'a>(parser: &'a mut Parser<'b>) -> Option<MacroArg> {
8585
for &keyword in RUST_KW.iter() {
8686
if parser.token.is_keyword(keyword)
87-
&& parser.look_ahead(1, |t| {
88-
t.kind == TokenKind::Eof || t.kind == TokenKind::Comma
89-
})
87+
&& parser.look_ahead(1, |t| *t == TokenKind::Eof || *t == TokenKind::Comma)
9088
{
9189
parser.bump();
9290
return Some(MacroArg::Keyword(
@@ -131,7 +129,7 @@ pub(crate) fn parse_macro_args(
131129
Some(arg) => {
132130
args.push(arg);
133131
parser.bump();
134-
if parser.token.kind == TokenKind::Eof && args.len() == 2 {
132+
if parser.token == TokenKind::Eof && args.len() == 2 {
135133
vec_with_semi = true;
136134
break;
137135
}
@@ -150,7 +148,7 @@ pub(crate) fn parse_macro_args(
150148

151149
parser.bump();
152150

153-
if parser.token.kind == TokenKind::Eof {
151+
if parser.token == TokenKind::Eof {
154152
trailing_comma = true;
155153
break;
156154
}

Diff for: src/types.rs

+19-15
Original file line numberDiff line numberDiff line change
@@ -517,21 +517,25 @@ fn rewrite_generic_args(
517517
span: Span,
518518
) -> RewriteResult {
519519
match gen_args {
520-
ast::GenericArgs::AngleBracketed(ref data) if !data.args.is_empty() => {
521-
let args = data
522-
.args
523-
.iter()
524-
.map(|x| match x {
525-
ast::AngleBracketedArg::Arg(generic_arg) => {
526-
SegmentParam::from_generic_arg(generic_arg)
527-
}
528-
ast::AngleBracketedArg::Constraint(constraint) => {
529-
SegmentParam::Binding(constraint)
530-
}
531-
})
532-
.collect::<Vec<_>>();
520+
ast::GenericArgs::AngleBracketed(ref data) => {
521+
if data.args.is_empty() {
522+
Ok("".to_owned())
523+
} else {
524+
let args = data
525+
.args
526+
.iter()
527+
.map(|x| match x {
528+
ast::AngleBracketedArg::Arg(generic_arg) => {
529+
SegmentParam::from_generic_arg(generic_arg)
530+
}
531+
ast::AngleBracketedArg::Constraint(constraint) => {
532+
SegmentParam::Binding(constraint)
533+
}
534+
})
535+
.collect::<Vec<_>>();
533536

534-
overflow::rewrite_with_angle_brackets(context, "", args.iter(), shape, span)
537+
overflow::rewrite_with_angle_brackets(context, "", args.iter(), shape, span)
538+
}
535539
}
536540
ast::GenericArgs::Parenthesized(ref data) => format_function_type(
537541
data.inputs.iter().map(|x| &**x),
@@ -541,7 +545,7 @@ fn rewrite_generic_args(
541545
context,
542546
shape,
543547
),
544-
_ => Ok("".to_owned()),
548+
ast::GenericArgs::ParenthesizedElided(..) => Ok("(..)".to_owned()),
545549
}
546550
}
547551

Diff for: tests/source/cfg_if/detect/os/x86.rs

-9
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,6 @@ pub fn check_for(x: Feature) -> bool {
3434
fn detect_features() -> cache::Initializer {
3535
let mut value = cache::Initializer::default();
3636

37-
// If the x86 CPU does not support the CPUID instruction then it is too
38-
// old to support any of the currently-detectable features.
39-
if !has_cpuid() {
40-
return value;
41-
}
42-
43-
// Calling `__cpuid`/`__cpuid_count` from here on is safe because the CPU
44-
// has `cpuid` support.
45-
4637
// 0. EAX = 0: Basic Information:
4738
// - EAX returns the "Highest Function Parameter", that is, the maximum
4839
// leaf value for subsequent calls of `cpuinfo` in range [0,

Diff for: tests/source/type.rs

-2
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,6 @@ trait T: ~ const Super {}
146146

147147
const fn not_quite_const<S: ~ const T>() -> i32 { <S as T>::CONST }
148148

149-
struct S<T:~ const ? Sized>(std::marker::PhantomData<T>);
150-
151149
impl ~ const T {}
152150

153151
fn apit(_: impl ~ const T) {}

Diff for: tests/target/cfg_if/detect/os/x86.rs

-9
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,6 @@ pub fn check_for(x: Feature) -> bool {
3434
fn detect_features() -> cache::Initializer {
3535
let mut value = cache::Initializer::default();
3636

37-
// If the x86 CPU does not support the CPUID instruction then it is too
38-
// old to support any of the currently-detectable features.
39-
if !has_cpuid() {
40-
return value;
41-
}
42-
43-
// Calling `__cpuid`/`__cpuid_count` from here on is safe because the CPU
44-
// has `cpuid` support.
45-
4637
// 0. EAX = 0: Basic Information:
4738
// - EAX returns the "Highest Function Parameter", that is, the maximum
4839
// leaf value for subsequent calls of `cpuinfo` in range [0,

Diff for: tests/target/negative-bounds.rs

-6
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,3 @@ where
33
i32: !Copy,
44
{
55
}
6-
7-
fn maybe_const_negative()
8-
where
9-
i32: ~const !Copy,
10-
{
11-
}

Diff for: tests/target/return-type-notation.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
fn rtn()
2+
where
3+
T: Trait<method(..): Send + 'static>,
4+
T::method(..): Send + 'static,
5+
{
6+
}
7+
8+
fn test() {
9+
let x: T::method(..);
10+
}

Diff for: tests/target/type.rs

-2
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@ const fn not_quite_const<S: ~const T>() -> i32 {
153153
<S as T>::CONST
154154
}
155155

156-
struct S<T: ~const ?Sized>(std::marker::PhantomData<T>);
157-
158156
impl ~const T {}
159157

160158
fn apit(_: impl ~const T) {}

0 commit comments

Comments
 (0)