From e5796c46de20856f2eee0d8651572343d4fea9db Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Sun, 5 Dec 2021 20:49:23 +0000 Subject: [PATCH 01/14] Apply path remapping to DW_AT_GNU_dwo_name --- compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs | 9 ++++++--- src/test/run-make-fulldeps/split-dwarf/Makefile | 11 ++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs index 10c7bb2eaea94..f15f81a83b051 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs @@ -1057,9 +1057,12 @@ pub fn compile_unit_metadata( let output_filenames = tcx.output_filenames(()); let out_dir = &output_filenames.out_directory; let split_name = if tcx.sess.target_can_use_split_dwarf() { - output_filenames - .split_dwarf_path(tcx.sess.split_debuginfo(), Some(codegen_unit_name)) - .map(|f| out_dir.join(f)) + output_filenames.split_dwarf_path(tcx.sess.split_debuginfo(), Some(codegen_unit_name)).map( + |f| { + let joined = out_dir.join(f); + tcx.sess.source_map().path_mapping().map_prefix(joined).0 + }, + ) } else { None } diff --git a/src/test/run-make-fulldeps/split-dwarf/Makefile b/src/test/run-make-fulldeps/split-dwarf/Makefile index ef61ff0450157..5fef8eac3524e 100644 --- a/src/test/run-make-fulldeps/split-dwarf/Makefile +++ b/src/test/run-make-fulldeps/split-dwarf/Makefile @@ -2,7 +2,16 @@ # only-linux -all: +all: packed remapped + +remapped: + $(RUSTC) -Z unstable-options -C split-debuginfo=packed -C debuginfo=2 --remap-path-prefix $$PWD= foo.rs -g + objdump -Wi $(TMPDIR)/foo | grep $$PWD && exit 1 || exit 0 + + $(RUSTC) -Z unstable-options -C split-debuginfo=unpacked -C debuginfo=2 --remap-path-prefix $$PWD= foo.rs -g + objdump -Wi $(TMPDIR)/foo | grep $$PWD && exit 1 || exit 0 + +packed: $(RUSTC) -Z unstable-options -C split-debuginfo=packed -C debuginfo=2 foo.rs -g rm $(TMPDIR)/foo.dwp rm $(TMPDIR)/$(call BIN,foo) From 4abed5000b73efdbf12fda2148aa14185461b370 Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Mon, 6 Dec 2021 13:46:14 +0000 Subject: [PATCH 02/14] Provide .dwo paths to llvm-dwp explicitly --- compiler/rustc_codegen_ssa/src/back/link.rs | 19 ++++++++++++++----- .../run-make-fulldeps/split-dwarf/Makefile | 4 ++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 638b2a7b5a9f2..1d0e661fc0aeb 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -35,7 +35,7 @@ use object::{Architecture, BinaryFormat, Endianness, FileFlags, SectionFlags, Se use regex::Regex; use tempfile::Builder as TempFileBuilder; -use std::ffi::OsString; +use std::ffi::{OsStr, OsString}; use std::lazy::OnceCell; use std::path::{Path, PathBuf}; use std::process::{ExitStatus, Output, Stdio}; @@ -639,15 +639,17 @@ const LLVM_DWP_EXECUTABLE: &'static str = "rust-llvm-dwp"; /// Invoke `llvm-dwp` (shipped alongside rustc) to link `dwo` files from Split DWARF into a `dwp` /// file. -fn link_dwarf_object<'a>(sess: &'a Session, executable_out_filename: &Path) { +fn link_dwarf_object<'a, I>(sess: &'a Session, executable_out_filename: &Path, dwo_files: I) +where + I: IntoIterator>, +{ info!("preparing dwp to {}.dwp", executable_out_filename.to_str().unwrap()); let dwp_out_filename = executable_out_filename.with_extension("dwp"); let mut cmd = Command::new(LLVM_DWP_EXECUTABLE); - cmd.arg("-e"); - cmd.arg(executable_out_filename); cmd.arg("-o"); cmd.arg(&dwp_out_filename); + cmd.args(dwo_files); let mut new_path = sess.get_tools_search_paths(false); if let Some(path) = env::var_os("PATH") { @@ -1031,7 +1033,14 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>( SplitDebuginfo::Packed if sess.target.is_like_msvc => {} // ... and otherwise we're processing a `*.dwp` packed dwarf file. - SplitDebuginfo::Packed => link_dwarf_object(sess, &out_filename), + // We cannot rely on the .dwo paths in the exectuable because they may have been + // remapped by --remap-path-prefix and therefore invalid. So we need to provide + // the .dwo paths explicitly + SplitDebuginfo::Packed => link_dwarf_object( + sess, + &out_filename, + codegen_results.modules.iter().filter_map(|m| m.dwarf_object.as_ref()), + ), } let strip = strip_value(sess); diff --git a/src/test/run-make-fulldeps/split-dwarf/Makefile b/src/test/run-make-fulldeps/split-dwarf/Makefile index 5fef8eac3524e..c5f649a13b4cf 100644 --- a/src/test/run-make-fulldeps/split-dwarf/Makefile +++ b/src/test/run-make-fulldeps/split-dwarf/Makefile @@ -5,10 +5,10 @@ all: packed remapped remapped: - $(RUSTC) -Z unstable-options -C split-debuginfo=packed -C debuginfo=2 --remap-path-prefix $$PWD= foo.rs -g + $(RUSTC) -Z unstable-options -C split-debuginfo=packed -C debuginfo=2 --remap-path-prefix $$PWD=/a foo.rs -g objdump -Wi $(TMPDIR)/foo | grep $$PWD && exit 1 || exit 0 - $(RUSTC) -Z unstable-options -C split-debuginfo=unpacked -C debuginfo=2 --remap-path-prefix $$PWD= foo.rs -g + $(RUSTC) -Z unstable-options -C split-debuginfo=unpacked -C debuginfo=2 --remap-path-prefix $$PWD=/a foo.rs -g objdump -Wi $(TMPDIR)/foo | grep $$PWD && exit 1 || exit 0 packed: From 32810223c6b743de889eda96b442f621c293a848 Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Mon, 6 Dec 2021 18:10:16 +0000 Subject: [PATCH 03/14] Produce .dwo file for Packed as well --- compiler/rustc_codegen_llvm/src/back/write.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index 460a8cc69128e..8a73890ba9dc7 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -901,17 +901,14 @@ pub(crate) unsafe fn codegen( .generic_activity_with_arg("LLVM_module_codegen_emit_obj", &module.name[..]); let dwo_out = cgcx.output_filenames.temp_path_dwo(module_name); - let dwo_out = match cgcx.split_debuginfo { - // Don't change how DWARF is emitted in single mode (or when disabled). - SplitDebuginfo::Off | SplitDebuginfo::Packed => None, + let dwo_out = if cgcx.target_can_use_split_dwarf + && cgcx.split_debuginfo != SplitDebuginfo::Off + { // Emit (a subset of the) DWARF into a separate file in split mode. - SplitDebuginfo::Unpacked => { - if cgcx.target_can_use_split_dwarf { - Some(dwo_out.as_path()) - } else { - None - } - } + Some(dwo_out.as_path()) + } else { + // Don't change how DWARF is emitted in single mode (or when disabled). + None }; with_codegen(tm, llmod, config.no_builtins, |cpm| { @@ -948,7 +945,7 @@ pub(crate) unsafe fn codegen( Ok(module.into_compiled_module( config.emit_obj != EmitObj::None, - cgcx.target_can_use_split_dwarf && cgcx.split_debuginfo == SplitDebuginfo::Unpacked, + cgcx.target_can_use_split_dwarf && cgcx.split_debuginfo != SplitDebuginfo::Off, config.emit_bc, &cgcx.output_filenames, )) From 95fd357d8ae371dbf85b82bfa7f926dc1f966c72 Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Mon, 6 Dec 2021 19:51:58 +0000 Subject: [PATCH 04/14] Correct test which wasn't failing correctly --- src/test/run-make-fulldeps/split-dwarf/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/run-make-fulldeps/split-dwarf/Makefile b/src/test/run-make-fulldeps/split-dwarf/Makefile index c5f649a13b4cf..eef04c767fb7c 100644 --- a/src/test/run-make-fulldeps/split-dwarf/Makefile +++ b/src/test/run-make-fulldeps/split-dwarf/Makefile @@ -5,11 +5,11 @@ all: packed remapped remapped: - $(RUSTC) -Z unstable-options -C split-debuginfo=packed -C debuginfo=2 --remap-path-prefix $$PWD=/a foo.rs -g - objdump -Wi $(TMPDIR)/foo | grep $$PWD && exit 1 || exit 0 + $(RUSTC) -Z unstable-options -C split-debuginfo=packed -C debuginfo=2 --remap-path-prefix $(TMPDIR)=/a foo.rs -g + objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 - $(RUSTC) -Z unstable-options -C split-debuginfo=unpacked -C debuginfo=2 --remap-path-prefix $$PWD=/a foo.rs -g - objdump -Wi $(TMPDIR)/foo | grep $$PWD && exit 1 || exit 0 + $(RUSTC) -Z unstable-options -C split-debuginfo=unpacked -C debuginfo=2 --remap-path-prefix $(TMPDIR)=/a foo.rs -g + objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 packed: $(RUSTC) -Z unstable-options -C split-debuginfo=packed -C debuginfo=2 foo.rs -g From 42190bb42e06f87e24f9b4280a996175e97b73ab Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Mon, 6 Dec 2021 23:59:59 +0000 Subject: [PATCH 05/14] Remove redundant path join --- compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs index f15f81a83b051..0549bf853b955 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs @@ -1055,14 +1055,11 @@ pub fn compile_unit_metadata( let work_dir = tcx.sess.opts.working_dir.to_string_lossy(FileNameDisplayPreference::Remapped); let flags = "\0"; let output_filenames = tcx.output_filenames(()); - let out_dir = &output_filenames.out_directory; let split_name = if tcx.sess.target_can_use_split_dwarf() { - output_filenames.split_dwarf_path(tcx.sess.split_debuginfo(), Some(codegen_unit_name)).map( - |f| { - let joined = out_dir.join(f); - tcx.sess.source_map().path_mapping().map_prefix(joined).0 - }, - ) + output_filenames + .split_dwarf_path(tcx.sess.split_debuginfo(), Some(codegen_unit_name)) + // We get a path relative to the working directory from split_dwarf_path + .map(|f| tcx.sess.source_map().path_mapping().map_prefix(f).0) } else { None } From 3d16a20c7aa117773a957db9893f83a1cb3bd653 Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Sat, 11 Dec 2021 01:11:57 +0000 Subject: [PATCH 06/14] Remap path in MCOptions --- compiler/rustc_codegen_llvm/src/back/write.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index 8a73890ba9dc7..1ddc0cf8b9b72 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -205,8 +205,11 @@ pub fn target_machine_factory( let use_init_array = !sess.opts.debugging_opts.use_ctors_section.unwrap_or(sess.target.use_ctors_section); + let path_mapping = sess.source_map().path_mapping().clone(); + Arc::new(move |config: TargetMachineFactoryConfig| { - let split_dwarf_file = config.split_dwarf_file.unwrap_or_default(); + let split_dwarf_file = + path_mapping.map_prefix(config.split_dwarf_file.unwrap_or_default()).0; let split_dwarf_file = CString::new(split_dwarf_file.to_str().unwrap()).unwrap(); let tm = unsafe { From f53e489e6e721f914f6a3c59a7792dc5dfb80ad2 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Sat, 11 Dec 2021 17:54:53 -0800 Subject: [PATCH 07/14] Show the unused type for `unused_results` lint I think it's helpful to know what type was unused when looking at these warnings. The type will likely determine whether the result *should* be used, or whether it should just be ignored. Including the type also matches the behavior of the `must_use` lint: unused `SomeType` that must be used. --- compiler/rustc_lint/src/unused.rs | 4 +++- src/test/ui/lint/unused/unused-result.rs | 2 +- src/test/ui/lint/unused/unused-result.stderr | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs index da1edcf6fe3b4..ed24b94e2fd3b 100644 --- a/compiler/rustc_lint/src/unused.rs +++ b/compiler/rustc_lint/src/unused.rs @@ -169,7 +169,9 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults { } if !(type_permits_lack_of_use || fn_warned || op_warned) { - cx.struct_span_lint(UNUSED_RESULTS, s.span, |lint| lint.build("unused result").emit()); + cx.struct_span_lint(UNUSED_RESULTS, s.span, |lint| { + lint.build(&format!("unused result of type `{}`", ty)).emit() + }); } // Returns whether an error has been emitted (and thus another does not need to be later). diff --git a/src/test/ui/lint/unused/unused-result.rs b/src/test/ui/lint/unused/unused-result.rs index a65e98990dceb..e283eaa88dd13 100644 --- a/src/test/ui/lint/unused/unused-result.rs +++ b/src/test/ui/lint/unused/unused-result.rs @@ -31,7 +31,7 @@ fn test2() { } fn main() { - foo::(); //~ ERROR: unused result + foo::(); //~ ERROR: unused result of type `isize` foo::(); //~ ERROR: unused `MustUse` that must be used foo::(); //~ ERROR: unused `MustUseMsg` that must be used //~^ NOTE: some message diff --git a/src/test/ui/lint/unused/unused-result.stderr b/src/test/ui/lint/unused/unused-result.stderr index 1b1dcab3a1bc9..087e06341cdde 100644 --- a/src/test/ui/lint/unused/unused-result.stderr +++ b/src/test/ui/lint/unused/unused-result.stderr @@ -18,7 +18,7 @@ LL | foo::(); | = note: some message -error: unused result +error: unused result of type `isize` --> $DIR/unused-result.rs:34:5 | LL | foo::(); From 707f72c1dffc33f2980945371aa4fb2d9f77af6d Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Mon, 13 Dec 2021 11:40:59 +0000 Subject: [PATCH 08/14] Revert "Produce .dwo file for Packed as well" This reverts commit 32810223c6b743de889eda96b442f621c293a848. --- compiler/rustc_codegen_llvm/src/back/write.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index 1ddc0cf8b9b72..10170bd7b0ebf 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -904,14 +904,17 @@ pub(crate) unsafe fn codegen( .generic_activity_with_arg("LLVM_module_codegen_emit_obj", &module.name[..]); let dwo_out = cgcx.output_filenames.temp_path_dwo(module_name); - let dwo_out = if cgcx.target_can_use_split_dwarf - && cgcx.split_debuginfo != SplitDebuginfo::Off - { - // Emit (a subset of the) DWARF into a separate file in split mode. - Some(dwo_out.as_path()) - } else { + let dwo_out = match cgcx.split_debuginfo { // Don't change how DWARF is emitted in single mode (or when disabled). - None + SplitDebuginfo::Off | SplitDebuginfo::Packed => None, + // Emit (a subset of the) DWARF into a separate file in split mode. + SplitDebuginfo::Unpacked => { + if cgcx.target_can_use_split_dwarf { + Some(dwo_out.as_path()) + } else { + None + } + } }; with_codegen(tm, llmod, config.no_builtins, |cpm| { @@ -948,7 +951,7 @@ pub(crate) unsafe fn codegen( Ok(module.into_compiled_module( config.emit_obj != EmitObj::None, - cgcx.target_can_use_split_dwarf && cgcx.split_debuginfo != SplitDebuginfo::Off, + cgcx.target_can_use_split_dwarf && cgcx.split_debuginfo == SplitDebuginfo::Unpacked, config.emit_bc, &cgcx.output_filenames, )) From 5e481d07d2f962cda0bdb76a1e6c19d99c1be847 Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Mon, 13 Dec 2021 12:09:10 +0000 Subject: [PATCH 09/14] Provide object files to llvm-dwp instead of .dwo --- compiler/rustc_codegen_ssa/src/back/link.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 1d0e661fc0aeb..aaecb26f4a031 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -637,9 +637,9 @@ fn escape_stdout_stderr_string(s: &[u8]) -> String { const LLVM_DWP_EXECUTABLE: &'static str = "rust-llvm-dwp"; -/// Invoke `llvm-dwp` (shipped alongside rustc) to link `dwo` files from Split DWARF into a `dwp` +/// Invoke `llvm-dwp` (shipped alongside rustc) to link debuginfo in object files into a `dwp` /// file. -fn link_dwarf_object<'a, I>(sess: &'a Session, executable_out_filename: &Path, dwo_files: I) +fn link_dwarf_object<'a, I>(sess: &'a Session, executable_out_filename: &Path, object_files: I) where I: IntoIterator>, { @@ -649,7 +649,7 @@ where let mut cmd = Command::new(LLVM_DWP_EXECUTABLE); cmd.arg("-o"); cmd.arg(&dwp_out_filename); - cmd.args(dwo_files); + cmd.args(object_files); let mut new_path = sess.get_tools_search_paths(false); if let Some(path) = env::var_os("PATH") { @@ -1033,13 +1033,13 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>( SplitDebuginfo::Packed if sess.target.is_like_msvc => {} // ... and otherwise we're processing a `*.dwp` packed dwarf file. - // We cannot rely on the .dwo paths in the exectuable because they may have been + // We cannot rely on the .o paths in the exectuable because they may have been // remapped by --remap-path-prefix and therefore invalid. So we need to provide - // the .dwo paths explicitly + // the .o paths explicitly SplitDebuginfo::Packed => link_dwarf_object( sess, &out_filename, - codegen_results.modules.iter().filter_map(|m| m.dwarf_object.as_ref()), + codegen_results.modules.iter().filter_map(|m| m.object.as_ref()), ), } From 8ae57801d033e45b89ac6d4c6ece3474768f6e36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Marie?= Date: Mon, 13 Dec 2021 12:19:24 +0000 Subject: [PATCH 10/14] pass -Wl,-z,origin to set DF_ORIGIN when using rpath DF_ORIGIN flag signifies that the object being loaded may make reference to the $ORIGIN substitution string. Some implementations are just ignoring DF_ORIGIN and do substitution for $ORIGIN if present (whatever DF_ORIGIN presence or not) like glibc. But some others mandate the present of DF_ORIGIN for the substitution (like OpenBSD). Set the flag inconditionally if rpath is wanted. --- compiler/rustc_codegen_ssa/src/back/rpath.rs | 1 + src/bootstrap/builder.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/compiler/rustc_codegen_ssa/src/back/rpath.rs b/compiler/rustc_codegen_ssa/src/back/rpath.rs index 61c3ef62fb193..68e3082cac763 100644 --- a/compiler/rustc_codegen_ssa/src/back/rpath.rs +++ b/compiler/rustc_codegen_ssa/src/back/rpath.rs @@ -34,6 +34,7 @@ pub fn get_rpath_flags(config: &mut RPathConfig<'_>) -> Vec { fn rpaths_to_flags(rpaths: &[String]) -> Vec { let mut ret = Vec::with_capacity(rpaths.len()); // the minimum needed capacity + ret.push(String::from("-Wl,-z,origin")); for rpath in rpaths { if rpath.contains(',') { ret.push("-Wl,-rpath".into()); diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 952a65a428688..bbd2c087ccabb 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1176,6 +1176,7 @@ impl<'a> Builder<'a> { rustflags.arg("-Zosx-rpath-install-name"); Some("-Wl,-rpath,@loader_path/../lib") } else if !target.contains("windows") { + rustflags.arg("-Clink-args=-Wl,-z,origin"); Some("-Wl,-rpath,$ORIGIN/../lib") } else { None From 77a0c65264ebe36ac7e3fecc775cfe05dfeeec46 Mon Sep 17 00:00:00 2001 From: LegionMammal978 Date: Tue, 14 Dec 2021 12:13:07 -0500 Subject: [PATCH 11/14] Remove `in_band_lifetimes` from `rustc_query_impl` See #91867 for more information. --- compiler/rustc_query_impl/src/keys.rs | 2 +- compiler/rustc_query_impl/src/lib.rs | 1 - compiler/rustc_query_impl/src/on_disk_cache.rs | 2 +- compiler/rustc_query_impl/src/plumbing.rs | 8 ++++---- compiler/rustc_query_impl/src/profiling_support.rs | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_query_impl/src/keys.rs b/compiler/rustc_query_impl/src/keys.rs index 344892875961a..581a2bce2e50e 100644 --- a/compiler/rustc_query_impl/src/keys.rs +++ b/compiler/rustc_query_impl/src/keys.rs @@ -151,7 +151,7 @@ impl Key for (DefId, DefId) { } } -impl Key for (ty::Instance<'tcx>, LocalDefId) { +impl<'tcx> Key for (ty::Instance<'tcx>, LocalDefId) { #[inline(always)] fn query_crate_is_local(&self) -> bool { true diff --git a/compiler/rustc_query_impl/src/lib.rs b/compiler/rustc_query_impl/src/lib.rs index 440b6f1983e6e..de9d425353712 100644 --- a/compiler/rustc_query_impl/src/lib.rs +++ b/compiler/rustc_query_impl/src/lib.rs @@ -2,7 +2,6 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![feature(crate_visibility_modifier)] -#![feature(in_band_lifetimes)] #![feature(nll)] #![feature(min_specialization)] #![feature(once_cell)] diff --git a/compiler/rustc_query_impl/src/on_disk_cache.rs b/compiler/rustc_query_impl/src/on_disk_cache.rs index c42decdccff35..11f54ea66fa51 100644 --- a/compiler/rustc_query_impl/src/on_disk_cache.rs +++ b/compiler/rustc_query_impl/src/on_disk_cache.rs @@ -212,7 +212,7 @@ impl<'sess> rustc_middle::ty::OnDiskCache<'sess> for OnDiskCache<'sess> { /// Cache promotions require invoking queries, which needs to read the serialized data. /// In order to serialize the new on-disk cache, the former on-disk cache file needs to be /// deleted, hence we won't be able to refer to its memmapped data. - fn drop_serialized_data(&self, tcx: TyCtxt<'tcx>) { + fn drop_serialized_data(&self, tcx: TyCtxt<'_>) { // Load everything into memory so we can write it out to the on-disk // cache. The vast majority of cacheable query results should already // be in memory, so this should be a cheap operation. diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index 2854ba5158b4e..6d76d09f6190e 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -31,7 +31,7 @@ impl<'tcx> std::ops::Deref for QueryCtxt<'tcx> { } } -impl HasDepContext for QueryCtxt<'tcx> { +impl<'tcx> HasDepContext for QueryCtxt<'tcx> { type DepKind = rustc_middle::dep_graph::DepKind; type DepContext = TyCtxt<'tcx>; @@ -41,7 +41,7 @@ impl HasDepContext for QueryCtxt<'tcx> { } } -impl QueryContext for QueryCtxt<'tcx> { +impl QueryContext for QueryCtxt<'_> { fn current_query_job(&self) -> Option> { tls::with_related_context(**self, |icx| icx.query) } @@ -130,7 +130,7 @@ impl<'tcx> QueryCtxt<'tcx> { pub(super) fn encode_query_results( self, - encoder: &mut on_disk_cache::CacheEncoder<'a, 'tcx, opaque::FileEncoder>, + encoder: &mut on_disk_cache::CacheEncoder<'_, 'tcx, opaque::FileEncoder>, query_result_index: &mut on_disk_cache::EncodedDepNodeIndex, ) -> opaque::FileEncodeResult { macro_rules! encode_queries { @@ -511,7 +511,7 @@ macro_rules! define_queries_struct { } } - impl QueryEngine<'tcx> for Queries<'tcx> { + impl<'tcx> QueryEngine<'tcx> for Queries<'tcx> { fn as_any(&'tcx self) -> &'tcx dyn std::any::Any { let this = unsafe { std::mem::transmute::<&Queries<'_>, &Queries<'_>>(self) }; this as _ diff --git a/compiler/rustc_query_impl/src/profiling_support.rs b/compiler/rustc_query_impl/src/profiling_support.rs index 95edc1e93a538..41ee75c2432d8 100644 --- a/compiler/rustc_query_impl/src/profiling_support.rs +++ b/compiler/rustc_query_impl/src/profiling_support.rs @@ -295,7 +295,7 @@ fn alloc_self_profile_query_strings_for_query_cache<'tcx, C>( /// If we are recording only summary data, the ids will point to /// just the query names. If we are recording query keys too, we /// allocate the corresponding strings here. -pub fn alloc_self_profile_query_strings(tcx: TyCtxt<'tcx>) { +pub fn alloc_self_profile_query_strings(tcx: TyCtxt<'_>) { if !tcx.prof.enabled() { return; } From fd47d247d8f5c19de0f5a31f88736061c093a413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Tue, 14 Dec 2021 00:00:00 +0000 Subject: [PATCH 12/14] miri: lift restriction on extern types being the only field in a struct --- .../src/interpret/eval_context.rs | 16 +---- .../rustc_const_eval/src/interpret/place.rs | 22 +++---- .../const-eval/issue-91827-extern-types.rs | 58 +++++++++++++++++++ 3 files changed, 69 insertions(+), 27 deletions(-) create mode 100644 src/test/ui/consts/const-eval/issue-91827-extern-types.rs diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs index d768f06c4f00d..d9faa6777eae9 100644 --- a/compiler/rustc_const_eval/src/interpret/eval_context.rs +++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs @@ -616,19 +616,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { match self.size_and_align_of(metadata, &field)? { Some(size_and_align) => size_and_align, None => { - // A field with extern type. If this field is at offset 0, we behave - // like the underlying extern type. - // FIXME: Once we have made decisions for how to handle size and alignment - // of `extern type`, this should be adapted. It is just a temporary hack - // to get some code to work that probably ought to work. - if sized_size == Size::ZERO { - return Ok(None); - } else { - span_bug!( - self.cur_span(), - "Fields cannot be extern types, unless they are at offset 0" - ) - } + // A field with an extern type. We don't know the actual dynamic size + // or the alignment. + return Ok(None); } }; diff --git a/compiler/rustc_const_eval/src/interpret/place.rs b/compiler/rustc_const_eval/src/interpret/place.rs index 851c2a6bb2e39..818b95b7fc4f3 100644 --- a/compiler/rustc_const_eval/src/interpret/place.rs +++ b/compiler/rustc_const_eval/src/interpret/place.rs @@ -362,21 +362,15 @@ where // Re-use parent metadata to determine dynamic field layout. // With custom DSTS, this *will* execute user-defined code, but the same // happens at run-time so that's okay. - let align = match self.size_and_align_of(&base.meta, &field_layout)? { - Some((_, align)) => align, - None if offset == Size::ZERO => { - // An extern type at offset 0, we fall back to its static alignment. - // FIXME: Once we have made decisions for how to handle size and alignment - // of `extern type`, this should be adapted. It is just a temporary hack - // to get some code to work that probably ought to work. - field_layout.align.abi + match self.size_and_align_of(&base.meta, &field_layout)? { + Some((_, align)) => (base.meta, offset.align_to(align)), + None => { + // For unsized types with an extern type tail we perform no adjustments. + // NOTE: keep this in sync with `PlaceRef::project_field` in the codegen backend. + assert!(matches!(base.meta, MemPlaceMeta::None)); + (base.meta, offset) } - None => span_bug!( - self.cur_span(), - "cannot compute offset for extern type field at non-0 offset" - ), - }; - (base.meta, offset.align_to(align)) + } } else { // base.meta could be present; we might be accessing a sized field of an unsized // struct. diff --git a/src/test/ui/consts/const-eval/issue-91827-extern-types.rs b/src/test/ui/consts/const-eval/issue-91827-extern-types.rs new file mode 100644 index 0000000000000..d5576ebfd0296 --- /dev/null +++ b/src/test/ui/consts/const-eval/issue-91827-extern-types.rs @@ -0,0 +1,58 @@ +// run-pass +// +// Test that we can handle unsized types with an extern type tail part. +// Regression test for issue #91827. + +#![feature(const_ptr_offset_from)] +#![feature(const_slice_from_raw_parts)] +#![feature(extern_types)] + +use std::ptr::addr_of; + +extern "C" { + type Opaque; +} + +unsafe impl Sync for Opaque {} + +#[repr(C)] +pub struct List { + len: usize, + data: [T; 0], + tail: Opaque, +} + +#[repr(C)] +pub struct ListImpl { + len: usize, + data: [T; N], +} + +impl List { + const fn as_slice(&self) -> &[T] { + unsafe { std::slice::from_raw_parts(self.data.as_ptr(), self.len) } + } +} + +impl ListImpl { + const fn as_list(&self) -> &List { + unsafe { std::mem::transmute(self) } + } +} + +pub static A: ListImpl = ListImpl { + len: 3, + data: [5, 6, 7], +}; +pub static A_REF: &'static List = A.as_list(); +pub static A_TAIL_OFFSET: isize = tail_offset(A.as_list()); + +const fn tail_offset(list: &List) -> isize { + unsafe { (addr_of!(list.tail) as *const u8).offset_from(list as *const List as *const u8) } +} + +fn main() { + assert_eq!(A_REF.as_slice(), &[5, 6, 7]); + // Check that interpreter and code generation agree about the position of the tail field. + assert_eq!(A_TAIL_OFFSET, tail_offset(A_REF)); +} From c4bafafac1a0e44919cb45d93692a3e6c7f7f00b Mon Sep 17 00:00:00 2001 From: Peter Jaszkowiak Date: Mon, 13 Dec 2021 22:16:36 -0700 Subject: [PATCH 13/14] Remove `in_band_lifetimes` for `rustc_passes` --- compiler/rustc_passes/src/check_attr.rs | 10 +++++----- compiler/rustc_passes/src/check_const.rs | 8 ++++---- compiler/rustc_passes/src/dead.rs | 6 +++--- compiler/rustc_passes/src/intrinsicck.rs | 6 +++--- compiler/rustc_passes/src/lang_items.rs | 4 ++-- compiler/rustc_passes/src/layout_test.rs | 12 ++++++------ compiler/rustc_passes/src/lib.rs | 1 - compiler/rustc_passes/src/lib_features.rs | 4 ++-- compiler/rustc_passes/src/liveness.rs | 2 +- compiler/rustc_passes/src/naked_functions.rs | 2 +- compiler/rustc_passes/src/reachable.rs | 2 +- compiler/rustc_passes/src/stability.rs | 6 +++--- compiler/rustc_passes/src/upvars.rs | 4 ++-- 13 files changed, 33 insertions(+), 34 deletions(-) diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 49e6a7df10301..38ad8283f4df0 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -58,7 +58,7 @@ struct CheckAttrVisitor<'tcx> { tcx: TyCtxt<'tcx>, } -impl CheckAttrVisitor<'tcx> { +impl CheckAttrVisitor<'_> { /// Checks any attribute. fn check_attributes( &self, @@ -382,7 +382,7 @@ impl CheckAttrVisitor<'tcx> { &self, hir_id: HirId, attr_span: &Span, - attrs: &'hir [Attribute], + attrs: &[Attribute], span: &Span, target: Target, ) -> bool { @@ -1481,7 +1481,7 @@ impl CheckAttrVisitor<'tcx> { /// Checks if the `#[repr]` attributes on `item` are valid. fn check_repr( &self, - attrs: &'hir [Attribute], + attrs: &[Attribute], span: &Span, target: Target, item: Option>, @@ -1663,7 +1663,7 @@ impl CheckAttrVisitor<'tcx> { } } - fn check_used(&self, attrs: &'hir [Attribute], target: Target) { + fn check_used(&self, attrs: &[Attribute], target: Target) { for attr in attrs { if attr.has_name(sym::used) && target != Target::Static { self.tcx @@ -1842,7 +1842,7 @@ impl CheckAttrVisitor<'tcx> { } } -impl Visitor<'tcx> for CheckAttrVisitor<'tcx> { +impl<'tcx> Visitor<'tcx> for CheckAttrVisitor<'tcx> { type Map = Map<'tcx>; fn nested_visit_map(&mut self) -> NestedVisitorMap { diff --git a/compiler/rustc_passes/src/check_const.rs b/compiler/rustc_passes/src/check_const.rs index 9ccf76b5700c2..a5a65740707e6 100644 --- a/compiler/rustc_passes/src/check_const.rs +++ b/compiler/rustc_passes/src/check_const.rs @@ -78,7 +78,7 @@ impl<'tcx> CheckConstTraitVisitor<'tcx> { impl<'tcx> hir::itemlikevisit::ItemLikeVisitor<'tcx> for CheckConstTraitVisitor<'tcx> { /// check for const trait impls, and errors if the impl uses provided/default functions /// of the trait being implemented; as those provided functions can be non-const. - fn visit_item(&mut self, item: &'hir hir::Item<'hir>) { + fn visit_item<'hir>(&mut self, item: &'hir hir::Item<'hir>) { let _: Option<_> = try { if let hir::ItemKind::Impl(ref imp) = item.kind { if let hir::Constness::Const = imp.constness { @@ -134,11 +134,11 @@ impl<'tcx> hir::itemlikevisit::ItemLikeVisitor<'tcx> for CheckConstTraitVisitor< }; } - fn visit_trait_item(&mut self, _: &'hir hir::TraitItem<'hir>) {} + fn visit_trait_item<'hir>(&mut self, _: &'hir hir::TraitItem<'hir>) {} - fn visit_impl_item(&mut self, _: &'hir hir::ImplItem<'hir>) {} + fn visit_impl_item<'hir>(&mut self, _: &'hir hir::ImplItem<'hir>) {} - fn visit_foreign_item(&mut self, _: &'hir hir::ForeignItem<'hir>) {} + fn visit_foreign_item<'hir>(&mut self, _: &'hir hir::ForeignItem<'hir>) {} } #[derive(Copy, Clone)] diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index 772791324019a..3b15332c678fd 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -150,7 +150,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { #[allow(dead_code)] // FIXME(81658): should be used + lint reinstated after #83171 relands. fn check_for_self_assign(&mut self, assign: &'tcx hir::Expr<'tcx>) { - fn check_for_self_assign_helper( + fn check_for_self_assign_helper<'tcx>( tcx: TyCtxt<'tcx>, typeck_results: &'tcx ty::TypeckResults<'tcx>, lhs: &'tcx hir::Expr<'tcx>, @@ -600,7 +600,7 @@ struct DeadVisitor<'tcx> { live_symbols: FxHashSet, } -impl DeadVisitor<'tcx> { +impl<'tcx> DeadVisitor<'tcx> { fn should_warn_about_item(&mut self, item: &hir::Item<'_>) -> bool { let should_warn = matches!( item.kind, @@ -672,7 +672,7 @@ impl DeadVisitor<'tcx> { } } -impl Visitor<'tcx> for DeadVisitor<'tcx> { +impl<'tcx> Visitor<'tcx> for DeadVisitor<'tcx> { type Map = Map<'tcx>; /// Walk nested items in place so that we don't report dead-code diff --git a/compiler/rustc_passes/src/intrinsicck.rs b/compiler/rustc_passes/src/intrinsicck.rs index 008b856ebf2fa..064c469662842 100644 --- a/compiler/rustc_passes/src/intrinsicck.rs +++ b/compiler/rustc_passes/src/intrinsicck.rs @@ -62,7 +62,7 @@ fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { ty } -impl ExprVisitor<'tcx> { +impl<'tcx> ExprVisitor<'tcx> { fn def_id_is_transmute(&self, def_id: DefId) -> bool { self.tcx.fn_sig(def_id).abi() == RustIntrinsic && self.tcx.item_name(def_id) == sym::transmute @@ -487,7 +487,7 @@ impl ExprVisitor<'tcx> { } } -impl Visitor<'tcx> for ItemVisitor<'tcx> { +impl<'tcx> Visitor<'tcx> for ItemVisitor<'tcx> { type Map = intravisit::ErasedMap<'tcx>; fn nested_visit_map(&mut self) -> NestedVisitorMap { @@ -504,7 +504,7 @@ impl Visitor<'tcx> for ItemVisitor<'tcx> { } } -impl Visitor<'tcx> for ExprVisitor<'tcx> { +impl<'tcx> Visitor<'tcx> for ExprVisitor<'tcx> { type Map = intravisit::ErasedMap<'tcx>; fn nested_visit_map(&mut self) -> NestedVisitorMap { diff --git a/compiler/rustc_passes/src/lang_items.rs b/compiler/rustc_passes/src/lang_items.rs index 388c33917c64f..a808d6c8348a7 100644 --- a/compiler/rustc_passes/src/lang_items.rs +++ b/compiler/rustc_passes/src/lang_items.rs @@ -28,7 +28,7 @@ struct LanguageItemCollector<'tcx> { tcx: TyCtxt<'tcx>, } -impl ItemLikeVisitor<'v> for LanguageItemCollector<'tcx> { +impl<'v, 'tcx> ItemLikeVisitor<'v> for LanguageItemCollector<'tcx> { fn visit_item(&mut self, item: &hir::Item<'_>) { self.check_for_lang(Target::from_item(item), item.hir_id()); @@ -50,7 +50,7 @@ impl ItemLikeVisitor<'v> for LanguageItemCollector<'tcx> { fn visit_foreign_item(&mut self, _: &hir::ForeignItem<'_>) {} } -impl LanguageItemCollector<'tcx> { +impl<'tcx> LanguageItemCollector<'tcx> { fn new(tcx: TyCtxt<'tcx>) -> LanguageItemCollector<'tcx> { LanguageItemCollector { tcx, items: LanguageItems::new() } } diff --git a/compiler/rustc_passes/src/layout_test.rs b/compiler/rustc_passes/src/layout_test.rs index 558d8958b1358..00e8eb5eb2b38 100644 --- a/compiler/rustc_passes/src/layout_test.rs +++ b/compiler/rustc_passes/src/layout_test.rs @@ -20,7 +20,7 @@ struct LayoutTest<'tcx> { tcx: TyCtxt<'tcx>, } -impl ItemLikeVisitor<'tcx> for LayoutTest<'tcx> { +impl<'tcx> ItemLikeVisitor<'tcx> for LayoutTest<'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) { match item.kind { ItemKind::TyAlias(..) @@ -42,7 +42,7 @@ impl ItemLikeVisitor<'tcx> for LayoutTest<'tcx> { fn visit_foreign_item(&mut self, _: &'tcx hir::ForeignItem<'tcx>) {} } -impl LayoutTest<'tcx> { +impl<'tcx> LayoutTest<'tcx> { fn dump_layout_of(&self, item_def_id: LocalDefId, item: &hir::Item<'tcx>, attr: &Attribute) { let tcx = self.tcx; let param_env = self.tcx.param_env(item_def_id); @@ -114,7 +114,7 @@ struct UnwrapLayoutCx<'tcx> { param_env: ParamEnv<'tcx>, } -impl LayoutOfHelpers<'tcx> for UnwrapLayoutCx<'tcx> { +impl<'tcx> LayoutOfHelpers<'tcx> for UnwrapLayoutCx<'tcx> { type LayoutOfResult = TyAndLayout<'tcx>; fn handle_layout_err(&self, err: LayoutError<'tcx>, span: Span, ty: Ty<'tcx>) -> ! { @@ -127,19 +127,19 @@ impl LayoutOfHelpers<'tcx> for UnwrapLayoutCx<'tcx> { } } -impl HasTyCtxt<'tcx> for UnwrapLayoutCx<'tcx> { +impl<'tcx> HasTyCtxt<'tcx> for UnwrapLayoutCx<'tcx> { fn tcx(&self) -> TyCtxt<'tcx> { self.tcx } } -impl HasParamEnv<'tcx> for UnwrapLayoutCx<'tcx> { +impl<'tcx> HasParamEnv<'tcx> for UnwrapLayoutCx<'tcx> { fn param_env(&self) -> ParamEnv<'tcx> { self.param_env } } -impl HasDataLayout for UnwrapLayoutCx<'tcx> { +impl<'tcx> HasDataLayout for UnwrapLayoutCx<'tcx> { fn data_layout(&self) -> &TargetDataLayout { self.tcx.data_layout() } diff --git a/compiler/rustc_passes/src/lib.rs b/compiler/rustc_passes/src/lib.rs index d6528364e9806..8a411f01d6ee2 100644 --- a/compiler/rustc_passes/src/lib.rs +++ b/compiler/rustc_passes/src/lib.rs @@ -6,7 +6,6 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![feature(crate_visibility_modifier)] -#![feature(in_band_lifetimes)] #![feature(map_try_insert)] #![feature(min_specialization)] #![feature(nll)] diff --git a/compiler/rustc_passes/src/lib_features.rs b/compiler/rustc_passes/src/lib_features.rs index 10b8c3104fcad..55ae808dc3089 100644 --- a/compiler/rustc_passes/src/lib_features.rs +++ b/compiler/rustc_passes/src/lib_features.rs @@ -23,7 +23,7 @@ pub struct LibFeatureCollector<'tcx> { lib_features: LibFeatures, } -impl LibFeatureCollector<'tcx> { +impl<'tcx> LibFeatureCollector<'tcx> { fn new(tcx: TyCtxt<'tcx>) -> LibFeatureCollector<'tcx> { LibFeatureCollector { tcx, lib_features: new_lib_features() } } @@ -110,7 +110,7 @@ impl LibFeatureCollector<'tcx> { } } -impl Visitor<'tcx> for LibFeatureCollector<'tcx> { +impl<'tcx> Visitor<'tcx> for LibFeatureCollector<'tcx> { type Map = Map<'tcx>; fn nested_visit_map(&mut self) -> NestedVisitorMap { diff --git a/compiler/rustc_passes/src/liveness.rs b/compiler/rustc_passes/src/liveness.rs index 3d7a215754aca..8bd08913e90d4 100644 --- a/compiler/rustc_passes/src/liveness.rs +++ b/compiler/rustc_passes/src/liveness.rs @@ -198,7 +198,7 @@ struct IrMaps<'tcx> { lnks: IndexVec, } -impl IrMaps<'tcx> { +impl<'tcx> IrMaps<'tcx> { fn new(tcx: TyCtxt<'tcx>) -> IrMaps<'tcx> { IrMaps { tcx, diff --git a/compiler/rustc_passes/src/naked_functions.rs b/compiler/rustc_passes/src/naked_functions.rs index d3ecd18a93c5a..07cb165d79670 100644 --- a/compiler/rustc_passes/src/naked_functions.rs +++ b/compiler/rustc_passes/src/naked_functions.rs @@ -37,7 +37,7 @@ impl<'tcx> Visitor<'tcx> for CheckNakedFunctions<'tcx> { fn visit_fn( &mut self, - fk: FnKind<'v>, + fk: FnKind<'_>, _fd: &'tcx hir::FnDecl<'tcx>, body_id: hir::BodyId, span: Span, diff --git a/compiler/rustc_passes/src/reachable.rs b/compiler/rustc_passes/src/reachable.rs index fc56a339215be..707e6b123daa2 100644 --- a/compiler/rustc_passes/src/reachable.rs +++ b/compiler/rustc_passes/src/reachable.rs @@ -22,7 +22,7 @@ use rustc_target::spec::abi::Abi; // Returns true if the given item must be inlined because it may be // monomorphized or it was marked with `#[inline]`. This will only return // true for functions. -fn item_might_be_inlined(tcx: TyCtxt<'tcx>, item: &hir::Item<'_>, attrs: &CodegenFnAttrs) -> bool { +fn item_might_be_inlined(tcx: TyCtxt<'_>, item: &hir::Item<'_>, attrs: &CodegenFnAttrs) -> bool { if attrs.requests_inline() { return true; } diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index 92911c3cd2455..5f19991f9c78b 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -655,7 +655,7 @@ impl<'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'tcx> { // stable (assuming they have not inherited instability from their parent). } -fn stability_index(tcx: TyCtxt<'tcx>, (): ()) -> Index<'tcx> { +fn stability_index<'tcx>(tcx: TyCtxt<'tcx>, (): ()) -> Index<'tcx> { let is_staged_api = tcx.sess.opts.debugging_opts.force_unstable_if_unmarked || tcx.features().staged_api; let mut staged_api = FxHashMap::default(); @@ -737,7 +737,7 @@ struct Checker<'tcx> { tcx: TyCtxt<'tcx>, } -impl Visitor<'tcx> for Checker<'tcx> { +impl<'tcx> Visitor<'tcx> for Checker<'tcx> { type Map = Map<'tcx>; /// Because stability levels are scoped lexically, we want to walk @@ -866,7 +866,7 @@ struct CheckTraitImplStable<'tcx> { fully_stable: bool, } -impl Visitor<'tcx> for CheckTraitImplStable<'tcx> { +impl<'tcx> Visitor<'tcx> for CheckTraitImplStable<'tcx> { type Map = Map<'tcx>; fn nested_visit_map(&mut self) -> NestedVisitorMap { diff --git a/compiler/rustc_passes/src/upvars.rs b/compiler/rustc_passes/src/upvars.rs index 91b8ae07637df..2d84c8caada80 100644 --- a/compiler/rustc_passes/src/upvars.rs +++ b/compiler/rustc_passes/src/upvars.rs @@ -42,7 +42,7 @@ struct LocalCollector { locals: FxHashSet, } -impl Visitor<'tcx> for LocalCollector { +impl<'tcx> Visitor<'tcx> for LocalCollector { type Map = intravisit::ErasedMap<'tcx>; fn nested_visit_map(&mut self) -> NestedVisitorMap { @@ -71,7 +71,7 @@ impl CaptureCollector<'_, '_> { } } -impl Visitor<'tcx> for CaptureCollector<'a, 'tcx> { +impl<'tcx> Visitor<'tcx> for CaptureCollector<'_, 'tcx> { type Map = intravisit::ErasedMap<'tcx>; fn nested_visit_map(&mut self) -> NestedVisitorMap { From 8150a2f7b32e0666706dc61cf7093a63b4074a67 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Thu, 16 Dec 2021 20:35:44 -0800 Subject: [PATCH 14/14] Update cargo --- src/tools/cargo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/cargo b/src/tools/cargo index a359ce1607340..fcef61230c3b6 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit a359ce16073401f28b84840da85b268aa3d37c88 +Subproject commit fcef61230c3b6213b6b0d233a36ba4ebd1649ec3