Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion mesonbuild/compilers/rust.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,9 @@ def get_allow_undefined_link_args(self) -> T.List[str]:
return rustc_link_args(super().get_allow_undefined_link_args())

def get_build_link_args(self, target: BuildTarget, build: build.Build) -> T.List[str]:
return rustc_link_args(super().get_build_link_args(target, build))
return rustc_link_args(build.get_project_link_args(self, target)
+ build.get_global_link_args(self, self.for_machine)) \
+ self.environment.coredata.get_external_link_args(self.for_machine, self.get_language())

def get_target_link_args(self, target: 'BuildTarget') -> T.List[str]:
return rustc_link_args(super().get_target_link_args(target))
Expand Down
1 change: 1 addition & 0 deletions test cases/rust/37 rustflags env/clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blacklisted-names = ["foo"]
28 changes: 28 additions & 0 deletions test cases/rust/37 rustflags env/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
project('rustprog', 'rust', default_options : ['b_ndebug=true'])

e = executable('rust-program', 'prog.rs',
install : true
)
test('rusttest', e)

e = executable('rust-dynamic', 'prog.rs',
override_options: {'rust_dynamic_std': true},
install : true
)
test('rusttest-dynamic', e)

subdir('subdir')

# this should fail due to debug_assert
test(
'debug_assert_on',
executable(
'rust-program2',
'prog.rs',
override_options : ['b_ndebug=false'],
),
should_fail : true,
)

rustc = meson.get_compiler('rust')
assert(rustc.run('fn main(){}').returncode() == 0)
5 changes: 5 additions & 0 deletions test cases/rust/37 rustflags env/prog.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fn main() {
let foo = "rust compiler is working";
debug_assert!(false, "debug_asserts on!");
println!("{}", foo);
}
2 changes: 2 additions & 0 deletions test cases/rust/37 rustflags env/subdir/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
e = executable('rust-program2', 'prog.rs', install : true)
test('rusttest2', e)
3 changes: 3 additions & 0 deletions test cases/rust/37 rustflags env/subdir/prog.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("rust compiler is working");
}
13 changes: 13 additions & 0 deletions test cases/rust/37 rustflags env/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"env": {
"RUSTFLAGS": "-C force-frame-pointers=yes"
},
"installed": [
{"type": "exe", "file": "usr/bin/rust-program"},
{"type": "pdb", "file": "usr/bin/rust-program"},
{"type": "exe", "file": "usr/bin/rust-program2"},
{"type": "pdb", "file": "usr/bin/rust-program2"},
{"type": "exe", "file": "usr/bin/rust-dynamic"},
{"type": "pdb", "file": "usr/bin/rust-dynamic"}
]
}
Loading