Skip to content

Commit e918b13

Browse files
authored
Merge pull request #2539 from rust-lang/rustc-pull
Rustc pull update
2 parents 0f2ed2b + 3d1ff63 commit e918b13

File tree

224 files changed

+5513
-4814
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+5513
-4814
lines changed

.github/workflows/rustc-pull.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ jobs:
1111
if: github.repository == 'rust-lang/rust-analyzer'
1212
uses: rust-lang/josh-sync/.github/workflows/rustc-pull.yml@main
1313
with:
14+
github-app-id: ${{ vars.APP_CLIENT_ID }}
1415
zulip-stream-id: 185405
1516
zulip-bot-email: "[email protected]"
1617
pr-base-branch: master
1718
branch-name: rustc-pull
1819
secrets:
1920
zulip-api-token: ${{ secrets.ZULIP_API_TOKEN }}
20-
token: ${{ secrets.GITHUB_TOKEN }}
21+
github-app-secret: ${{ secrets.APP_PRIVATE_KEY }}

Cargo.lock

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

crates/base-db/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ impl EditionedFileId {
206206

207207
#[salsa_macros::input(debug)]
208208
pub struct FileText {
209+
#[returns(ref)]
209210
pub text: Arc<str>,
210211
pub file_id: vfs::FileId,
211212
}
@@ -357,7 +358,7 @@ fn parse(db: &dyn RootQueryDb, file_id: EditionedFileId) -> Parse<ast::SourceFil
357358
let _p = tracing::info_span!("parse", ?file_id).entered();
358359
let (file_id, edition) = file_id.unpack(db.as_dyn_database());
359360
let text = db.file_text(file_id).text(db);
360-
ast::SourceFile::parse(&text, edition)
361+
ast::SourceFile::parse(text, edition)
361362
}
362363

363364
fn parse_errors(db: &dyn RootQueryDb, file_id: EditionedFileId) -> Option<&[SyntaxError]> {

crates/cfg/src/cfg_expr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ fn next_cfg_expr<S: Copy>(it: &mut tt::iter::TtIter<'_, S>) -> Option<CfgExpr> {
134134
};
135135

136136
// Eat comma separator
137-
if let Some(TtElement::Leaf(tt::Leaf::Punct(punct))) = it.peek() {
138-
if punct.char == ',' {
139-
it.next();
140-
}
137+
if let Some(TtElement::Leaf(tt::Leaf::Punct(punct))) = it.peek()
138+
&& punct.char == ','
139+
{
140+
it.next();
141141
}
142142
Some(ret)
143143
}

crates/hir-def/src/attr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,10 @@ fn parse_repr_tt(tt: &crate::tt::TopSubtree) -> Option<ReprOptions> {
377377
let mut align = None;
378378
if let Some(TtElement::Subtree(_, mut tt_iter)) = tts.peek() {
379379
tts.next();
380-
if let Some(TtElement::Leaf(tt::Leaf::Literal(lit))) = tt_iter.next() {
381-
if let Ok(a) = lit.symbol.as_str().parse() {
382-
align = Align::from_bytes(a).ok();
383-
}
380+
if let Some(TtElement::Leaf(tt::Leaf::Literal(lit))) = tt_iter.next()
381+
&& let Ok(a) = lit.symbol.as_str().parse()
382+
{
383+
align = Align::from_bytes(a).ok();
384384
}
385385
}
386386
ReprOptions { align, ..Default::default() }

crates/hir-def/src/expr_store/lower.rs

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,13 +1487,13 @@ impl ExprCollector<'_> {
14871487
ast::Expr::UnderscoreExpr(_) => self.alloc_pat_from_expr(Pat::Wild, syntax_ptr),
14881488
ast::Expr::ParenExpr(e) => {
14891489
// We special-case `(..)` for consistency with patterns.
1490-
if let Some(ast::Expr::RangeExpr(range)) = e.expr() {
1491-
if range.is_range_full() {
1492-
return Some(self.alloc_pat_from_expr(
1493-
Pat::Tuple { args: Box::default(), ellipsis: Some(0) },
1494-
syntax_ptr,
1495-
));
1496-
}
1490+
if let Some(ast::Expr::RangeExpr(range)) = e.expr()
1491+
&& range.is_range_full()
1492+
{
1493+
return Some(self.alloc_pat_from_expr(
1494+
Pat::Tuple { args: Box::default(), ellipsis: Some(0) },
1495+
syntax_ptr,
1496+
));
14971497
}
14981498
return e.expr().and_then(|expr| self.maybe_collect_expr_as_pat(&expr));
14991499
}
@@ -2569,19 +2569,18 @@ impl ExprCollector<'_> {
25692569
}
25702570
}
25712571
RibKind::MacroDef(macro_id) => {
2572-
if let Some((parent_ctx, label_macro_id)) = hygiene_info {
2573-
if label_macro_id == **macro_id {
2574-
// A macro is allowed to refer to labels from before its declaration.
2575-
// Therefore, if we got to the rib of its declaration, give up its hygiene
2576-
// and use its parent expansion.
2577-
2578-
hygiene_id =
2579-
HygieneId::new(parent_ctx.opaque_and_semitransparent(self.db));
2580-
hygiene_info = parent_ctx.outer_expn(self.db).map(|expansion| {
2581-
let expansion = self.db.lookup_intern_macro_call(expansion.into());
2582-
(parent_ctx.parent(self.db), expansion.def)
2583-
});
2584-
}
2572+
if let Some((parent_ctx, label_macro_id)) = hygiene_info
2573+
&& label_macro_id == **macro_id
2574+
{
2575+
// A macro is allowed to refer to labels from before its declaration.
2576+
// Therefore, if we got to the rib of its declaration, give up its hygiene
2577+
// and use its parent expansion.
2578+
2579+
hygiene_id = HygieneId::new(parent_ctx.opaque_and_semitransparent(self.db));
2580+
hygiene_info = parent_ctx.outer_expn(self.db).map(|expansion| {
2581+
let expansion = self.db.lookup_intern_macro_call(expansion.into());
2582+
(parent_ctx.parent(self.db), expansion.def)
2583+
});
25852584
}
25862585
}
25872586
_ => {}

crates/hir-def/src/expr_store/lower/asm.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,10 @@ impl ExprCollector<'_> {
259259
}
260260
};
261261

262-
if let Some(operand_idx) = operand_idx {
263-
if let Some(position_span) = to_span(arg.position_span) {
264-
mappings.push((position_span, operand_idx));
265-
}
262+
if let Some(operand_idx) = operand_idx
263+
&& let Some(position_span) = to_span(arg.position_span)
264+
{
265+
mappings.push((position_span, operand_idx));
266266
}
267267
}
268268
}

crates/hir-def/src/expr_store/lower/path.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,16 +211,17 @@ pub(super) fn lower_path(
211211
// Basically, even in rustc it is quite hacky:
212212
// https://github.com/rust-lang/rust/blob/614f273e9388ddd7804d5cbc80b8865068a3744e/src/librustc_resolve/macros.rs#L456
213213
// We follow what it did anyway :)
214-
if segments.len() == 1 && kind == PathKind::Plain {
215-
if let Some(_macro_call) = path.syntax().parent().and_then(ast::MacroCall::cast) {
216-
let syn_ctxt = collector.expander.ctx_for_range(path.segment()?.syntax().text_range());
217-
if let Some(macro_call_id) = syn_ctxt.outer_expn(collector.db) {
218-
if collector.db.lookup_intern_macro_call(macro_call_id.into()).def.local_inner {
219-
kind = match resolve_crate_root(collector.db, syn_ctxt) {
220-
Some(crate_root) => PathKind::DollarCrate(crate_root),
221-
None => PathKind::Crate,
222-
}
223-
}
214+
if segments.len() == 1
215+
&& kind == PathKind::Plain
216+
&& let Some(_macro_call) = path.syntax().parent().and_then(ast::MacroCall::cast)
217+
{
218+
let syn_ctxt = collector.expander.ctx_for_range(path.segment()?.syntax().text_range());
219+
if let Some(macro_call_id) = syn_ctxt.outer_expn(collector.db)
220+
&& collector.db.lookup_intern_macro_call(macro_call_id.into()).def.local_inner
221+
{
222+
kind = match resolve_crate_root(collector.db, syn_ctxt) {
223+
Some(crate_root) => PathKind::DollarCrate(crate_root),
224+
None => PathKind::Crate,
224225
}
225226
}
226227
}

crates/hir-def/src/expr_store/pretty.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -900,14 +900,12 @@ impl Printer<'_> {
900900
let field_name = arg.name.display(self.db, edition).to_string();
901901

902902
let mut same_name = false;
903-
if let Pat::Bind { id, subpat: None } = &self.store[arg.pat] {
904-
if let Binding { name, mode: BindingAnnotation::Unannotated, .. } =
903+
if let Pat::Bind { id, subpat: None } = &self.store[arg.pat]
904+
&& let Binding { name, mode: BindingAnnotation::Unannotated, .. } =
905905
&self.store.assert_expr_only().bindings[*id]
906-
{
907-
if name.as_str() == field_name {
908-
same_name = true;
909-
}
910-
}
906+
&& name.as_str() == field_name
907+
{
908+
same_name = true;
911909
}
912910

913911
w!(p, "{}", field_name);

0 commit comments

Comments
 (0)