Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9260be3

Browse files
committedOct 26, 2024
Auto merge of #132184 - jieyouxu:rollup-81ht12w, r=jieyouxu
Rollup of 5 pull requests Successful merges: - #132124 (coverage: Consolidate creation of covmap/covfun records) - #132140 (Enable LSX feature for LoongArch Linux targets) - #132169 (Deny calls to non-`#[const_trait]` methods in MIR constck) - #132174 (x86 target features: make pclmulqdq imply sse2) - #132180 (Print unsafety of attribute in AST pretty print) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 17f8215 + 50e78b8 commit 9260be3

File tree

84 files changed

+576
-471
lines changed

Some content is hidden

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

84 files changed

+576
-471
lines changed
 

‎compiler/rustc_ast_pretty/src/pprust/state.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,13 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
627627

628628
fn print_attr_item(&mut self, item: &ast::AttrItem, span: Span) {
629629
self.ibox(0);
630+
match item.unsafety {
631+
ast::Safety::Unsafe(_) => {
632+
self.word("unsafe");
633+
self.popen();
634+
}
635+
ast::Safety::Default | ast::Safety::Safe(_) => {}
636+
}
630637
match &item.args {
631638
AttrArgs::Delimited(DelimArgs { dspan: _, delim, tokens }) => self.print_mac_common(
632639
Some(MacHeader::Path(&item.path)),
@@ -655,6 +662,10 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
655662
self.word(token_str);
656663
}
657664
}
665+
match item.unsafety {
666+
ast::Safety::Unsafe(_) => self.pclose(),
667+
ast::Safety::Default | ast::Safety::Safe(_) => {}
668+
}
658669
self.end();
659670
}
660671

‎compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ pub(crate) struct CodegenCx<'ll, 'tcx> {
8080

8181
pub isize_ty: &'ll Type,
8282

83+
/// Extra codegen state needed when coverage instrumentation is enabled.
8384
pub coverage_cx: Option<coverageinfo::CrateCoverageContext<'ll, 'tcx>>,
8485
pub dbg_cx: Option<debuginfo::CodegenUnitDebugContext<'ll, 'tcx>>,
8586

@@ -592,11 +593,10 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
592593
&self.statics_to_rauw
593594
}
594595

596+
/// Extra state that is only available when coverage instrumentation is enabled.
595597
#[inline]
596-
pub(crate) fn coverage_context(
597-
&self,
598-
) -> Option<&coverageinfo::CrateCoverageContext<'ll, 'tcx>> {
599-
self.coverage_cx.as_ref()
598+
pub(crate) fn coverage_cx(&self) -> &coverageinfo::CrateCoverageContext<'ll, 'tcx> {
599+
self.coverage_cx.as_ref().expect("only called when coverage instrumentation is enabled")
600600
}
601601

602602
pub(crate) fn create_used_variable_impl(&self, name: &'static CStr, values: &[&'ll Value]) {

0 commit comments

Comments
 (0)
Please sign in to comment.