Skip to content

Commit

Permalink
and few more
Browse files Browse the repository at this point in the history
warning: this argument is a mutable reference, but not used mutably
  --> compiler\rustc_codegen_ssa\src\back\rpath.rs:80:41
   |
80 | fn get_rpath_relative_to_output(config: &mut RPathConfig<'_>, lib: &Path) -> OsString {
   |                                         ^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&RPathConfig<'_>`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
  --> compiler\rustc_codegen_ssa\src\back\rpath.rs:76:42
   |
76 | fn get_rpaths_relative_to_output(config: &mut RPathConfig<'_>) -> Vec<OsString> {
   |                                          ^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&RPathConfig<'_>`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
  --> compiler\rustc_codegen_ssa\src\back\rpath.rs:55:23
   |
55 | fn get_rpaths(config: &mut RPathConfig<'_>) -> Vec<OsString> {
   |                       ^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&RPathConfig<'_>`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
  --> compiler\rustc_codegen_ssa\src\back\rpath.rs:15:32
   |
15 | pub fn get_rpath_flags(config: &mut RPathConfig<'_>) -> Vec<OsString> {
   |                                ^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&RPathConfig<'_>`
   |
   = warning: changing this function will impact semver compatibility
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
  • Loading branch information
klensy committed Mar 28, 2024
1 parent c64a440 commit 5488e49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2089,14 +2089,14 @@ fn add_rpath_args(
.map(|(path, _)| &**path)
})
.collect::<Vec<_>>();
let mut rpath_config = RPathConfig {
let rpath_config = RPathConfig {
libs: &*libs,
out_filename: out_filename.to_path_buf(),
has_rpath: sess.target.has_rpath,
is_like_osx: sess.target.is_like_osx,
linker_is_gnu: sess.target.linker_flavor.is_gnu(),
};
cmd.args(&rpath::get_rpath_flags(&mut rpath_config));
cmd.args(&rpath::get_rpath_flags(&rpath_config));
}
}

Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_codegen_ssa/src/back/rpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct RPathConfig<'a> {
pub linker_is_gnu: bool,
}

pub fn get_rpath_flags(config: &mut RPathConfig<'_>) -> Vec<OsString> {
pub fn get_rpath_flags(config: &RPathConfig<'_>) -> Vec<OsString> {
// No rpath on windows
if !config.has_rpath {
return Vec::new();
Expand Down Expand Up @@ -52,7 +52,7 @@ fn rpaths_to_flags(rpaths: Vec<OsString>) -> Vec<OsString> {
ret
}

fn get_rpaths(config: &mut RPathConfig<'_>) -> Vec<OsString> {
fn get_rpaths(config: &RPathConfig<'_>) -> Vec<OsString> {
debug!("output: {:?}", config.out_filename.display());
debug!("libs:");
for libpath in config.libs {
Expand All @@ -73,11 +73,11 @@ fn get_rpaths(config: &mut RPathConfig<'_>) -> Vec<OsString> {
minimize_rpaths(&rpaths)
}

fn get_rpaths_relative_to_output(config: &mut RPathConfig<'_>) -> Vec<OsString> {
fn get_rpaths_relative_to_output(config: &RPathConfig<'_>) -> Vec<OsString> {
config.libs.iter().map(|a| get_rpath_relative_to_output(config, a)).collect()
}

fn get_rpath_relative_to_output(config: &mut RPathConfig<'_>, lib: &Path) -> OsString {
fn get_rpath_relative_to_output(config: &RPathConfig<'_>, lib: &Path) -> OsString {
// Mac doesn't appear to support $ORIGIN
let prefix = if config.is_like_osx { "@loader_path" } else { "$ORIGIN" };

Expand Down

0 comments on commit 5488e49

Please sign in to comment.