Skip to content

Commit 8635a5c

Browse files
dtolnaycalebcartwright
authored andcommitted
deps: bump rustc-ap to v679
1 parent 9ba373f commit 8635a5c

File tree

8 files changed

+139
-93
lines changed

8 files changed

+139
-93
lines changed

Cargo.lock

Lines changed: 103 additions & 65 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
@@ -66,36 +66,36 @@ rustc-workspace-hack = "1.0.0"
6666

6767
[dependencies.rustc_ast]
6868
package = "rustc-ap-rustc_ast"
69-
version = "678.0.0"
69+
version = "679.0.0"
7070

7171
[dependencies.rustc_ast_pretty]
7272
package = "rustc-ap-rustc_ast_pretty"
73-
version = "678.0.0"
73+
version = "679.0.0"
7474

7575
[dependencies.rustc_attr]
7676
package = "rustc-ap-rustc_attr"
77-
version = "678.0.0"
77+
version = "679.0.0"
7878

7979
[dependencies.rustc_data_structures]
8080
package = "rustc-ap-rustc_data_structures"
81-
version = "678.0.0"
81+
version = "679.0.0"
8282

8383
[dependencies.rustc_errors]
8484
package = "rustc-ap-rustc_errors"
85-
version = "678.0.0"
85+
version = "679.0.0"
8686

8787
[dependencies.rustc_expand]
8888
package = "rustc-ap-rustc_expand"
89-
version = "678.0.0"
89+
version = "679.0.0"
9090

9191
[dependencies.rustc_parse]
9292
package = "rustc-ap-rustc_parse"
93-
version = "678.0.0"
93+
version = "679.0.0"
9494

9595
[dependencies.rustc_session]
9696
package = "rustc-ap-rustc_session"
97-
version = "678.0.0"
97+
version = "679.0.0"
9898

9999
[dependencies.rustc_span]
100100
package = "rustc-ap-rustc_span"
101-
version = "678.0.0"
101+
version = "679.0.0"

src/closures.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,12 @@ fn rewrite_closure_with_block(
150150
id: ast::NodeId::root(),
151151
kind: ast::StmtKind::Expr(ptr::P(body.clone())),
152152
span: body.span,
153+
tokens: None,
153154
}],
154155
id: ast::NodeId::root(),
155156
rules: ast::BlockCheckMode::Default,
156157
span: body.span,
158+
tokens: None,
157159
};
158160
let block = crate::expr::rewrite_block_with_visitor(
159161
context,

src/imports.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::fmt;
44

55
use rustc_ast::ast::{self, UseTreeKind};
66
use rustc_span::{
7-
source_map,
87
symbol::{self, sym},
98
BytePos, Span, DUMMY_SP,
109
};
@@ -509,16 +508,16 @@ impl UseTree {
509508
fn same_visibility(&self, other: &UseTree) -> bool {
510509
match (&self.visibility, &other.visibility) {
511510
(
512-
Some(source_map::Spanned {
513-
node: ast::VisibilityKind::Inherited,
511+
Some(ast::Visibility {
512+
kind: ast::VisibilityKind::Inherited,
514513
..
515514
}),
516515
None,
517516
)
518517
| (
519518
None,
520-
Some(source_map::Spanned {
521-
node: ast::VisibilityKind::Inherited,
519+
Some(ast::Visibility {
520+
kind: ast::VisibilityKind::Inherited,
522521
..
523522
}),
524523
)

src/items.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::cmp::{max, min, Ordering};
66
use regex::Regex;
77
use rustc_ast::visit;
88
use rustc_ast::{ast, ptr};
9-
use rustc_span::{source_map, symbol, BytePos, Span, DUMMY_SP};
9+
use rustc_span::{symbol, BytePos, Span, DUMMY_SP};
1010

1111
use crate::attr::filter_inline_attrs;
1212
use crate::comment::{
@@ -31,9 +31,10 @@ use crate::utils::*;
3131
use crate::vertical::rewrite_with_alignment;
3232
use crate::visitor::FmtVisitor;
3333

34-
const DEFAULT_VISIBILITY: ast::Visibility = source_map::Spanned {
35-
node: ast::VisibilityKind::Inherited,
34+
const DEFAULT_VISIBILITY: ast::Visibility = ast::Visibility {
35+
kind: ast::VisibilityKind::Inherited,
3636
span: DUMMY_SP,
37+
tokens: None,
3738
};
3839

3940
fn type_annotation_separator(config: &Config) -> &str {
@@ -125,7 +126,7 @@ impl Rewrite for ast::Local {
125126
// FIXME format modules in this style
126127
#[allow(dead_code)]
127128
struct Item<'a> {
128-
keyword: &'static str,
129+
unsafety: ast::Unsafe,
129130
abi: Cow<'static, str>,
130131
vis: Option<&'a ast::Visibility>,
131132
body: Vec<BodyElement<'a>>,
@@ -135,7 +136,7 @@ struct Item<'a> {
135136
impl<'a> Item<'a> {
136137
fn from_foreign_mod(fm: &'a ast::ForeignMod, span: Span, config: &Config) -> Item<'a> {
137138
Item {
138-
keyword: "",
139+
unsafety: fm.unsafety,
139140
abi: format_extern(
140141
ast::Extern::from_abi(fm.abi),
141142
config.force_explicit_abi(),
@@ -254,6 +255,7 @@ impl<'a> FnSig<'a> {
254255

255256
impl<'a> FmtVisitor<'a> {
256257
fn format_item(&mut self, item: &Item<'_>) {
258+
self.buffer.push_str(format_unsafety(item.unsafety));
257259
self.buffer.push_str(&item.abi);
258260

259261
let snippet = self.snippet(item.span);
@@ -1367,7 +1369,7 @@ pub(crate) fn format_struct_struct(
13671369
}
13681370

13691371
fn get_bytepos_after_visibility(vis: &ast::Visibility, default_span: Span) -> BytePos {
1370-
match vis.node {
1372+
match vis.kind {
13711373
ast::VisibilityKind::Crate(..) | ast::VisibilityKind::Restricted { .. } => vis.span.hi(),
13721374
_ => default_span.lo(),
13731375
}

src/syntux/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl<'a> Parser<'a> {
118118
) -> Result<(ast::Mod, Vec<ast::Attribute>), ParserError> {
119119
let result = catch_unwind(AssertUnwindSafe(|| {
120120
let mut parser = new_parser_from_file(sess.inner(), &path, Some(span));
121-
match parser.parse_mod(&TokenKind::Eof) {
121+
match parser.parse_mod(&TokenKind::Eof, ast::Unsafe::No) {
122122
Ok(result) => Some(result),
123123
Err(mut e) => {
124124
e.cancel();

src/utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ pub(crate) fn extra_offset(text: &str, shape: Shape) -> usize {
3838
}
3939

4040
pub(crate) fn is_same_visibility(a: &Visibility, b: &Visibility) -> bool {
41-
match (&a.node, &b.node) {
41+
match (&a.kind, &b.kind) {
4242
(
4343
VisibilityKind::Restricted { path: p, .. },
4444
VisibilityKind::Restricted { path: q, .. },
45-
) => pprust::path_to_string(p) == pprust::path_to_string(q),
45+
) => pprust::path_to_string(&p) == pprust::path_to_string(&q),
4646
(VisibilityKind::Public, VisibilityKind::Public)
4747
| (VisibilityKind::Inherited, VisibilityKind::Inherited)
4848
| (
@@ -62,7 +62,7 @@ pub(crate) fn format_visibility(
6262
context: &RewriteContext<'_>,
6363
vis: &Visibility,
6464
) -> Cow<'static, str> {
65-
match vis.node {
65+
match vis.kind {
6666
VisibilityKind::Public => Cow::from("pub "),
6767
VisibilityKind::Inherited => Cow::from(""),
6868
VisibilityKind::Crate(CrateSugar::PubCrate) => Cow::from("pub(crate) "),

src/visitor.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::cell::{Cell, RefCell};
22
use std::rc::Rc;
33

44
use rustc_ast::{ast, attr::HasAttrs, token::DelimToken, visit};
5-
use rustc_span::{symbol, BytePos, Pos, Span};
5+
use rustc_span::{symbol, BytePos, Pos, Span, DUMMY_SP};
66

77
use crate::attr::*;
88
use crate::comment::{rewrite_comment, CodeCharKind, CommentCodeSlices};
@@ -25,8 +25,8 @@ use crate::spanned::Spanned;
2525
use crate::stmt::Stmt;
2626
use crate::syntux::session::ParseSess;
2727
use crate::utils::{
28-
self, contains_skip, count_newlines, depr_skip_annotation, inner_attributes, last_line_width,
29-
mk_sp, ptr_vec_to_ref_vec, rewrite_ident, stmt_expr,
28+
self, contains_skip, count_newlines, depr_skip_annotation, format_unsafety, inner_attributes,
29+
last_line_width, mk_sp, ptr_vec_to_ref_vec, rewrite_ident, stmt_expr,
3030
};
3131
use crate::{ErrorKind, FormatReport, FormattingError};
3232

@@ -603,7 +603,11 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
603603
}
604604
ast::AssocItemKind::Fn(defaultness, ref sig, ref generics, Some(ref body)) => {
605605
let inner_attrs = inner_attributes(&ti.attrs);
606-
let vis = rustc_span::source_map::dummy_spanned(ast::VisibilityKind::Inherited);
606+
let vis = ast::Visibility {
607+
kind: ast::VisibilityKind::Inherited,
608+
span: DUMMY_SP,
609+
tokens: None,
610+
};
607611
let fn_ctxt = visit::FnCtxt::Assoc(visit::AssocCtxt::Trait);
608612
self.visit_fn(
609613
visit::FnKind::Fn(fn_ctxt, ti.ident, sig, &vis, Some(body)),
@@ -902,6 +906,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
902906
) {
903907
let vis_str = utils::format_visibility(&self.get_context(), vis);
904908
self.push_str(&*vis_str);
909+
self.push_str(format_unsafety(m.unsafety));
905910
self.push_str("mod ");
906911
// Calling `to_owned()` to work around borrow checker.
907912
let ident_str = rewrite_ident(&self.get_context(), ident).to_owned();

0 commit comments

Comments
 (0)