Skip to content

Rollup of 8 pull requests #96075

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

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c492355
fix error handling for pthread_sigmask(3)
anonion0 Jan 31, 2022
f427698
Parse inner attributes on inline const block
dtolnay Mar 16, 2022
9cfdb89
Only add codegen backend to dep info if -Zbinary-dep-depinfo is used
bjorn3 Feb 13, 2022
c681a88
Don't include invalid paths in the depinfo for builtin backends
bjorn3 Feb 13, 2022
147e5da
Add test
bjorn3 Mar 24, 2022
8035796
Stablize `const_extern_fn` for "Rust" and "C"
Aaron1011 Mar 26, 2022
8c2353b
remove find_use_placement
kckeiks Mar 18, 2022
98190b7
Revert "Work around invalid DWARF bugs for fat LTO"
cbiffle Apr 4, 2022
42af197
Improve debuginfo test coverage for simple statics.
cbiffle Apr 5, 2022
edeb826
Inline shallow_resolve_ty into ShallowResolver
compiler-errors Apr 10, 2022
7f945b2
add simd_arith_offset intrinsics
RalfJung Apr 12, 2022
e886dc5
portable-simd: use simd_arith_offset to avoid ptr-int transmutation
RalfJung Apr 12, 2022
eb905c0
add codegen smoke test
RalfJung Apr 13, 2022
397c134
Rollup merge of #93530 - anonion0:pthread_sigmask_fix, r=kennytm
RalfJung Apr 15, 2022
03e6a50
Rollup merge of #93969 - bjorn3:codegen_backend_dep_info, r=pnkfelix
RalfJung Apr 15, 2022
99b5bdf
Rollup merge of #94985 - dtolnay:constattr, r=pnkfelix
RalfJung Apr 15, 2022
38d81e2
Rollup merge of #95194 - kckeiks:update-algo-in-find-use-placement, r…
RalfJung Apr 15, 2022
21b8b25
Rollup merge of #95346 - Aaron1011:stablize-const-extern-fn, r=pnkfelix
RalfJung Apr 15, 2022
f77c0db
Rollup merge of #95685 - oxidecomputer:restore-static-dwarf, r=pnkfelix
RalfJung Apr 15, 2022
cca3b87
Rollup merge of #95908 - compiler-errors:shallow_resolve_ty-inline, r…
RalfJung Apr 15, 2022
801d955
Rollup merge of #95961 - RalfJung:gather-scatter, r=workingjubilee
RalfJung Apr 15, 2022
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
Prev Previous commit
Next Next commit
Parse inner attributes on inline const block
  • Loading branch information
dtolnay committed Mar 16, 2022
commit f427698c03a74b961dbc5f28bc7a9801a77d0d44
2 changes: 1 addition & 1 deletion compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ impl<'a> State<'a> {
self.word_space("=");
match term {
Term::Ty(ty) => self.print_type(ty),
Term::Const(c) => self.print_expr_anon_const(c),
Term::Const(c) => self.print_expr_anon_const(c, &[]),
}
}
ast::AssocConstraintKind::Bound { bounds } => self.print_type_bounds(":", &*bounds),
Expand Down
17 changes: 14 additions & 3 deletions compiler/rustc_ast_pretty/src/pprust/state/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,21 @@ impl<'a> State<'a> {
self.end();
}

pub(super) fn print_expr_anon_const(&mut self, expr: &ast::AnonConst) {
pub(super) fn print_expr_anon_const(
&mut self,
expr: &ast::AnonConst,
attrs: &[ast::Attribute],
) {
self.ibox(INDENT_UNIT);
self.word("const");
self.print_expr(&expr.value);
self.nbsp();
if let ast::ExprKind::Block(block, None) = &expr.value.kind {
self.cbox(0);
self.ibox(0);
self.print_block_with_attrs(block, attrs);
} else {
self.print_expr(&expr.value);
}
self.end();
}

Expand Down Expand Up @@ -275,7 +286,7 @@ impl<'a> State<'a> {
self.print_expr_vec(exprs);
}
ast::ExprKind::ConstBlock(ref anon_const) => {
self.print_expr_anon_const(anon_const);
self.print_expr_anon_const(anon_const, attrs);
}
ast::ExprKind::Repeat(ref element, ref count) => {
self.print_expr_repeat(element, count);
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_parse/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1105,13 +1105,13 @@ impl<'a> Parser<'a> {
self.sess.gated_spans.gate(sym::inline_const, span);
}
self.eat_keyword(kw::Const);
let blk = self.parse_block()?;
let (attrs, blk) = self.parse_inner_attrs_and_block()?;
let anon_const = AnonConst {
id: DUMMY_NODE_ID,
value: self.mk_expr(blk.span, ExprKind::Block(blk, None), AttrVec::new()),
};
let blk_span = anon_const.value.span;
Ok(self.mk_expr(span.to(blk_span), ExprKind::ConstBlock(anon_const), AttrVec::new()))
Ok(self.mk_expr(span.to(blk_span), ExprKind::ConstBlock(anon_const), AttrVec::from(attrs)))
}

/// Parses mutability (`mut` or nothing).
Expand Down
9 changes: 9 additions & 0 deletions src/test/pretty/stmt_expr_attributes.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// pp-exact

#![feature(box_syntax)]
#![feature(inline_const)]
#![feature(inline_const_pat)]
#![feature(rustc_attrs)]
#![feature(stmt_expr_attributes)]

Expand All @@ -16,6 +18,7 @@ fn _1() {

#[rustc_dummy]
unsafe {
#![rustc_dummy]
// code
}
}
Expand Down Expand Up @@ -206,6 +209,12 @@ fn _11() {
let _ = ();
()
};
let const {
#![rustc_dummy]
} =
#[rustc_dummy] const {
#![rustc_dummy]
};
let mut x = 0;
let _ = #[rustc_dummy] x = 15;
let _ = #[rustc_dummy] x += 15;
Expand Down