mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Auto merge of #135202 - GuillaumeGomez:rollup-9xgs39t, r=GuillaumeGomez
Rollup of 9 pull requests Successful merges: - #135081 (bootstrap: Build jemalloc with support for 64K pages) - #135174 ([AIX] Port test case run-make/reproducible-build ) - #135177 (llvm: Ignore error value that is always false) - #135182 (Transmute from NonNull to pointer when elaborating a box deref (MCP807)) - #135187 (apply a workaround fix for the release roadblock) - #135189 (Remove workaround from pull request template) - #135193 (don't bless `proc_macro_deps.rs` unless it's necessary) - #135198 (Avoid naming variables `str`) - #135199 (Eliminate an unnecessary `Symbol::to_string`; use `as_str`) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
ad211ced81
2
.github/pull_request_template.md
vendored
2
.github/pull_request_template.md
vendored
@ -7,6 +7,6 @@ tracking issue or there are none, feel free to ignore this.
|
||||
This PR will get automatically assigned to a reviewer. In case you would like
|
||||
a specific user to review your work, you can assign it to them by using
|
||||
|
||||
r\? <reviewer name> (with the `\` removed)
|
||||
r? <reviewer name>
|
||||
-->
|
||||
<!-- homu-ignore:end -->
|
||||
|
@ -544,12 +544,12 @@ fn pretty_print_region_elements(elements: impl IntoIterator<Item = RegionElement
|
||||
|
||||
return result;
|
||||
|
||||
fn push_location_range(str: &mut String, location1: Location, location2: Location) {
|
||||
fn push_location_range(s: &mut String, location1: Location, location2: Location) {
|
||||
if location1 == location2 {
|
||||
str.push_str(&format!("{location1:?}"));
|
||||
s.push_str(&format!("{location1:?}"));
|
||||
} else {
|
||||
assert_eq!(location1.block, location2.block);
|
||||
str.push_str(&format!(
|
||||
s.push_str(&format!(
|
||||
"{:?}[{}..={}]",
|
||||
location1.block, location1.statement_index, location2.statement_index
|
||||
));
|
||||
|
@ -660,9 +660,7 @@ pub unsafe fn optimize_thin_module(
|
||||
{
|
||||
let _timer =
|
||||
cgcx.prof.generic_activity_with_arg("LLVM_thin_lto_rename", thin_module.name());
|
||||
if !llvm::LLVMRustPrepareThinLTORename(thin_module.shared.data.0, llmod, target) {
|
||||
return Err(write::llvm_err(&dcx, LlvmError::PrepareThinLtoModule));
|
||||
}
|
||||
unsafe { llvm::LLVMRustPrepareThinLTORename(thin_module.shared.data.0, llmod, target) };
|
||||
save_temp_bitcode(cgcx, &module, "thin-lto-after-rename");
|
||||
}
|
||||
|
||||
|
@ -737,11 +737,7 @@ pub(crate) unsafe fn optimize_thin_module(
|
||||
{
|
||||
let _timer =
|
||||
cgcx.prof.generic_activity_with_arg("LLVM_thin_lto_rename", thin_module.name());
|
||||
if unsafe {
|
||||
!llvm::LLVMRustPrepareThinLTORename(thin_module.shared.data.0, llmod, target)
|
||||
} {
|
||||
return Err(write::llvm_err(dcx, LlvmError::PrepareThinLtoModule));
|
||||
}
|
||||
unsafe { llvm::LLVMRustPrepareThinLTORename(thin_module.shared.data.0, llmod, target) };
|
||||
save_temp_bitcode(cgcx, &module, "thin-lto-after-rename");
|
||||
}
|
||||
|
||||
|
@ -2374,7 +2374,7 @@ unsafe extern "C" {
|
||||
Data: &ThinLTOData,
|
||||
Module: &Module,
|
||||
Target: &TargetMachine,
|
||||
) -> bool;
|
||||
);
|
||||
pub fn LLVMRustPrepareThinLTOResolveWeak(Data: &ThinLTOData, Module: &Module) -> bool;
|
||||
pub fn LLVMRustPrepareThinLTOInternalize(Data: &ThinLTOData, Module: &Module) -> bool;
|
||||
pub fn LLVMRustPrepareThinLTOImport(
|
||||
|
@ -704,8 +704,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
||||
pub fn read_str(&self, mplace: &MPlaceTy<'tcx, M::Provenance>) -> InterpResult<'tcx, &str> {
|
||||
let len = mplace.len(self)?;
|
||||
let bytes = self.read_bytes_ptr_strip_provenance(mplace.ptr(), Size::from_bytes(len))?;
|
||||
let str = std::str::from_utf8(bytes).map_err(|err| err_ub!(InvalidStr(err)))?;
|
||||
interp_ok(str)
|
||||
let s = std::str::from_utf8(bytes).map_err(|err| err_ub!(InvalidStr(err)))?;
|
||||
interp_ok(s)
|
||||
}
|
||||
|
||||
/// Read from a local of the current frame. Convenience method for [`InterpCx::local_at_frame_to_op`].
|
||||
|
@ -1017,9 +1017,9 @@ where
|
||||
/// This is allocated in immutable global memory and deduplicated.
|
||||
pub fn allocate_str_dedup(
|
||||
&mut self,
|
||||
str: &str,
|
||||
s: &str,
|
||||
) -> InterpResult<'tcx, MPlaceTy<'tcx, M::Provenance>> {
|
||||
let bytes = str.as_bytes();
|
||||
let bytes = s.as_bytes();
|
||||
let ptr = self.allocate_bytes_dedup(bytes)?;
|
||||
|
||||
// Create length metadata for the string.
|
||||
|
@ -234,10 +234,10 @@ declare_lint! {
|
||||
declare_lint_pass!(NonSnakeCase => [NON_SNAKE_CASE]);
|
||||
|
||||
impl NonSnakeCase {
|
||||
fn to_snake_case(mut str: &str) -> String {
|
||||
fn to_snake_case(mut name: &str) -> String {
|
||||
let mut words = vec![];
|
||||
// Preserve leading underscores
|
||||
str = str.trim_start_matches(|c: char| {
|
||||
name = name.trim_start_matches(|c: char| {
|
||||
if c == '_' {
|
||||
words.push(String::new());
|
||||
true
|
||||
@ -245,7 +245,7 @@ impl NonSnakeCase {
|
||||
false
|
||||
}
|
||||
});
|
||||
for s in str.split('_') {
|
||||
for s in name.split('_') {
|
||||
let mut last_upper = false;
|
||||
let mut buf = String::new();
|
||||
if s.is_empty() {
|
||||
|
@ -1389,20 +1389,14 @@ static bool clearDSOLocalOnDeclarations(Module &Mod, TargetMachine &TM) {
|
||||
return ClearDSOLocalOnDeclarations;
|
||||
}
|
||||
|
||||
extern "C" bool LLVMRustPrepareThinLTORename(const LLVMRustThinLTOData *Data,
|
||||
extern "C" void LLVMRustPrepareThinLTORename(const LLVMRustThinLTOData *Data,
|
||||
LLVMModuleRef M,
|
||||
LLVMTargetMachineRef TM) {
|
||||
Module &Mod = *unwrap(M);
|
||||
TargetMachine &Target = *unwrap(TM);
|
||||
|
||||
bool ClearDSOLocal = clearDSOLocalOnDeclarations(Mod, Target);
|
||||
bool error = renameModuleForThinLTO(Mod, Data->Index, ClearDSOLocal);
|
||||
|
||||
if (error) {
|
||||
LLVMRustSetLastError("renameModuleForThinLTO failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
renameModuleForThinLTO(Mod, Data->Index, ClearDSOLocal);
|
||||
}
|
||||
|
||||
extern "C" bool
|
||||
|
@ -130,11 +130,11 @@ pub fn init_logger(cfg: LoggerConfig) -> Result<(), Error> {
|
||||
|
||||
let subscriber = tracing_subscriber::Registry::default().with(filter).with(layer);
|
||||
match cfg.backtrace {
|
||||
Ok(str) => {
|
||||
Ok(backtrace_target) => {
|
||||
let fmt_layer = tracing_subscriber::fmt::layer()
|
||||
.with_writer(io::stderr)
|
||||
.without_time()
|
||||
.event_format(BacktraceFormatter { backtrace_target: str });
|
||||
.event_format(BacktraceFormatter { backtrace_target });
|
||||
let subscriber = subscriber.with(fmt_layer);
|
||||
tracing::subscriber::set_global_default(subscriber).unwrap();
|
||||
}
|
||||
|
@ -156,14 +156,14 @@ impl Entries {
|
||||
Entries { map: HashMap::with_capacity(capacity) }
|
||||
}
|
||||
|
||||
fn insert(&mut self, span: Span, str: &str, errors: &mut Errors) -> u32 {
|
||||
if let Some(prev) = self.map.get(str) {
|
||||
errors.error(span, format!("Symbol `{str}` is duplicated"));
|
||||
fn insert(&mut self, span: Span, s: &str, errors: &mut Errors) -> u32 {
|
||||
if let Some(prev) = self.map.get(s) {
|
||||
errors.error(span, format!("Symbol `{s}` is duplicated"));
|
||||
errors.error(prev.span_of_name, "location of previous definition".to_string());
|
||||
prev.idx
|
||||
} else {
|
||||
let idx = self.len();
|
||||
self.map.insert(str.to_string(), Preinterned { idx, span_of_name: span });
|
||||
self.map.insert(s.to_string(), Preinterned { idx, span_of_name: span });
|
||||
idx
|
||||
}
|
||||
}
|
||||
@ -192,14 +192,14 @@ fn symbols_with_errors(input: TokenStream) -> (TokenStream, Vec<syn::Error>) {
|
||||
let mut entries = Entries::with_capacity(input.keywords.len() + input.symbols.len() + 10);
|
||||
let mut prev_key: Option<(Span, String)> = None;
|
||||
|
||||
let mut check_order = |span: Span, str: &str, errors: &mut Errors| {
|
||||
let mut check_order = |span: Span, s: &str, errors: &mut Errors| {
|
||||
if let Some((prev_span, ref prev_str)) = prev_key {
|
||||
if str < prev_str {
|
||||
errors.error(span, format!("Symbol `{str}` must precede `{prev_str}`"));
|
||||
if s < prev_str {
|
||||
errors.error(span, format!("Symbol `{s}` must precede `{prev_str}`"));
|
||||
errors.error(prev_span, format!("location of previous symbol `{prev_str}`"));
|
||||
}
|
||||
}
|
||||
prev_key = Some((span, str.to_string()));
|
||||
prev_key = Some((span, s.to_string()));
|
||||
};
|
||||
|
||||
// Generate the listed keywords.
|
||||
|
@ -29,13 +29,8 @@ fn build_ptr_tys<'tcx>(
|
||||
pub(super) fn build_projection<'tcx>(
|
||||
unique_ty: Ty<'tcx>,
|
||||
nonnull_ty: Ty<'tcx>,
|
||||
ptr_ty: Ty<'tcx>,
|
||||
) -> [PlaceElem<'tcx>; 3] {
|
||||
[
|
||||
PlaceElem::Field(FieldIdx::ZERO, unique_ty),
|
||||
PlaceElem::Field(FieldIdx::ZERO, nonnull_ty),
|
||||
PlaceElem::Field(FieldIdx::ZERO, ptr_ty),
|
||||
]
|
||||
) -> [PlaceElem<'tcx>; 2] {
|
||||
[PlaceElem::Field(FieldIdx::ZERO, unique_ty), PlaceElem::Field(FieldIdx::ZERO, nonnull_ty)]
|
||||
}
|
||||
|
||||
struct ElaborateBoxDerefVisitor<'a, 'tcx> {
|
||||
@ -75,10 +70,14 @@ impl<'a, 'tcx> MutVisitor<'tcx> for ElaborateBoxDerefVisitor<'a, 'tcx> {
|
||||
self.patch.add_assign(
|
||||
location,
|
||||
Place::from(ptr_local),
|
||||
Rvalue::Use(Operand::Copy(
|
||||
Place::from(place.local)
|
||||
.project_deeper(&build_projection(unique_ty, nonnull_ty, ptr_ty), tcx),
|
||||
)),
|
||||
Rvalue::Cast(
|
||||
CastKind::Transmute,
|
||||
Operand::Copy(
|
||||
Place::from(place.local)
|
||||
.project_deeper(&build_projection(unique_ty, nonnull_ty), tcx),
|
||||
),
|
||||
ptr_ty,
|
||||
),
|
||||
);
|
||||
|
||||
place.local = ptr_local;
|
||||
@ -133,8 +132,10 @@ impl<'tcx> crate::MirPass<'tcx> for ElaborateBoxDerefs {
|
||||
let (unique_ty, nonnull_ty, ptr_ty) =
|
||||
build_ptr_tys(tcx, boxed_ty, unique_did, nonnull_did);
|
||||
|
||||
new_projections
|
||||
.extend_from_slice(&build_projection(unique_ty, nonnull_ty, ptr_ty));
|
||||
new_projections.extend_from_slice(&build_projection(unique_ty, nonnull_ty));
|
||||
// While we can't project into `NonNull<_>` in a basic block
|
||||
// due to MCP#807, this is debug info where it's fine.
|
||||
new_projections.push(PlaceElem::Field(FieldIdx::ZERO, ptr_ty));
|
||||
new_projections.push(PlaceElem::Deref);
|
||||
} else if let Some(new_projections) = new_projections.as_mut() {
|
||||
// Keep building up our projections list once we've started it.
|
||||
|
@ -448,10 +448,9 @@ pub(crate) fn encode_ty<'tcx>(
|
||||
if let Some(cfi_encoding) = tcx.get_attr(def_id, sym::cfi_encoding) {
|
||||
// Use user-defined CFI encoding for type
|
||||
if let Some(value_str) = cfi_encoding.value_str() {
|
||||
let value_str = value_str.to_string();
|
||||
let str = value_str.trim();
|
||||
if !str.is_empty() {
|
||||
s.push_str(str);
|
||||
let value_str = value_str.as_str().trim();
|
||||
if !value_str.is_empty() {
|
||||
s.push_str(value_str);
|
||||
// Don't compress user-defined builtin types (see
|
||||
// https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-builtin and
|
||||
// https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-compression).
|
||||
@ -459,7 +458,7 @@ pub(crate) fn encode_ty<'tcx>(
|
||||
"v", "w", "b", "c", "a", "h", "s", "t", "i", "j", "l", "m", "x", "y",
|
||||
"n", "o", "f", "d", "e", "g", "z", "Dh",
|
||||
];
|
||||
if !builtin_types.contains(&str) {
|
||||
if !builtin_types.contains(&value_str) {
|
||||
compress(dict, DictKey::Ty(ty, TyQ::None), &mut s);
|
||||
}
|
||||
} else {
|
||||
|
@ -1283,13 +1283,13 @@ impl fmt::Debug for Output {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let stdout_utf8 = str::from_utf8(&self.stdout);
|
||||
let stdout_debug: &dyn fmt::Debug = match stdout_utf8 {
|
||||
Ok(ref str) => str,
|
||||
Ok(ref s) => s,
|
||||
Err(_) => &self.stdout,
|
||||
};
|
||||
|
||||
let stderr_utf8 = str::from_utf8(&self.stderr);
|
||||
let stderr_debug: &dyn fmt::Debug = match stderr_utf8 {
|
||||
Ok(ref str) => str,
|
||||
Ok(ref s) => s,
|
||||
Err(_) => &self.stderr,
|
||||
};
|
||||
|
||||
|
@ -142,11 +142,11 @@ impl AsRef<OsStr> for EnvKey {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn ensure_no_nuls<T: AsRef<OsStr>>(str: T) -> io::Result<T> {
|
||||
if str.as_ref().encode_wide().any(|b| b == 0) {
|
||||
pub(crate) fn ensure_no_nuls<T: AsRef<OsStr>>(s: T) -> io::Result<T> {
|
||||
if s.as_ref().encode_wide().any(|b| b == 0) {
|
||||
Err(io::const_error!(ErrorKind::InvalidInput, "nul byte found in provided data"))
|
||||
} else {
|
||||
Ok(str)
|
||||
Ok(s)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,8 +204,8 @@ impl Wtf8Buf {
|
||||
///
|
||||
/// Since WTF-8 is a superset of UTF-8, this always succeeds.
|
||||
#[inline]
|
||||
pub fn from_str(str: &str) -> Wtf8Buf {
|
||||
Wtf8Buf { bytes: <[_]>::to_vec(str.as_bytes()), is_known_utf8: true }
|
||||
pub fn from_str(s: &str) -> Wtf8Buf {
|
||||
Wtf8Buf { bytes: <[_]>::to_vec(s.as_bytes()), is_known_utf8: true }
|
||||
}
|
||||
|
||||
pub fn clear(&mut self) {
|
||||
|
@ -1207,6 +1207,15 @@ pub fn rustc_cargo_env(
|
||||
rustc_llvm_env(builder, cargo, target)
|
||||
}
|
||||
}
|
||||
|
||||
// Build jemalloc on AArch64 with support for page sizes up to 64K
|
||||
// See: https://github.com/rust-lang/rust/pull/135081
|
||||
if builder.config.jemalloc
|
||||
&& target.starts_with("aarch64")
|
||||
&& env::var_os("JEMALLOC_SYS_WITH_LG_PAGE").is_none()
|
||||
{
|
||||
cargo.env("JEMALLOC_SYS_WITH_LG_PAGE", "16");
|
||||
}
|
||||
}
|
||||
|
||||
/// Pass down configuration from the LLVM build into the build of
|
||||
|
@ -129,8 +129,19 @@ pub fn get_closest_merge_commit(
|
||||
git.current_dir(git_dir);
|
||||
}
|
||||
|
||||
let channel = include_str!("../../ci/channel");
|
||||
|
||||
let merge_base = {
|
||||
if CiEnv::is_ci() {
|
||||
if CiEnv::is_ci() &&
|
||||
// FIXME: When running on rust-lang managed CI and it's not a nightly build,
|
||||
// `git_upstream_merge_base` fails with an error message similar to this:
|
||||
// ```
|
||||
// called `Result::unwrap()` on an `Err` value: "command did not execute successfully:
|
||||
// cd \"/checkout\" && \"git\" \"merge-base\" \"origin/master\" \"HEAD\"\nexpected success, got: exit status: 1\n"
|
||||
// ```
|
||||
// Investigate and resolve this issue instead of skipping it like this.
|
||||
(channel == "nightly" || !CiEnv::is_rust_lang_managed_ci_job())
|
||||
{
|
||||
git_upstream_merge_base(config, git_dir).unwrap()
|
||||
} else {
|
||||
// For non-CI environments, ignore rust-lang/rust upstream as it usually gets
|
||||
|
@ -31,7 +31,7 @@ pub fn make_diff(expected: &str, actual: &str, context_size: usize) -> Vec<Misma
|
||||
|
||||
for result in diff::lines(expected, actual) {
|
||||
match result {
|
||||
diff::Result::Left(str) => {
|
||||
diff::Result::Left(s) => {
|
||||
if lines_since_mismatch >= context_size && lines_since_mismatch > 0 {
|
||||
results.push(mismatch);
|
||||
mismatch = Mismatch::new(line_number - context_queue.len() as u32);
|
||||
@ -41,11 +41,11 @@ pub fn make_diff(expected: &str, actual: &str, context_size: usize) -> Vec<Misma
|
||||
mismatch.lines.push(DiffLine::Context(line.to_owned()));
|
||||
}
|
||||
|
||||
mismatch.lines.push(DiffLine::Expected(str.to_owned()));
|
||||
mismatch.lines.push(DiffLine::Expected(s.to_owned()));
|
||||
line_number += 1;
|
||||
lines_since_mismatch = 0;
|
||||
}
|
||||
diff::Result::Right(str) => {
|
||||
diff::Result::Right(s) => {
|
||||
if lines_since_mismatch >= context_size && lines_since_mismatch > 0 {
|
||||
results.push(mismatch);
|
||||
mismatch = Mismatch::new(line_number - context_queue.len() as u32);
|
||||
@ -55,18 +55,18 @@ pub fn make_diff(expected: &str, actual: &str, context_size: usize) -> Vec<Misma
|
||||
mismatch.lines.push(DiffLine::Context(line.to_owned()));
|
||||
}
|
||||
|
||||
mismatch.lines.push(DiffLine::Resulting(str.to_owned()));
|
||||
mismatch.lines.push(DiffLine::Resulting(s.to_owned()));
|
||||
lines_since_mismatch = 0;
|
||||
}
|
||||
diff::Result::Both(str, _) => {
|
||||
diff::Result::Both(s, _) => {
|
||||
if context_queue.len() >= context_size {
|
||||
let _ = context_queue.pop_front();
|
||||
}
|
||||
|
||||
if lines_since_mismatch < context_size {
|
||||
mismatch.lines.push(DiffLine::Context(str.to_owned()));
|
||||
mismatch.lines.push(DiffLine::Context(s.to_owned()));
|
||||
} else if context_size > 0 {
|
||||
context_queue.push_back(str);
|
||||
context_queue.push_back(s);
|
||||
}
|
||||
|
||||
line_number += 1;
|
||||
|
@ -619,12 +619,17 @@ fn check_proc_macro_dep_list(root: &Path, cargo: &Path, bless: bool, bad: &mut b
|
||||
}
|
||||
// Remove the proc-macro crates themselves
|
||||
proc_macro_deps.retain(|pkg| !is_proc_macro_pkg(&metadata[pkg]));
|
||||
let proc_macro_deps_iter = proc_macro_deps.into_iter().map(|dep| metadata[dep].name.clone());
|
||||
|
||||
if bless {
|
||||
let mut proc_macro_deps: Vec<_> = proc_macro_deps_iter.collect();
|
||||
let proc_macro_deps: HashSet<_> =
|
||||
proc_macro_deps.into_iter().map(|dep| metadata[dep].name.clone()).collect();
|
||||
let expected = proc_macro_deps::CRATES.iter().map(|s| s.to_string()).collect::<HashSet<_>>();
|
||||
|
||||
let needs_blessing = proc_macro_deps.difference(&expected).next().is_some()
|
||||
|| expected.difference(&proc_macro_deps).next().is_some();
|
||||
|
||||
if needs_blessing && bless {
|
||||
let mut proc_macro_deps: Vec<_> = proc_macro_deps.into_iter().collect();
|
||||
proc_macro_deps.sort();
|
||||
proc_macro_deps.dedup();
|
||||
let mut file = File::create(root.join("src/bootstrap/src/utils/proc_macro_deps.rs"))
|
||||
.expect("`proc_macro_deps` should exist");
|
||||
writeln!(
|
||||
@ -646,10 +651,8 @@ pub static CRATES: &[&str] = &[
|
||||
)
|
||||
.unwrap();
|
||||
} else {
|
||||
let proc_macro_deps: HashSet<_> = proc_macro_deps_iter.collect();
|
||||
let expected =
|
||||
proc_macro_deps::CRATES.iter().map(|s| s.to_string()).collect::<HashSet<_>>();
|
||||
let old_bad = *bad;
|
||||
|
||||
for missing in proc_macro_deps.difference(&expected) {
|
||||
tidy_error!(
|
||||
bad,
|
||||
|
@ -7,7 +7,7 @@
|
||||
fn main() {
|
||||
// CHECK-LABEL: fn main(
|
||||
// CHECK: [[box:_.*]] = ShallowInitBox(
|
||||
// CHECK: [[ptr:_.*]] = copy ((([[box]].0: std::ptr::Unique<S>).0: std::ptr::NonNull<S>).0: *const S);
|
||||
// CHECK: [[ptr:_.*]] = copy (([[box]].0: std::ptr::Unique<S>).0: std::ptr::NonNull<S>) as *const S (Transmute);
|
||||
// CHECK: (*[[ptr]]) = S::new() -> [return: [[ret:bb.*]], unwind: [[unwind:bb.*]]];
|
||||
// CHECK: [[ret]]: {
|
||||
// CHECK: [[box2:_.*]] = move [[box]];
|
||||
|
@ -32,11 +32,11 @@
|
||||
bb1: {
|
||||
StorageLive(_7);
|
||||
_7 = ShallowInitBox(move _6, i32);
|
||||
_8 = copy (((_7.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32);
|
||||
_8 = copy ((_7.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>) as *const i32 (Transmute);
|
||||
(*_8) = const 42_i32;
|
||||
_3 = move _7;
|
||||
StorageDead(_7);
|
||||
_9 = copy (((_3.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32);
|
||||
_9 = copy ((_3.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>) as *const i32 (Transmute);
|
||||
_2 = copy (*_9);
|
||||
- _1 = Add(move _2, const 0_i32);
|
||||
- StorageDead(_2);
|
||||
|
@ -32,11 +32,11 @@
|
||||
bb1: {
|
||||
StorageLive(_7);
|
||||
_7 = ShallowInitBox(move _6, i32);
|
||||
_8 = copy (((_7.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32);
|
||||
_8 = copy ((_7.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>) as *const i32 (Transmute);
|
||||
(*_8) = const 42_i32;
|
||||
_3 = move _7;
|
||||
StorageDead(_7);
|
||||
_9 = copy (((_3.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32);
|
||||
_9 = copy ((_3.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>) as *const i32 (Transmute);
|
||||
_2 = copy (*_9);
|
||||
- _1 = Add(move _2, const 0_i32);
|
||||
- StorageDead(_2);
|
||||
|
@ -12,9 +12,9 @@
|
||||
bb0: {
|
||||
StorageLive(_1);
|
||||
- _1 = const 1_usize as std::boxed::Box<Never> (Transmute);
|
||||
- _2 = copy (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never);
|
||||
- _2 = copy ((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>) as *const Never (Transmute);
|
||||
+ _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global);
|
||||
+ _2 = const {0x1 as *const Never};
|
||||
+ _2 = const std::ptr::NonNull::<Never> {{ pointer: {0x1 as *const Never} }} as *const Never (Transmute);
|
||||
unreachable;
|
||||
}
|
||||
}
|
||||
|
@ -12,9 +12,9 @@
|
||||
bb0: {
|
||||
StorageLive(_1);
|
||||
- _1 = const 1_usize as std::boxed::Box<Never> (Transmute);
|
||||
- _2 = copy (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never);
|
||||
- _2 = copy ((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>) as *const Never (Transmute);
|
||||
+ _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global);
|
||||
+ _2 = const {0x1 as *const Never};
|
||||
+ _2 = const std::ptr::NonNull::<Never> {{ pointer: {0x1 as *const Never} }} as *const Never (Transmute);
|
||||
unreachable;
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
StorageLive(_1);
|
||||
- _1 = const 1_usize as std::boxed::Box<Never> (Transmute);
|
||||
+ _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global);
|
||||
_2 = copy (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never);
|
||||
_2 = copy ((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>) as *const Never (Transmute);
|
||||
unreachable;
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
StorageLive(_1);
|
||||
- _1 = const 1_usize as std::boxed::Box<Never> (Transmute);
|
||||
+ _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global);
|
||||
_2 = copy (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never);
|
||||
_2 = copy ((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>) as *const Never (Transmute);
|
||||
unreachable;
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_2 = copy (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never);
|
||||
_2 = copy ((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>) as *const Never (Transmute);
|
||||
PlaceMention((*_2));
|
||||
unreachable;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_2 = copy (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never);
|
||||
_2 = copy ((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>) as *const Never (Transmute);
|
||||
PlaceMention((*_2));
|
||||
unreachable;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ fn box_to_raw_mut(_1: &mut Box<i32>) -> *mut i32 {
|
||||
bb0: {
|
||||
Retag([fn entry] _1);
|
||||
_2 = deref_copy (*_1);
|
||||
_3 = copy (((_2.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32);
|
||||
_3 = copy ((_2.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>) as *const i32 (Transmute);
|
||||
_0 = &raw mut (*_3);
|
||||
Retag([raw] _0);
|
||||
return;
|
||||
|
@ -9,7 +9,7 @@ fn box_to_raw_mut(_1: &mut Box<i32>) -> *mut i32 {
|
||||
bb0: {
|
||||
Retag([fn entry] _1);
|
||||
_2 = deref_copy (*_1);
|
||||
_3 = copy (((_2.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32);
|
||||
_3 = copy ((_2.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>) as *const i32 (Transmute);
|
||||
_0 = &raw mut (*_3);
|
||||
Retag([raw] _0);
|
||||
return;
|
||||
|
@ -21,7 +21,7 @@
|
||||
// Tracking Issue: https://github.com/rust-lang/rust/issues/129080
|
||||
|
||||
use run_make_support::{
|
||||
bin_name, cwd, diff, is_darwin, is_windows, rfs, run_in_tmpdir, rust_lib_name, rustc,
|
||||
bin_name, cwd, diff, is_darwin, is_windows, regex, rfs, run_in_tmpdir, rust_lib_name, rustc,
|
||||
};
|
||||
|
||||
fn main() {
|
||||
@ -117,7 +117,34 @@ fn smoke_test(flag: Option<SmokeFlag>) {
|
||||
.input("reproducible-build.rs")
|
||||
.linker(&cwd().join(bin_name("linker")).display().to_string())
|
||||
.run();
|
||||
diff().actual_file("linker-arguments1").expected_file("linker-arguments2").run();
|
||||
|
||||
#[cfg(not(target_os = "aix"))]
|
||||
{
|
||||
diff().actual_file("linker-arguments1").expected_file("linker-arguments2").run();
|
||||
}
|
||||
#[cfg(target_os = "aix")]
|
||||
{
|
||||
// The AIX link command includes an additional argument
|
||||
// that specifies the file containing exported symbols, e.g.,
|
||||
// -bE:/tmp/rustcO6hxkY/list.exp. In this example, the part of the
|
||||
// directory name "rustcO6hxkY" is randomly generated to ensure that
|
||||
// different linking processes do not collide. For the purpose
|
||||
// of comparing link arguments, the randomly generated part is
|
||||
// replaced with a placeholder.
|
||||
let content1 =
|
||||
std::fs::read_to_string("linker-arguments1").expect("Failed to read file");
|
||||
let content2 =
|
||||
std::fs::read_to_string("linker-arguments2").expect("Failed to read file");
|
||||
|
||||
// Define the regex for the directory name containing the random substring.
|
||||
let re = regex::Regex::new(r"rustc[a-zA-Z0-9]{6}/list\.exp").expect("Invalid regex");
|
||||
|
||||
// Compare link commands with random strings replaced by placeholders.
|
||||
assert!(
|
||||
re.replace_all(&content1, "rustcXXXXXX/list.exp").to_string()
|
||||
== re.replace_all(&content2, "rustcXXXXXX/list.exp").to_string()
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -207,7 +234,21 @@ fn diff_dir_test(crate_type: CrateType, remap_type: RemapType) {
|
||||
std::env::set_current_dir(&base_dir).unwrap();
|
||||
match crate_type {
|
||||
CrateType::Bin => {
|
||||
assert!(rfs::read(bin_name("reproducible-build")) == rfs::read(bin_name("foo")));
|
||||
#[cfg(not(target_os = "aix"))]
|
||||
{
|
||||
assert!(
|
||||
rfs::read(bin_name("reproducible-build")) == rfs::read(bin_name("foo"))
|
||||
);
|
||||
}
|
||||
#[cfg(target_os = "aix")]
|
||||
{
|
||||
// At the 4th-byte offset, the AIX XCOFF file header defines a
|
||||
// 4-byte timestamp. Nullify the timestamp before performing a
|
||||
// binary comparison.
|
||||
let mut file1 = rfs::read(bin_name("reproducible-build"));
|
||||
let mut file2 = rfs::read(bin_name("foo"));
|
||||
assert!(file1[4..8].fill(0x00) == file2[4..8].fill(0x00));
|
||||
};
|
||||
}
|
||||
CrateType::Rlib => {
|
||||
assert!(
|
||||
|
Loading…
Reference in New Issue
Block a user