Skip to content

Commit 242f20d

Browse files
committed
Auto merge of rust-lang#132972 - matthiaskrgr:rollup-456osr7, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#132702 (CFI: Append debug location to CFI blocks) - rust-lang#132851 (Update the doc comment of `ASCII_CASE_MASK`) - rust-lang#132948 (stabilize const_unicode_case_lookup) - rust-lang#132950 (Use GNU ld on m68k-unknown-linux-gnu) - rust-lang#132962 (triagebot: add codegen reviewers) - rust-lang#132966 (stabilize const_option_ext) - rust-lang#132970 (Add tracking issue number to unsigned_nonzero_div_ceil feature) r? `@ghost` `@rustbot` modify labels: rollup
2 parents b420d92 + d83de7e commit 242f20d

File tree

17 files changed

+68
-16
lines changed

17 files changed

+68
-16
lines changed

compiler/rustc_codegen_gcc/src/debuginfo.rs

+4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ impl<'a, 'gcc, 'tcx> DebugInfoBuilderMethods for Builder<'a, 'gcc, 'tcx> {
5252
fn clear_dbg_loc(&mut self) {
5353
self.location = None;
5454
}
55+
56+
fn get_dbg_loc(&self) -> Option<Self::DILocation> {
57+
self.location
58+
}
5559
}
5660

5761
/// Generate the `debug_context` in an MIR Body.

compiler/rustc_codegen_llvm/src/builder.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1574,6 +1574,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
15741574
cfi::typeid_for_fnabi(self.tcx, fn_abi, options)
15751575
};
15761576
let typeid_metadata = self.cx.typeid_metadata(typeid).unwrap();
1577+
let dbg_loc = self.get_dbg_loc();
15771578

15781579
// Test whether the function pointer is associated with the type identifier.
15791580
let cond = self.type_test(llfn, typeid_metadata);
@@ -1582,10 +1583,16 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
15821583
self.cond_br(cond, bb_pass, bb_fail);
15831584

15841585
self.switch_to_block(bb_fail);
1586+
if let Some(dbg_loc) = dbg_loc {
1587+
self.set_dbg_loc(dbg_loc);
1588+
}
15851589
self.abort();
15861590
self.unreachable();
15871591

15881592
self.switch_to_block(bb_pass);
1593+
if let Some(dbg_loc) = dbg_loc {
1594+
self.set_dbg_loc(dbg_loc);
1595+
}
15891596
}
15901597
}
15911598

compiler/rustc_codegen_llvm/src/debuginfo/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@ impl<'ll> DebugInfoBuilderMethods for Builder<'_, 'll, '_> {
206206
}
207207
}
208208

209+
fn get_dbg_loc(&self) -> Option<&'ll DILocation> {
210+
unsafe { llvm::LLVMGetCurrentDebugLocation2(self.llbuilder) }
211+
}
212+
209213
fn insert_reference_to_gdb_debug_scripts_section_global(&mut self) {
210214
gdb::insert_reference_to_gdb_debug_scripts_section_global(self)
211215
}

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,7 @@ unsafe extern "C" {
10631063

10641064
// Metadata
10651065
pub fn LLVMSetCurrentDebugLocation2<'a>(Builder: &Builder<'a>, Loc: *const Metadata);
1066+
pub fn LLVMGetCurrentDebugLocation2<'a>(Builder: &Builder<'a>) -> Option<&'a Metadata>;
10661067

10671068
// Terminators
10681069
pub fn LLVMBuildRetVoid<'a>(B: &Builder<'a>) -> &'a Value;

compiler/rustc_codegen_ssa/src/traits/debuginfo.rs

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ pub trait DebugInfoBuilderMethods: BackendTypes {
8181
);
8282
fn set_dbg_loc(&mut self, dbg_loc: Self::DILocation);
8383
fn clear_dbg_loc(&mut self);
84+
fn get_dbg_loc(&self) -> Option<Self::DILocation>;
8485
fn insert_reference_to_gdb_debug_scripts_section_global(&mut self);
8586
fn set_var_name(&mut self, value: Self::Value, name: &str);
8687
}

compiler/rustc_target/src/spec/targets/m68k_unknown_linux_gnu.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::abi::Endian;
2-
use crate::spec::{Target, TargetOptions, base};
2+
use crate::spec::{LinkSelfContainedDefault, Target, TargetOptions, base};
33

44
pub(crate) fn target() -> Target {
55
let mut base = base::linux_gnu::opts();
@@ -17,6 +17,13 @@ pub(crate) fn target() -> Target {
1717
pointer_width: 32,
1818
data_layout: "E-m:e-p:32:16:32-i8:8:8-i16:16:16-i32:16:32-n8:16:32-a:0:16-S16".into(),
1919
arch: "m68k".into(),
20-
options: TargetOptions { endian: Endian::Big, mcount: "_mcount".into(), ..base },
20+
options: TargetOptions {
21+
endian: Endian::Big,
22+
mcount: "_mcount".into(),
23+
24+
// LLD currently does not have support for M68k
25+
link_self_contained: LinkSelfContainedDefault::False,
26+
..base
27+
},
2128
}
2229
}

library/core/src/char/methods.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -775,13 +775,12 @@ impl char {
775775
/// In a const context:
776776
///
777777
/// ```
778-
/// #![feature(const_unicode_case_lookup)]
779778
/// const CAPITAL_DELTA_IS_LOWERCASE: bool = 'Δ'.is_lowercase();
780779
/// assert!(!CAPITAL_DELTA_IS_LOWERCASE);
781780
/// ```
782781
#[must_use]
783782
#[stable(feature = "rust1", since = "1.0.0")]
784-
#[rustc_const_unstable(feature = "const_unicode_case_lookup", issue = "101400")]
783+
#[rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0")]
785784
#[inline]
786785
pub const fn is_lowercase(self) -> bool {
787786
match self {
@@ -817,13 +816,12 @@ impl char {
817816
/// In a const context:
818817
///
819818
/// ```
820-
/// #![feature(const_unicode_case_lookup)]
821819
/// const CAPITAL_DELTA_IS_UPPERCASE: bool = 'Δ'.is_uppercase();
822820
/// assert!(CAPITAL_DELTA_IS_UPPERCASE);
823821
/// ```
824822
#[must_use]
825823
#[stable(feature = "rust1", since = "1.0.0")]
826-
#[rustc_const_unstable(feature = "const_unicode_case_lookup", issue = "101400")]
824+
#[rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0")]
827825
#[inline]
828826
pub const fn is_uppercase(self) -> bool {
829827
match self {

library/core/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@
120120
#![feature(const_float_methods)]
121121
#![feature(const_heap)]
122122
#![feature(const_nonnull_new)]
123-
#![feature(const_option_ext)]
124123
#![feature(const_pin_2)]
125124
#![feature(const_ptr_is_null)]
126125
#![feature(const_ptr_sub_ptr)]
@@ -134,7 +133,6 @@
134133
#![feature(const_type_name)]
135134
#![feature(const_typed_swap)]
136135
#![feature(const_ub_checks)]
137-
#![feature(const_unicode_case_lookup)]
138136
#![feature(core_intrinsics)]
139137
#![feature(coverage_attribute)]
140138
#![feature(do_not_recommend)]

library/core/src/num/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ impl isize {
528528
midpoint_impl! { isize, signed }
529529
}
530530

531-
/// If the 6th bit is set ascii is lower case.
531+
/// If the bit selected by this mask is set, ascii is lower case.
532532
const ASCII_CASE_MASK: u8 = 0b0010_0000;
533533

534534
impl u8 {

library/core/src/num/nonzero.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ macro_rules! nonzero_integer_signedness_dependent_impls {
12331233
#[doc = concat!("let three = NonZero::new(3", stringify!($Int), ").unwrap();")]
12341234
/// assert_eq!(three.div_ceil(two), two);
12351235
/// ```
1236-
#[unstable(feature = "unsigned_nonzero_div_ceil", issue = "none")]
1236+
#[unstable(feature = "unsigned_nonzero_div_ceil", issue = "132968")]
12371237
#[must_use = "this returns the result of the operation, \
12381238
without modifying the original"]
12391239
#[inline]

library/core/src/option.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ impl<T> Option<T> {
738738
#[inline]
739739
#[must_use]
740740
#[stable(feature = "pin", since = "1.33.0")]
741-
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
741+
#[rustc_const_stable(feature = "const_option_ext", since = "CURRENT_RUSTC_VERSION")]
742742
pub const fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&T>> {
743743
// FIXME(const-hack): use `map` once that is possible
744744
match Pin::get_ref(self).as_ref() {
@@ -755,7 +755,7 @@ impl<T> Option<T> {
755755
#[inline]
756756
#[must_use]
757757
#[stable(feature = "pin", since = "1.33.0")]
758-
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
758+
#[rustc_const_stable(feature = "const_option_ext", since = "CURRENT_RUSTC_VERSION")]
759759
pub const fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut T>> {
760760
// SAFETY: `get_unchecked_mut` is never used to move the `Option` inside `self`.
761761
// `x` is guaranteed to be pinned because it comes from `self` which is pinned.
@@ -802,7 +802,7 @@ impl<T> Option<T> {
802802
#[inline]
803803
#[must_use]
804804
#[stable(feature = "option_as_slice", since = "1.75.0")]
805-
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
805+
#[rustc_const_stable(feature = "const_option_ext", since = "CURRENT_RUSTC_VERSION")]
806806
pub const fn as_slice(&self) -> &[T] {
807807
// SAFETY: When the `Option` is `Some`, we're using the actual pointer
808808
// to the payload, with a length of 1, so this is equivalent to
@@ -857,7 +857,7 @@ impl<T> Option<T> {
857857
#[inline]
858858
#[must_use]
859859
#[stable(feature = "option_as_slice", since = "1.75.0")]
860-
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
860+
#[rustc_const_stable(feature = "const_option_ext", since = "CURRENT_RUSTC_VERSION")]
861861
pub const fn as_mut_slice(&mut self) -> &mut [T] {
862862
// SAFETY: When the `Option` is `Some`, we're using the actual pointer
863863
// to the payload, with a length of 1, so this is equivalent to

library/core/src/unicode/unicode_data.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
///! This file is generated by `./x run src/tools/unicode-table-generator`; do not edit manually!
22
33
#[inline(always)]
4+
#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0"))]
45
const fn bitset_search<
56
const N: usize,
67
const CHUNK_SIZE: usize,
@@ -423,6 +424,7 @@ pub mod lowercase {
423424
(5, 187), (6, 78), (7, 132),
424425
];
425426

427+
#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0"))]
426428
pub const fn lookup(c: char) -> bool {
427429
super::bitset_search(
428430
c as u32,
@@ -547,6 +549,7 @@ pub mod uppercase {
547549
(2, 146), (2, 20), (3, 146), (3, 140), (3, 134), (4, 178), (4, 171),
548550
];
549551

552+
#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0"))]
550553
pub const fn lookup(c: char) -> bool {
551554
super::bitset_search(
552555
c as u32,

library/core/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#![feature(const_eval_select)]
2222
#![feature(const_heap)]
2323
#![feature(const_nonnull_new)]
24-
#![feature(const_option_ext)]
2524
#![feature(const_pin_2)]
2625
#![feature(const_trait_impl)]
2726
#![feature(core_intrinsics)]

src/tools/unicode-table-generator/src/range_search.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#[inline(always)]
2+
#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0"))]
23
const fn bitset_search<
34
const N: usize,
45
const CHUNK_SIZE: usize,

src/tools/unicode-table-generator/src/raw_emitter.rs

+4
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ impl RawEmitter {
9797

9898
self.blank_line();
9999

100+
writeln!(
101+
&mut self.file,
102+
r#"#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0"))]"#
103+
).unwrap();
100104
writeln!(&mut self.file, "pub const fn lookup(c: char) -> bool {{").unwrap();
101105
if first_code_point > 0x7f {
102106
writeln!(&mut self.file, " (c as u32) >= {first_code_point:#04x} &&").unwrap();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Verifies that the parent block's debug information are assigned to the inserted cfi block.
2+
//
3+
//@ needs-sanitizer-cfi
4+
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -Cdebuginfo=1
5+
6+
#![crate_type = "lib"]
7+
8+
pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 {
9+
// CHECK-LABEL: define{{.*}}foo{{.*}}!dbg !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
10+
// CHECK: start:
11+
// CHECK: [[TT:%.+]] = call i1 @llvm.type.test(ptr {{%f|%0}}, metadata !"{{[[:print:]]+}}"), !dbg !{{[0-9]+}}
12+
// CHECK-NEXT: br i1 [[TT]], label %type_test.pass, label %type_test.fail, !dbg !{{[0-9]+}}
13+
// CHECK: type_test.pass: ; preds = %start
14+
// CHECK-NEXT: {{%.+}} = call i32 %f(i32{{.*}} %arg), !dbg !{{[0-9]+}}
15+
// CHECK: type_test.fail: ; preds = %start
16+
// CHECK-NEXT: call void @llvm.trap(), !dbg !{{[0-9]+}}
17+
// CHECK-NEXT: unreachable, !dbg !{{[0-9]+}}
18+
f(arg)
19+
}

triagebot.toml

+7-1
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,11 @@ docs = [
10321032
"@ehuss",
10331033
"@GuillaumeGomez",
10341034
]
1035+
1036+
codegen = [
1037+
"@saethlin",
1038+
"@workingjubilee",
1039+
]
10351040
query-system = [
10361041
"@cjgillot",
10371042
]
@@ -1127,6 +1132,7 @@ project-exploit-mitigations = [
11271132
"/Cargo.lock" = ["@Mark-Simulacrum"]
11281133
"/Cargo.toml" = ["@Mark-Simulacrum"]
11291134
"/compiler" = ["compiler"]
1135+
"/compiler/rustc_abi" = ["compiler", "codegen"]
11301136
"/compiler/rustc_arena" = ["compiler", "arena"]
11311137
"/compiler/rustc_ast" = ["compiler", "parser"]
11321138
"/compiler/rustc_ast_lowering" = ["compiler", "ast_lowering"]
@@ -1137,7 +1143,7 @@ project-exploit-mitigations = [
11371143
"/compiler/rustc_lexer" = ["compiler", "lexer"]
11381144
"/compiler/rustc_llvm" = ["@cuviper"]
11391145
"/compiler/rustc_codegen_llvm/src/debuginfo" = ["compiler", "debuginfo"]
1140-
"/compiler/rustc_codegen_ssa" = ["compiler", "@saethlin"]
1146+
"/compiler/rustc_codegen_ssa" = ["compiler", "codegen"]
11411147
"/compiler/rustc_middle/src/mir" = ["compiler", "mir"]
11421148
"/compiler/rustc_middle/src/traits" = ["compiler", "types"]
11431149
"/compiler/rustc_middle/src/ty" = ["compiler", "types"]

0 commit comments

Comments
 (0)