Skip to content

subtree-push nightly-2024-08-17 #6285

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 9 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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-2024-06-25"
channel = "nightly-2024-08-17"
components = ["llvm-tools", "rustc-dev"]
2 changes: 1 addition & 1 deletion src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ pub(crate) fn format_expr(
))
}
}
ast::ExprKind::Gen(capture_by, ref block, ref kind) => {
ast::ExprKind::Gen(capture_by, ref block, ref kind, _) => {
let mover = if matches!(capture_by, ast::CaptureBy::Value { .. }) {
"move "
} else {
Expand Down
4 changes: 4 additions & 0 deletions src/git-rustfmt/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// We need this feature as it changes `dylib` linking behavior and allows us to link to
// `rustc_driver`.
#![feature(rustc_private)]

#[macro_use]
extern crate tracing;

Expand Down
12 changes: 7 additions & 5 deletions src/parse/macros/lazy_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@ pub(crate) fn parse_lazy_static(
}
while parser.token.kind != TokenKind::Eof {
// Parse a `lazy_static!` item.
// FIXME: These `eat_*` calls should be converted to `parse_or` to avoid
// silently formatting malformed lazy-statics.
let vis = parse_or!(parse_visibility, rustc_parse::parser::FollowedByType::No);
parser.eat_keyword(kw::Static);
parser.eat_keyword(kw::Ref);
let _ = parser.eat_keyword(kw::Static);
let _ = parser.eat_keyword(kw::Ref);
let id = parse_or!(parse_ident);
parser.eat(&TokenKind::Colon);
let _ = parser.eat(&TokenKind::Colon);
let ty = parse_or!(parse_ty);
parser.eat(&TokenKind::Eq);
let _ = parser.eat(&TokenKind::Eq);
let expr = parse_or!(parse_expr);
parser.eat(&TokenKind::Semi);
let _ = parser.eat(&TokenKind::Semi);
result.push((vis, id, ty, expr));
}

Expand Down
8 changes: 3 additions & 5 deletions src/parse/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ pub(crate) struct ParsedMacroArgs {
fn check_keyword<'a, 'b: 'a>(parser: &'a mut Parser<'b>) -> Option<MacroArg> {
for &keyword in RUST_KW.iter() {
if parser.token.is_keyword(keyword)
&& parser.look_ahead(1, |t| {
t.kind == TokenKind::Eof || t.kind == TokenKind::Comma
})
&& parser.look_ahead(1, |t| *t == TokenKind::Eof || *t == TokenKind::Comma)
{
parser.bump();
return Some(MacroArg::Keyword(
Expand Down Expand Up @@ -131,7 +129,7 @@ pub(crate) fn parse_macro_args(
Some(arg) => {
args.push(arg);
parser.bump();
if parser.token.kind == TokenKind::Eof && args.len() == 2 {
if parser.token == TokenKind::Eof && args.len() == 2 {
vec_with_semi = true;
break;
}
Expand All @@ -150,7 +148,7 @@ pub(crate) fn parse_macro_args(

parser.bump();

if parser.token.kind == TokenKind::Eof {
if parser.token == TokenKind::Eof {
trailing_comma = true;
break;
}
Expand Down
34 changes: 19 additions & 15 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,21 +517,25 @@ fn rewrite_generic_args(
span: Span,
) -> RewriteResult {
match gen_args {
ast::GenericArgs::AngleBracketed(ref data) if !data.args.is_empty() => {
let args = data
.args
.iter()
.map(|x| match x {
ast::AngleBracketedArg::Arg(generic_arg) => {
SegmentParam::from_generic_arg(generic_arg)
}
ast::AngleBracketedArg::Constraint(constraint) => {
SegmentParam::Binding(constraint)
}
})
.collect::<Vec<_>>();
ast::GenericArgs::AngleBracketed(ref data) => {
if data.args.is_empty() {
Ok("".to_owned())
} else {
let args = data
.args
.iter()
.map(|x| match x {
ast::AngleBracketedArg::Arg(generic_arg) => {
SegmentParam::from_generic_arg(generic_arg)
}
ast::AngleBracketedArg::Constraint(constraint) => {
SegmentParam::Binding(constraint)
}
})
.collect::<Vec<_>>();

overflow::rewrite_with_angle_brackets(context, "", args.iter(), shape, span)
overflow::rewrite_with_angle_brackets(context, "", args.iter(), shape, span)
}
}
ast::GenericArgs::Parenthesized(ref data) => format_function_type(
data.inputs.iter().map(|x| &**x),
Expand All @@ -541,7 +545,7 @@ fn rewrite_generic_args(
context,
shape,
),
_ => Ok("".to_owned()),
ast::GenericArgs::ParenthesizedElided(..) => Ok("(..)".to_owned()),
}
}

Expand Down
9 changes: 0 additions & 9 deletions tests/source/cfg_if/detect/os/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ pub fn check_for(x: Feature) -> bool {
fn detect_features() -> cache::Initializer {
let mut value = cache::Initializer::default();

// If the x86 CPU does not support the CPUID instruction then it is too
// old to support any of the currently-detectable features.
if !has_cpuid() {
return value;
}

// Calling `__cpuid`/`__cpuid_count` from here on is safe because the CPU
// has `cpuid` support.

// 0. EAX = 0: Basic Information:
// - EAX returns the "Highest Function Parameter", that is, the maximum
// leaf value for subsequent calls of `cpuinfo` in range [0,
Expand Down
2 changes: 0 additions & 2 deletions tests/source/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ trait T: ~ const Super {}

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

struct S<T:~ const ? Sized>(std::marker::PhantomData<T>);

impl ~ const T {}

fn apit(_: impl ~ const T) {}
Expand Down
9 changes: 0 additions & 9 deletions tests/target/cfg_if/detect/os/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ pub fn check_for(x: Feature) -> bool {
fn detect_features() -> cache::Initializer {
let mut value = cache::Initializer::default();

// If the x86 CPU does not support the CPUID instruction then it is too
// old to support any of the currently-detectable features.
if !has_cpuid() {
return value;
}

// Calling `__cpuid`/`__cpuid_count` from here on is safe because the CPU
// has `cpuid` support.

// 0. EAX = 0: Basic Information:
// - EAX returns the "Highest Function Parameter", that is, the maximum
// leaf value for subsequent calls of `cpuinfo` in range [0,
Expand Down
6 changes: 0 additions & 6 deletions tests/target/negative-bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,3 @@ where
i32: !Copy,
{
}

fn maybe_const_negative()
where
i32: ~const !Copy,
{
}
10 changes: 10 additions & 0 deletions tests/target/return-type-notation.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
fn rtn()
where
T: Trait<method(..): Send + 'static>,
T::method(..): Send + 'static,
{
}

fn test() {
let x: T::method(..);
}
2 changes: 0 additions & 2 deletions tests/target/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ const fn not_quite_const<S: ~const T>() -> i32 {
<S as T>::CONST
}

struct S<T: ~const ?Sized>(std::marker::PhantomData<T>);

impl ~const T {}

fn apit(_: impl ~const T) {}
Expand Down
Loading