Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #120341

Merged
merged 27 commits into from
Jan 26, 2024
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8ee9693
Rewrite the BTreeMap cursor API using gaps
Amanieu Jun 26, 2023
166e348
Update library/alloc/src/collections/btree/map.rs
Amanieu Nov 23, 2023
d085f34
Add UnorderedKeyError
Amanieu Nov 23, 2023
75eeb5e
Remove unused struct
mu001999 Jan 21, 2024
50501c6
linker: Refactor APIs for linking dynamic libraries
petrochenkov Jan 17, 2024
0e38a65
linker: Refactor APIs for linking static libraries
petrochenkov Jan 17, 2024
14cd3fd
linker: Group library linking methods together and sort them consiste…
petrochenkov Jan 18, 2024
859f37a
linker: Do not collect search paths unless necessary
petrochenkov Jan 18, 2024
d15db6b
linker: Merge `link_staticlib_*` and `link_whole_staticlib_*`
petrochenkov Jan 18, 2024
1b8e871
linker: Cleanup implementations of `link_staticlib_*`
petrochenkov Jan 18, 2024
03f23c1
linker: Fix Rust dylib crate extension on windows-msvc
petrochenkov Jan 23, 2024
da33619
Bump `askama` version
clubby789 Jan 24, 2024
57f9d1f
This commit is part of clone3 clean up. As part of clean up we will
Jan 24, 2024
1ee773e
This commit is part of clone3 clean up. Merge tests from tests/ui/com…
Jan 24, 2024
df0c9c3
Finishing clone3 clean up
Jan 24, 2024
bdc9ce0
Don't call `walk_` functions directly if there is an equivalent `visi…
GuillaumeGomez Jan 24, 2024
3004e8c
Remove coroutine info when building coroutine drop body
compiler-errors Jan 25, 2024
07b7c77
What even is CoroutineInfo
compiler-errors Jan 25, 2024
6a81ec3
Fix links to [strict|exposed] provenance sections of `[std|core]::ptr`
steffahn Jan 25, 2024
37f0232
Rollup merge of #118208 - Amanieu:btree_cursor2, r=dtolnay
matthiaskrgr Jan 25, 2024
87448be
Rollup merge of #120099 - petrochenkov:linkapi, r=WaffleLapkin
matthiaskrgr Jan 25, 2024
eeac90c
Rollup merge of #120288 - clubby789:bump-askama, r=GuillaumeGomez
matthiaskrgr Jan 25, 2024
8750bec
Rollup merge of #120306 - safinaskar:clone3-clean-up, r=petrochenkov
matthiaskrgr Jan 25, 2024
f7d3a45
Rollup merge of #120316 - GuillaumeGomez:fix-ast-visitor, r=compiler-…
matthiaskrgr Jan 25, 2024
4bca954
Rollup merge of #120330 - compiler-errors:no-coroutine-info-in-corout…
matthiaskrgr Jan 25, 2024
d7a9f51
Rollup merge of #120332 - mu001999:cleanup/dead_code, r=Nilstrieb
matthiaskrgr Jan 25, 2024
ea27a57
Rollup merge of #120338 - steffahn:provenance_links, r=Nilstrieb
matthiaskrgr Jan 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions Cargo.lock
Original file line number Diff line number Diff line change
@@ -212,24 +212,24 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"

[[package]]
name = "askama"
version = "0.12.0"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47cbc3cf73fa8d9833727bbee4835ba5c421a0d65b72daf9a7b5d0e0f9cfb57e"
checksum = "b79091df18a97caea757e28cd2d5fda49c6cd4bd01ddffd7ff01ace0c0ad2c28"
dependencies = [
"askama_derive",
"askama_escape",
]

[[package]]
name = "askama_derive"
version = "0.12.1"
version = "0.12.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c22fbe0413545c098358e56966ff22cdd039e10215ae213cfbd65032b119fc94"
checksum = "19fe8d6cb13c4714962c072ea496f3392015f0989b1a2847bb4b2d9effd71d83"
dependencies = [
"askama_parser",
"basic-toml",
"mime",
"mime_guess",
"nom",
"proc-macro2",
"quote",
"serde",
@@ -242,6 +242,15 @@ version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341"

[[package]]
name = "askama_parser"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acb1161c6b64d1c3d83108213c2a2533a342ac225aabd0bda218278c2ddb00c0"
dependencies = [
"nom",
]

[[package]]
name = "autocfg"
version = "1.1.0"
10 changes: 5 additions & 5 deletions compiler/rustc_ast/src/visit.rs
Original file line number Diff line number Diff line change
@@ -375,11 +375,11 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) {
}
ItemKind::MacCall(mac) => visitor.visit_mac_call(mac),
ItemKind::MacroDef(ts) => visitor.visit_mac_def(ts, item.id),
ItemKind::Delegation(box Delegation { id: _, qself, path, body }) => {
ItemKind::Delegation(box Delegation { id, qself, path, body }) => {
if let Some(qself) = qself {
visitor.visit_ty(&qself.ty);
}
walk_path(visitor, path);
visitor.visit_path(path, *id);
if let Some(body) = body {
visitor.visit_block(body);
}
@@ -502,7 +502,7 @@ where
}
GenericArgs::Parenthesized(data) => {
walk_list!(visitor, visit_ty, &data.inputs);
walk_fn_ret_ty(visitor, &data.output);
visitor.visit_fn_ret_ty(&data.output);
}
}
}
@@ -713,11 +713,11 @@ pub fn walk_assoc_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a AssocItem,
AssocItemKind::MacCall(mac) => {
visitor.visit_mac_call(mac);
}
AssocItemKind::Delegation(box Delegation { id: _, qself, path, body }) => {
AssocItemKind::Delegation(box Delegation { id, qself, path, body }) => {
if let Some(qself) = qself {
visitor.visit_ty(&qself.ty);
}
walk_path(visitor, path);
visitor.visit_path(path, *id);
if let Some(body) = body {
visitor.visit_block(body);
}
64 changes: 36 additions & 28 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
@@ -52,6 +52,15 @@ use std::path::{Path, PathBuf};
use std::process::{ExitStatus, Output, Stdio};
use std::{env, fmt, fs, io, mem, str};

#[derive(Default)]
pub struct SearchPaths(OnceCell<Vec<PathBuf>>);

impl SearchPaths {
pub(super) fn get(&self, sess: &Session) -> &[PathBuf] {
self.0.get_or_init(|| archive_search_paths(sess))
}
}

pub fn ensure_removed(dcx: &DiagCtxt, path: &Path) {
if let Err(e) = fs::remove_file(path) {
if e.kind() != io::ErrorKind::NotFound {
@@ -1265,15 +1274,15 @@ fn link_sanitizer_runtime(
let path = find_sanitizer_runtime(sess, &filename);
let rpath = path.to_str().expect("non-utf8 component in path");
linker.args(&["-Wl,-rpath", "-Xlinker", rpath]);
linker.link_dylib(&filename, false, true);
linker.link_dylib_by_name(&filename, false, true);
} else if sess.target.is_like_msvc && flavor == LinkerFlavor::Msvc(Lld::No) && name == "asan" {
// MSVC provides the `/INFERASANLIBS` argument to automatically find the
// compatible ASAN library.
linker.arg("/INFERASANLIBS");
} else {
let filename = format!("librustc{channel}_rt.{name}.a");
let path = find_sanitizer_runtime(sess, &filename).join(&filename);
linker.link_whole_rlib(&path);
linker.link_staticlib_by_path(&path, true);
}
}

@@ -2445,7 +2454,7 @@ fn add_native_libs_from_crate(
archive_builder_builder: &dyn ArchiveBuilderBuilder,
codegen_results: &CodegenResults,
tmpdir: &Path,
search_paths: &OnceCell<Vec<PathBuf>>,
search_paths: &SearchPaths,
bundled_libs: &FxHashSet<Symbol>,
cnum: CrateNum,
link_static: bool,
@@ -2505,46 +2514,34 @@ fn add_native_libs_from_crate(
if let Some(filename) = lib.filename {
// If rlib contains native libs as archives, they are unpacked to tmpdir.
let path = tmpdir.join(filename.as_str());
if whole_archive {
cmd.link_whole_rlib(&path);
} else {
cmd.link_rlib(&path);
}
cmd.link_staticlib_by_path(&path, whole_archive);
}
} else {
if whole_archive {
cmd.link_whole_staticlib(
name,
verbatim,
search_paths.get_or_init(|| archive_search_paths(sess)),
);
} else {
cmd.link_staticlib(name, verbatim)
}
cmd.link_staticlib_by_name(name, verbatim, whole_archive, search_paths);
}
}
}
NativeLibKind::Dylib { as_needed } => {
if link_dynamic {
cmd.link_dylib(name, verbatim, as_needed.unwrap_or(true))
cmd.link_dylib_by_name(name, verbatim, as_needed.unwrap_or(true))
}
}
NativeLibKind::Unspecified => {
// If we are generating a static binary, prefer static library when the
// link kind is unspecified.
if !link_output_kind.can_link_dylib() && !sess.target.crt_static_allows_dylibs {
if link_static {
cmd.link_staticlib(name, verbatim)
cmd.link_staticlib_by_name(name, verbatim, false, search_paths);
}
} else {
if link_dynamic {
cmd.link_dylib(name, verbatim, true);
cmd.link_dylib_by_name(name, verbatim, true);
}
}
}
NativeLibKind::Framework { as_needed } => {
if link_dynamic {
cmd.link_framework(name, as_needed.unwrap_or(true))
cmd.link_framework_by_name(name, verbatim, as_needed.unwrap_or(true))
}
}
NativeLibKind::RawDylib => {
@@ -2581,7 +2578,7 @@ fn add_local_native_libraries(
}
}

let search_paths = OnceCell::new();
let search_paths = SearchPaths::default();
// All static and dynamic native library dependencies are linked to the local crate.
let link_static = true;
let link_dynamic = true;
@@ -2623,7 +2620,7 @@ fn add_upstream_rust_crates<'a>(
.find(|(ty, _)| *ty == crate_type)
.expect("failed to find crate type in dependency format list");

let search_paths = OnceCell::new();
let search_paths = SearchPaths::default();
for &cnum in &codegen_results.crate_info.used_crates {
// We may not pass all crates through to the linker. Some crates may appear statically in
// an existing dylib, meaning we'll pick up all the symbols from the dylib.
@@ -2698,7 +2695,7 @@ fn add_upstream_native_libraries(
tmpdir: &Path,
link_output_kind: LinkOutputKind,
) {
let search_path = OnceCell::new();
let search_paths = SearchPaths::default();
for &cnum in &codegen_results.crate_info.used_crates {
// Static libraries are not linked here, they are linked in `add_upstream_rust_crates`.
// FIXME: Merge this function to `add_upstream_rust_crates` so that all native libraries
@@ -2720,7 +2717,7 @@ fn add_upstream_native_libraries(
archive_builder_builder,
codegen_results,
tmpdir,
&search_path,
&search_paths,
&Default::default(),
cnum,
link_static,
@@ -2791,7 +2788,7 @@ fn add_static_crate<'a>(
} else {
fix_windows_verbatim_for_gcc(path)
};
cmd.link_rlib(&rlib_path);
cmd.link_staticlib_by_path(&rlib_path, false);
};

if !are_upstream_rust_objects_already_included(sess)
@@ -2859,13 +2856,24 @@ fn add_dynamic_crate(cmd: &mut dyn Linker, sess: &Session, cratepath: &Path) {
// Just need to tell the linker about where the library lives and
// what its name is
let parent = cratepath.parent();
// When producing a dll, the MSVC linker may not actually emit a
// `foo.lib` file if the dll doesn't actually export any symbols, so we
// check to see if the file is there and just omit linking to it if it's
// not present.
if sess.target.is_like_msvc && !cratepath.with_extension("dll.lib").exists() {
return;
}
if let Some(dir) = parent {
cmd.include_path(&rehome_sysroot_lib_dir(sess, dir));
}
let stem = cratepath.file_stem().unwrap().to_str().unwrap();
// "<dir>/name.dll -> name.dll" on windows-msvc
// "<dir>/name.dll -> name" on windows-gnu
// "<dir>/libname.<ext> -> name" elsewhere
let stem = if sess.target.is_like_msvc { cratepath.file_name() } else { cratepath.file_stem() };
let stem = stem.unwrap().to_str().unwrap();
// Convert library file-stem into a cc -l argument.
let prefix = if stem.starts_with("lib") && !sess.target.is_like_windows { 3 } else { 0 };
cmd.link_rust_dylib(&stem[prefix..], parent.unwrap_or_else(|| Path::new("")));
cmd.link_dylib_by_name(&stem[prefix..], false, true);
}

fn relevant_lib(sess: &Session, lib: &NativeLib) -> bool {
Loading