Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 9699c96

Browse files
deps: bump to rustc v647
1 parent 7a76ec0 commit 9699c96

File tree

11 files changed

+198
-181
lines changed

11 files changed

+198
-181
lines changed

Cargo.lock

Lines changed: 109 additions & 109 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,35 +64,35 @@ rustc-workspace-hack = "1.0.0"
6464

6565
[dependencies.rustc_ast_pretty]
6666
package = "rustc-ap-rustc_ast_pretty"
67-
version = "644.0.0"
67+
version = "647.0.0"
6868

6969
[dependencies.rustc_data_structures]
7070
package = "rustc-ap-rustc_data_structures"
71-
version = "644.0.0"
71+
version = "647.0.0"
7272

7373
[dependencies.rustc_errors]
7474
package = "rustc-ap-rustc_errors"
75-
version = "644.0.0"
75+
version = "647.0.0"
7676

7777
[dependencies.rustc_parse]
7878
package = "rustc-ap-rustc_parse"
79-
version = "644.0.0"
79+
version = "647.0.0"
8080

8181
[dependencies.rustc_session]
8282
package = "rustc-ap-rustc_session"
83-
version = "644.0.0"
83+
version = "647.0.0"
8484

8585
[dependencies.rustc_span]
8686
package = "rustc-ap-rustc_span"
87-
version = "644.0.0"
87+
version = "647.0.0"
8888

8989
[dependencies.rustc_target]
9090
package = "rustc-ap-rustc_target"
91-
version = "644.0.0"
91+
version = "647.0.0"
9292

9393
[dependencies.syntax]
94-
package = "rustc-ap-syntax"
95-
version = "644.0.0"
94+
package = "rustc-ap-rustc_ast"
95+
version = "647.0.0"
9696

9797
[dev-dependencies]
9898
lazy_static = "1.0.0"

src/attr.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ use crate::utils::{count_newlines, mk_sp};
1818
mod doc_comment;
1919

2020
/// Returns attributes on the given statement.
21-
pub(crate) fn get_attrs_from_stmt(stmt: &ast::Stmt) -> &[ast::Attribute] {
21+
pub(crate) fn get_attrs_from_stmt(stmt: &ast::Stmt) -> Option<&[ast::Attribute]> {
2222
match stmt.kind {
23-
ast::StmtKind::Local(ref local) => &local.attrs,
24-
ast::StmtKind::Item(ref item) => &item.attrs,
25-
ast::StmtKind::Expr(ref expr) | ast::StmtKind::Semi(ref expr) => &expr.attrs,
26-
ast::StmtKind::Mac(ref mac) => &mac.2,
23+
ast::StmtKind::Local(ref local) => Some(&local.attrs),
24+
ast::StmtKind::Item(ref item) => Some(&item.attrs),
25+
ast::StmtKind::Expr(ref expr) | ast::StmtKind::Semi(ref expr) => Some(&expr.attrs),
26+
ast::StmtKind::Mac(ref mac) => Some(&mac.2),
27+
ast::StmtKind::Empty => None,
2728
}
2829
}
2930

@@ -36,6 +37,7 @@ pub(crate) fn get_span_without_attrs(stmt: &ast::Stmt) -> Span {
3637
let (ref mac, _, _) = **mac;
3738
mac.span()
3839
}
40+
ast::StmtKind::Empty => stmt.span,
3941
}
4042
}
4143

src/closures.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,13 @@ fn get_inner_expr<'a>(
105105

106106
// Figure out if a block is necessary.
107107
fn needs_block(block: &ast::Block, prefix: &str, context: &RewriteContext<'_>) -> bool {
108-
let has_attributes = block.stmts.first().map_or(false, |first_stmt| {
109-
!get_attrs_from_stmt(first_stmt).is_empty()
110-
});
108+
let has_attributes = block
109+
.stmts
110+
.first()
111+
.map_or(false, |first_stmt| match get_attrs_from_stmt(first_stmt) {
112+
Some(attrs) => !attrs.is_empty(),
113+
None => false,
114+
});
111115

112116
is_unsafe_block(block)
113117
|| block.stmts.len() > 1

src/items.rs

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ impl<'a> FmtVisitor<'a> {
298298

299299
fn format_foreign_item(&mut self, item: &ast::ForeignItem) {
300300
let rewrite = item.rewrite(&self.get_context(), self.shape());
301-
self.push_rewrite(item.span(), rewrite);
301+
self.push_rewrite(item.span, rewrite);
302302
self.last_pos = item.span.hi();
303303
}
304304

@@ -629,7 +629,7 @@ impl<'a> FmtVisitor<'a> {
629629
use crate::ast::AssocItemKind::*;
630630
fn need_empty_line(a: &ast::AssocItemKind, b: &ast::AssocItemKind) -> bool {
631631
match (a, b) {
632-
(TyAlias(_, ref lty), TyAlias(_, ref rty))
632+
(TyAlias(_, _, _, ref lty), TyAlias(_, _, _, ref rty))
633633
if both_type(lty, rty) || both_opaque(lty, rty) =>
634634
{
635635
false
@@ -640,7 +640,7 @@ impl<'a> FmtVisitor<'a> {
640640
}
641641

642642
buffer.sort_by(|(_, a), (_, b)| match (&a.kind, &b.kind) {
643-
(TyAlias(_, ref lty), TyAlias(_, ref rty))
643+
(TyAlias(_, _, _, ref lty), TyAlias(_, _, _, ref rty))
644644
if both_type(lty, rty) || both_opaque(lty, rty) =>
645645
{
646646
a.ident.as_str().cmp(&b.ident.as_str())
@@ -649,8 +649,8 @@ impl<'a> FmtVisitor<'a> {
649649
a.ident.as_str().cmp(&b.ident.as_str())
650650
}
651651
(Fn(..), Fn(..)) => a.span.lo().cmp(&b.span.lo()),
652-
(TyAlias(_, ref ty), _) if is_type(ty) => Ordering::Less,
653-
(_, TyAlias(_, ref ty)) if is_type(ty) => Ordering::Greater,
652+
(TyAlias(_, _, _, ref ty), _) if is_type(ty) => Ordering::Less,
653+
(_, TyAlias(_, _, _, ref ty)) if is_type(ty) => Ordering::Greater,
654654
(TyAlias(..), _) => Ordering::Less,
655655
(_, TyAlias(..)) => Ordering::Greater,
656656
(Const(..), _) => Ordering::Less,
@@ -1714,9 +1714,13 @@ pub(crate) struct StaticParts<'a> {
17141714

17151715
impl<'a> StaticParts<'a> {
17161716
pub(crate) fn from_item(item: &'a ast::Item) -> Self {
1717-
let (prefix, ty, mutability, expr) = match item.kind {
1718-
ast::ItemKind::Static(ref ty, mutability, ref expr) => ("static", ty, mutability, expr),
1719-
ast::ItemKind::Const(ref ty, ref expr) => ("const", ty, ast::Mutability::Not, expr),
1717+
let (defaultness, prefix, ty, mutability, expr) = match item.kind {
1718+
ast::ItemKind::Static(ref ty, mutability, ref expr) => {
1719+
(None, "static", ty, mutability, expr)
1720+
}
1721+
ast::ItemKind::Const(defaultness, ref ty, ref expr) => {
1722+
(Some(defaultness), "const", ty, ast::Mutability::Not, expr)
1723+
}
17201724
_ => unreachable!(),
17211725
};
17221726
StaticParts {
@@ -1725,15 +1729,17 @@ impl<'a> StaticParts<'a> {
17251729
ident: item.ident,
17261730
ty,
17271731
mutability,
1728-
expr_opt: Some(expr),
1729-
defaultness: None,
1732+
expr_opt: expr.as_ref(),
1733+
defaultness: defaultness,
17301734
span: item.span,
17311735
}
17321736
}
17331737

17341738
pub(crate) fn from_trait_item(ti: &'a ast::AssocItem) -> Self {
1735-
let (ty, expr_opt) = match ti.kind {
1736-
ast::AssocItemKind::Const(ref ty, ref expr_opt) => (ty, expr_opt),
1739+
let (defaultness, ty, expr_opt) = match ti.kind {
1740+
ast::AssocItemKind::Const(defaultness, ref ty, ref expr_opt) => {
1741+
(defaultness, ty, expr_opt)
1742+
}
17371743
_ => unreachable!(),
17381744
};
17391745
StaticParts {
@@ -1743,14 +1749,14 @@ impl<'a> StaticParts<'a> {
17431749
ty,
17441750
mutability: ast::Mutability::Not,
17451751
expr_opt: expr_opt.as_ref(),
1746-
defaultness: None,
1752+
defaultness: Some(defaultness),
17471753
span: ti.span,
17481754
}
17491755
}
17501756

17511757
pub(crate) fn from_impl_item(ii: &'a ast::AssocItem) -> Self {
1752-
let (ty, expr) = match ii.kind {
1753-
ast::AssocItemKind::Const(ref ty, ref expr) => (ty, expr),
1758+
let (defaultness, ty, expr) = match ii.kind {
1759+
ast::AssocItemKind::Const(defaultness, ref ty, ref expr) => (defaultness, ty, expr),
17541760
_ => unreachable!(),
17551761
};
17561762
StaticParts {
@@ -1760,7 +1766,7 @@ impl<'a> StaticParts<'a> {
17601766
ty,
17611767
mutability: ast::Mutability::Not,
17621768
expr_opt: expr.as_ref(),
1763-
defaultness: Some(ii.defaultness),
1769+
defaultness: Some(defaultness),
17641770
span: ii.span,
17651771
}
17661772
}
@@ -1903,7 +1909,7 @@ pub(crate) fn rewrite_associated_impl_type(
19031909
let result = rewrite_associated_type(ident, ty_opt, generics, None, context, indent)?;
19041910

19051911
match defaultness {
1906-
ast::Defaultness::Default => Some(format!("default {}", result)),
1912+
ast::Defaultness::Default(..) => Some(format!("default {}", result)),
19071913
_ => Some(result),
19081914
}
19091915
}
@@ -3083,7 +3089,7 @@ impl Rewrite for ast::ForeignItem {
30833089
let span = mk_sp(self.span.lo(), self.span.hi() - BytePos(1));
30843090

30853091
let item_str = match self.kind {
3086-
ast::ForeignItemKind::Fn(ref fn_sig, ref generics, _) => rewrite_fn_base(
3092+
ast::ForeignItemKind::Fn(_, ref fn_sig, ref generics, _) => rewrite_fn_base(
30873093
context,
30883094
shape.indent,
30893095
self.ident,
@@ -3092,7 +3098,7 @@ impl Rewrite for ast::ForeignItem {
30923098
FnBraceStyle::None,
30933099
)
30943100
.map(|(s, _)| format!("{};", s)),
3095-
ast::ForeignItemKind::Static(ref ty, mutability) => {
3101+
ast::ForeignItemKind::Static(ref ty, mutability, _) => {
30963102
// FIXME(#21): we're dropping potential comments in between the
30973103
// function kw here.
30983104
let vis = format_visibility(context, &self.vis);
@@ -3106,7 +3112,7 @@ impl Rewrite for ast::ForeignItem {
31063112
// 1 = ;
31073113
rewrite_assign_rhs(context, prefix, &**ty, shape.sub_width(1)?).map(|s| s + ";")
31083114
}
3109-
ast::ForeignItemKind::Ty => {
3115+
ast::ForeignItemKind::TyAlias(..) => {
31103116
let vis = format_visibility(context, &self.vis);
31113117
Some(format!(
31123118
"{}type {};",

src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ fn check_keyword<'a, 'b: 'a>(parser: &'a mut Parser<'b>) -> Option<MacroArg> {
231231
{
232232
parser.bump();
233233
let macro_arg =
234-
MacroArg::Keyword(ast::Ident::with_dummy_span(keyword), parser.prev_span);
234+
MacroArg::Keyword(ast::Ident::with_dummy_span(keyword), parser.prev_token.span);
235235
return Some(macro_arg);
236236
}
237237
}

src/modules.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ fn parse_mod_items<'a>(parser: &mut parser::Parser<'a>, inner_lo: Span) -> PResu
468468
let hi = if parser.token.span.is_dummy() {
469469
inner_lo
470470
} else {
471-
parser.prev_span
471+
parser.prev_token.span
472472
};
473473

474474
Ok(ast::Mod {

src/spanned.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ impl Spanned for ast::Stmt {
7474
mk_sp(attrs[0].span.lo(), self.span.hi())
7575
}
7676
}
77+
ast::StmtKind::Empty => self.span,
7778
}
7879
}
7980
}

src/stmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ fn format_stmt(
106106
let shape = shape.sub_width(suffix.len())?;
107107
format_expr(ex, expr_type, context, shape).map(|s| s + suffix)
108108
}
109-
ast::StmtKind::Mac(..) | ast::StmtKind::Item(..) => None,
109+
ast::StmtKind::Mac(..) | ast::StmtKind::Item(..) | ast::StmtKind::Empty => None,
110110
};
111111
result.and_then(|res| recover_comment_removed(res, stmt.span(), context))
112112
}

src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ pub(crate) fn format_constness(constness: ast::Const) -> &'static str {
104104
#[inline]
105105
pub(crate) fn format_defaultness(defaultness: ast::Defaultness) -> &'static str {
106106
match defaultness {
107-
ast::Defaultness::Default => "default ",
107+
ast::Defaultness::Default(..) => "default ",
108108
ast::Defaultness::Final => "",
109109
}
110110
}

0 commit comments

Comments
 (0)