Skip to content

Commit 69bc70b

Browse files
committed
Fix test-cargo-miri
1 parent d42a283 commit 69bc70b

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

src/bin/miri.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ fn entry_fn(tcx: TyCtxt<'_>) -> (DefId, MiriEntryFnType) {
121121
}
122122

123123
impl rustc_driver::Callbacks for MiriCompilerCalls {
124+
fn config(&mut self, config: &mut rustc_interface::interface::Config) {
125+
if config.opts.prints.is_empty() {
126+
#[allow(rustc::bad_opt_access)]
127+
config.opts.crate_types.retain(|&c| c == CrateType::Executable || c == CrateType::Rlib);
128+
}
129+
}
130+
124131
fn after_analysis<'tcx>(
125132
&mut self,
126133
_: &rustc_interface::interface::Compiler,
@@ -233,6 +240,10 @@ impl rustc_driver::Callbacks for MiriBeRustCompilerCalls {
233240
#[allow(rustc::potential_query_instability)] // rustc_codegen_ssa (where this code is copied from) also allows this lint
234241
fn config(&mut self, config: &mut Config) {
235242
if config.opts.prints.is_empty() && self.target_crate {
243+
// Avoid warnings about unsupported crate types
244+
#[allow(rustc::bad_opt_access)]
245+
config.opts.crate_types.retain(|&c| c == CrateType::Executable || c == CrateType::Rlib);
246+
236247
// Queries overridden here affect the data stored in `rmeta` files of dependencies,
237248
// which will be used later in non-`MIRI_BE_RUSTC` mode.
238249
config.override_queries = Some(|_, local_providers| {

test-cargo-miri/Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test-cargo-miri/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace]
2-
members = ["subcrate", "issue-1567", "exported-symbol-dep", "test-local-crate-detection"]
2+
members = ["cdylib", "subcrate", "issue-1567", "exported-symbol-dep", "test-local-crate-detection"]
33
exclude = ["no-std-smoke"] # it wants to be panic="abort"
44

55
[package]
@@ -10,7 +10,6 @@ edition = "2024"
1010

1111
[dependencies]
1212
byteorder = "1.0"
13-
cdylib = { path = "cdylib" }
1413
exported_symbol = { path = "exported-symbol" }
1514
proc_macro_crate = { path = "proc-macro-crate" }
1615
issue_1567 = { path = "issue-1567" }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
subcrate,issue_1567,exported_symbol_dep,test_local_crate_detection,cargo_miri_test,cdylib,exported_symbol,issue_1691,issue_1705,issue_rust_86261,proc_macro_crate
1+
cdylib,subcrate,issue_1567,exported_symbol_dep,test_local_crate_detection,cargo_miri_test,exported_symbol,issue_1691,issue_1705,issue_rust_86261,proc_macro_crate

0 commit comments

Comments
 (0)