Auto merge of #115204 - matthiaskrgr:rollup-avsp3t3, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #114754 (Name what ln_gamma does) - #115081 (Allow overwriting ExpnId for concurrent decoding) - #115151 (Fix CFI: f32 and f64 are encoded incorrectly for cross-language CFI) - #115169 (remove some unnecessary ignore-debug clauses) - #115190 (Add comment to the push_trailing function) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
4535d33e33
20 changed files with 53 additions and 34 deletions
|
@ -197,8 +197,14 @@ impl CodeSuggestion {
|
||||||
|
|
||||||
use rustc_span::{CharPos, Pos};
|
use rustc_span::{CharPos, Pos};
|
||||||
|
|
||||||
/// Append to a buffer the remainder of the line of existing source code, and return the
|
/// Extracts a substring from the provided `line_opt` based on the specified low and high indices,
|
||||||
/// count of lines that have been added for accurate highlighting.
|
/// appends it to the given buffer `buf`, and returns the count of newline characters in the substring
|
||||||
|
/// for accurate highlighting.
|
||||||
|
/// If `line_opt` is `None`, a newline character is appended to the buffer, and 0 is returned.
|
||||||
|
///
|
||||||
|
/// ## Returns
|
||||||
|
///
|
||||||
|
/// The count of newline characters in the extracted substring.
|
||||||
fn push_trailing(
|
fn push_trailing(
|
||||||
buf: &mut String,
|
buf: &mut String,
|
||||||
line_opt: Option<&Cow<'_, str>>,
|
line_opt: Option<&Cow<'_, str>>,
|
||||||
|
@ -206,22 +212,30 @@ impl CodeSuggestion {
|
||||||
hi_opt: Option<&Loc>,
|
hi_opt: Option<&Loc>,
|
||||||
) -> usize {
|
) -> usize {
|
||||||
let mut line_count = 0;
|
let mut line_count = 0;
|
||||||
|
// Convert CharPos to Usize, as CharPose is character offset
|
||||||
|
// Extract low index and high index
|
||||||
let (lo, hi_opt) = (lo.col.to_usize(), hi_opt.map(|hi| hi.col.to_usize()));
|
let (lo, hi_opt) = (lo.col.to_usize(), hi_opt.map(|hi| hi.col.to_usize()));
|
||||||
if let Some(line) = line_opt {
|
if let Some(line) = line_opt {
|
||||||
if let Some(lo) = line.char_indices().map(|(i, _)| i).nth(lo) {
|
if let Some(lo) = line.char_indices().map(|(i, _)| i).nth(lo) {
|
||||||
|
// Get high index while account for rare unicode and emoji with char_indices
|
||||||
let hi_opt = hi_opt.and_then(|hi| line.char_indices().map(|(i, _)| i).nth(hi));
|
let hi_opt = hi_opt.and_then(|hi| line.char_indices().map(|(i, _)| i).nth(hi));
|
||||||
match hi_opt {
|
match hi_opt {
|
||||||
|
// If high index exist, take string from low to high index
|
||||||
Some(hi) if hi > lo => {
|
Some(hi) if hi > lo => {
|
||||||
|
// count how many '\n' exist
|
||||||
line_count = line[lo..hi].matches('\n').count();
|
line_count = line[lo..hi].matches('\n').count();
|
||||||
buf.push_str(&line[lo..hi])
|
buf.push_str(&line[lo..hi])
|
||||||
}
|
}
|
||||||
Some(_) => (),
|
Some(_) => (),
|
||||||
|
// If high index absence, take string from low index till end string.len
|
||||||
None => {
|
None => {
|
||||||
|
// count how many '\n' exist
|
||||||
line_count = line[lo..].matches('\n').count();
|
line_count = line[lo..].matches('\n').count();
|
||||||
buf.push_str(&line[lo..])
|
buf.push_str(&line[lo..])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// If high index is None
|
||||||
if hi_opt.is_none() {
|
if hi_opt.is_none() {
|
||||||
buf.push('\n');
|
buf.push('\n');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1291,11 +1291,11 @@ pub fn register_expn_id(
|
||||||
let expn_id = ExpnId { krate, local_id };
|
let expn_id = ExpnId { krate, local_id };
|
||||||
HygieneData::with(|hygiene_data| {
|
HygieneData::with(|hygiene_data| {
|
||||||
let _old_data = hygiene_data.foreign_expn_data.insert(expn_id, data);
|
let _old_data = hygiene_data.foreign_expn_data.insert(expn_id, data);
|
||||||
debug_assert!(_old_data.is_none());
|
debug_assert!(_old_data.is_none() || cfg!(parallel_compiler));
|
||||||
let _old_hash = hygiene_data.foreign_expn_hashes.insert(expn_id, hash);
|
let _old_hash = hygiene_data.foreign_expn_hashes.insert(expn_id, hash);
|
||||||
debug_assert!(_old_hash.is_none());
|
debug_assert!(_old_hash.is_none() || _old_hash == Some(hash));
|
||||||
let _old_id = hygiene_data.expn_hash_to_expn_id.insert(hash, expn_id);
|
let _old_id = hygiene_data.expn_hash_to_expn_id.insert(hash, expn_id);
|
||||||
debug_assert!(_old_id.is_none());
|
debug_assert!(_old_id.is_none() || _old_id == Some(expn_id));
|
||||||
});
|
});
|
||||||
expn_id
|
expn_id
|
||||||
}
|
}
|
||||||
|
|
|
@ -447,7 +447,7 @@ fn encode_ty<'tcx>(
|
||||||
typeid.push('b');
|
typeid.push('b');
|
||||||
}
|
}
|
||||||
|
|
||||||
ty::Int(..) | ty::Uint(..) | ty::Float(..) => {
|
ty::Int(..) | ty::Uint(..) => {
|
||||||
// u<length><type-name> as vendor extended type
|
// u<length><type-name> as vendor extended type
|
||||||
let mut s = String::from(match ty.kind() {
|
let mut s = String::from(match ty.kind() {
|
||||||
ty::Int(IntTy::I8) => "u2i8",
|
ty::Int(IntTy::I8) => "u2i8",
|
||||||
|
@ -462,14 +462,23 @@ fn encode_ty<'tcx>(
|
||||||
ty::Uint(UintTy::U64) => "u3u64",
|
ty::Uint(UintTy::U64) => "u3u64",
|
||||||
ty::Uint(UintTy::U128) => "u4u128",
|
ty::Uint(UintTy::U128) => "u4u128",
|
||||||
ty::Uint(UintTy::Usize) => "u5usize",
|
ty::Uint(UintTy::Usize) => "u5usize",
|
||||||
ty::Float(FloatTy::F32) => "u3f32",
|
_ => bug!("encode_ty: unexpected `{:?}`", ty.kind()),
|
||||||
ty::Float(FloatTy::F64) => "u3f64",
|
|
||||||
_ => "",
|
|
||||||
});
|
});
|
||||||
compress(dict, DictKey::Ty(ty, TyQ::None), &mut s);
|
compress(dict, DictKey::Ty(ty, TyQ::None), &mut s);
|
||||||
typeid.push_str(&s);
|
typeid.push_str(&s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rust's f32 and f64 single (32-bit) and double (64-bit) precision floating-point types
|
||||||
|
// have IEEE-754 binary32 and binary64 floating-point layouts, respectively.
|
||||||
|
//
|
||||||
|
// (See https://rust-lang.github.io/unsafe-code-guidelines/layout/scalars.html#fixed-width-floating-point-types.)
|
||||||
|
ty::Float(float_ty) => {
|
||||||
|
typeid.push(match float_ty {
|
||||||
|
FloatTy::F32 => 'f',
|
||||||
|
FloatTy::F64 => 'd',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
ty::Char => {
|
ty::Char => {
|
||||||
// u4char as vendor extended type
|
// u4char as vendor extended type
|
||||||
let mut s = String::from("u4char");
|
let mut s = String::from("u4char");
|
||||||
|
|
|
@ -989,7 +989,9 @@ impl f32 {
|
||||||
unsafe { cmath::tgammaf(self) }
|
unsafe { cmath::tgammaf(self) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the natural logarithm of the gamma function.
|
/// Natural logarithm of the absolute value of the gamma function
|
||||||
|
///
|
||||||
|
/// The integer part of the tuple indicates the sign of the gamma function.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
|
|
|
@ -989,7 +989,9 @@ impl f64 {
|
||||||
unsafe { cmath::tgamma(self) }
|
unsafe { cmath::tgamma(self) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the natural logarithm of the gamma function.
|
/// Natural logarithm of the absolute value of the gamma function
|
||||||
|
///
|
||||||
|
/// The integer part of the tuple indicates the sign of the gamma function.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
|
|
|
@ -500,12 +500,12 @@ pub fn foo149(_: Type14<Bar>, _: Type14<Bar>, _: Type14<Bar>) { }
|
||||||
// CHECK: ![[TYPE45]] = !{i64 0, !"_ZTSFvu5usizeE"}
|
// CHECK: ![[TYPE45]] = !{i64 0, !"_ZTSFvu5usizeE"}
|
||||||
// CHECK: ![[TYPE46]] = !{i64 0, !"_ZTSFvu5usizeS_E"}
|
// CHECK: ![[TYPE46]] = !{i64 0, !"_ZTSFvu5usizeS_E"}
|
||||||
// CHECK: ![[TYPE47]] = !{i64 0, !"_ZTSFvu5usizeS_S_E"}
|
// CHECK: ![[TYPE47]] = !{i64 0, !"_ZTSFvu5usizeS_S_E"}
|
||||||
// CHECK: ![[TYPE48]] = !{i64 0, !"_ZTSFvu3f32E"}
|
// CHECK: ![[TYPE48]] = !{i64 0, !"_ZTSFvfE"}
|
||||||
// CHECK: ![[TYPE49]] = !{i64 0, !"_ZTSFvu3f32S_E"}
|
// CHECK: ![[TYPE49]] = !{i64 0, !"_ZTSFvffE"}
|
||||||
// CHECK: ![[TYPE50]] = !{i64 0, !"_ZTSFvu3f32S_S_E"}
|
// CHECK: ![[TYPE50]] = !{i64 0, !"_ZTSFvfffE"}
|
||||||
// CHECK: ![[TYPE51]] = !{i64 0, !"_ZTSFvu3f64E"}
|
// CHECK: ![[TYPE51]] = !{i64 0, !"_ZTSFvdE"}
|
||||||
// CHECK: ![[TYPE52]] = !{i64 0, !"_ZTSFvu3f64S_E"}
|
// CHECK: ![[TYPE52]] = !{i64 0, !"_ZTSFvddE"}
|
||||||
// CHECK: ![[TYPE53]] = !{i64 0, !"_ZTSFvu3f64S_S_E"}
|
// CHECK: ![[TYPE53]] = !{i64 0, !"_ZTSFvdddE"}
|
||||||
// CHECK: ![[TYPE54]] = !{i64 0, !"_ZTSFvu4charE"}
|
// CHECK: ![[TYPE54]] = !{i64 0, !"_ZTSFvu4charE"}
|
||||||
// CHECK: ![[TYPE55]] = !{i64 0, !"_ZTSFvu4charS_E"}
|
// CHECK: ![[TYPE55]] = !{i64 0, !"_ZTSFvu4charS_E"}
|
||||||
// CHECK: ![[TYPE56]] = !{i64 0, !"_ZTSFvu4charS_S_E"}
|
// CHECK: ![[TYPE56]] = !{i64 0, !"_ZTSFvu4charS_S_E"}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
|
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
|
||||||
// ignore-debug
|
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
|
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
|
||||||
// needs-unwind
|
// needs-unwind
|
||||||
// ignore-debug
|
|
||||||
// only-x86_64
|
// only-x86_64
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
|
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
|
||||||
// only-64bit
|
// only-64bit
|
||||||
// ignore-debug
|
|
||||||
|
|
||||||
// Checks that we do not have any branches in the MIR for the two tested functions.
|
// Checks that we do not have any branches in the MIR for the two tested functions.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// compile-flags: -O -Zmir-opt-level=2 -g
|
// compile-flags: -O -Zmir-opt-level=2 -g
|
||||||
// needs-unwind
|
// needs-unwind
|
||||||
// ignore-debug
|
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
|
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
|
||||||
// only-64bit
|
// only-64bit
|
||||||
// ignore-debug
|
// ignore-debug the standard library debug assertions leak into this test
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
|
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
|
||||||
// only-64bit
|
// only-64bit
|
||||||
// ignore-debug
|
|
||||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
fn ezmap(_1: Option<i32>) -> Option<i32> {
|
fn ezmap(_1: Option<i32>) -> Option<i32> {
|
||||||
debug x => _1;
|
debug x => _1;
|
||||||
let mut _0: std::option::Option<i32>;
|
let mut _0: std::option::Option<i32>;
|
||||||
scope 1 (inlined map::<i32, i32, [closure@$DIR/simple_option_map.rs:18:12: 18:15]>) {
|
scope 1 (inlined map::<i32, i32, [closure@$DIR/simple_option_map.rs:17:12: 17:15]>) {
|
||||||
debug slf => _1;
|
debug slf => _1;
|
||||||
debug f => const ZeroSized: [closure@$DIR/simple_option_map.rs:18:12: 18:15];
|
debug f => const ZeroSized: [closure@$DIR/simple_option_map.rs:17:12: 17:15];
|
||||||
let mut _2: isize;
|
let mut _2: isize;
|
||||||
let _3: i32;
|
let _3: i32;
|
||||||
let mut _4: i32;
|
let mut _4: i32;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
|
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
|
||||||
// only-64bit
|
// only-64bit
|
||||||
// ignore-debug
|
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn map<T, U, F>(slf: Option<T>, f: F) -> Option<U>
|
fn map<T, U, F>(slf: Option<T>, f: F) -> Option<U>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
|
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
|
||||||
// only-64bit
|
// only-64bit
|
||||||
// ignore-debug
|
// ignore-debug the standard library debug assertions leak into this test
|
||||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
|
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
|
||||||
// only-64bit
|
// only-64bit
|
||||||
// ignore-debug
|
// ignore-debug the standard library debug assertions leak into this test
|
||||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
|
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
|
||||||
// only-64bit
|
// only-64bit
|
||||||
// ignore-debug
|
|
||||||
|
|
||||||
// Track the status of MIR optimizations simplifying `Ok(res?)` for both the old and new desugarings
|
// Track the status of MIR optimizations simplifying `Ok(res?)` for both the old and new desugarings
|
||||||
// of that syntax.
|
// of that syntax.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0080]: it is undefined behavior to use this value
|
error[E0080]: it is undefined behavior to use this value
|
||||||
--> $DIR/alloc.rs:12:1
|
--> $DIR/alloc.rs:11:1
|
||||||
|
|
|
|
||||||
LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) };
|
LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x00000000, but expected a valid enum tag
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x00000000, but expected a valid enum tag
|
||||||
|
@ -10,7 +10,7 @@ LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchec
|
||||||
}
|
}
|
||||||
|
|
||||||
error[E0080]: it is undefined behavior to use this value
|
error[E0080]: it is undefined behavior to use this value
|
||||||
--> $DIR/alloc.rs:16:1
|
--> $DIR/alloc.rs:15:1
|
||||||
|
|
|
|
||||||
LL | const LAYOUT_INVALID_THREE: Layout = unsafe { Layout::from_size_align_unchecked(9, 3) };
|
LL | const LAYOUT_INVALID_THREE: Layout = unsafe { Layout::from_size_align_unchecked(9, 3) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x00000003, but expected a valid enum tag
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x00000003, but expected a valid enum tag
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0080]: it is undefined behavior to use this value
|
error[E0080]: it is undefined behavior to use this value
|
||||||
--> $DIR/alloc.rs:12:1
|
--> $DIR/alloc.rs:11:1
|
||||||
|
|
|
|
||||||
LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) };
|
LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag
|
||||||
|
@ -10,7 +10,7 @@ LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchec
|
||||||
}
|
}
|
||||||
|
|
||||||
error[E0080]: it is undefined behavior to use this value
|
error[E0080]: it is undefined behavior to use this value
|
||||||
--> $DIR/alloc.rs:16:1
|
--> $DIR/alloc.rs:15:1
|
||||||
|
|
|
|
||||||
LL | const LAYOUT_INVALID_THREE: Layout = unsafe { Layout::from_size_align_unchecked(9, 3) };
|
LL | const LAYOUT_INVALID_THREE: Layout = unsafe { Layout::from_size_align_unchecked(9, 3) };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x0000000000000003, but expected a valid enum tag
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x0000000000000003, but expected a valid enum tag
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
// stderr-per-bitwidth
|
// stderr-per-bitwidth
|
||||||
// ignore-debug (the debug assertions change the error)
|
|
||||||
// Strip out raw byte dumps to make comparison platform-independent:
|
// Strip out raw byte dumps to make comparison platform-independent:
|
||||||
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
|
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
|
||||||
// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
|
// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue