Skip to content

Commit 43ac47d

Browse files
committed
No longer have name_toolchain_map tests build all examples
1 parent a109b23 commit 43ac47d

3 files changed

Lines changed: 16 additions & 28 deletions

File tree

dylint/src/lib.rs

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -518,14 +518,10 @@ fn clippy_disable_docs_links() -> Result<String> {
518518
}
519519

520520
#[allow(clippy::unwrap_used)]
521-
#[cfg(test)]
521+
#[cfg(all(test, __library_packages))]
522522
mod test {
523523
use super::*;
524-
use dylint_internal::examples;
525-
use std::{
526-
env::{join_paths, set_var},
527-
sync::Mutex,
528-
};
524+
use std::sync::Mutex;
529525

530526
// smoelius: With the upgrade to nightly-2023-03-10, I started running into this:
531527
// https://github.com/rust-lang/rustup/issues/988
@@ -535,7 +531,7 @@ mod test {
535531
static OPTS: Lazy<opts::Dylint> = Lazy::new(|| opts::Dylint {
536532
operation: opts::Operation::Check(opts::Check {
537533
lib_sel: opts::LibrarySelection {
538-
no_metadata: true,
534+
manifest_path: Some(String::from("../fixtures/name_toolchain_map/Cargo.toml")),
539535
..Default::default()
540536
},
541537
..Default::default()
@@ -544,27 +540,6 @@ mod test {
544540
});
545541

546542
fn name_toolchain_map() -> NameToolchainMap<'static> {
547-
examples::build().unwrap();
548-
let metadata = dylint_internal::cargo::current_metadata().unwrap();
549-
// smoelius: As of version 0.1.14, `cargo-llvm-cov` no longer sets `CARGO_TARGET_DIR`.
550-
// So `dylint_library_path` no longer requires a `cfg!(coverage)` special case.
551-
let dylint_library_path = join_paths([
552-
metadata.target_directory.join("examples/debug"),
553-
metadata.target_directory.join("straggler/debug"),
554-
])
555-
.unwrap();
556-
557-
#[rustfmt::skip]
558-
// smoelius: Following the upgrade nightly-2023-08-24, I started seeing the following error:
559-
//
560-
// error: internal compiler error: encountered incremental compilation error with shallow_lint_levels_on(dylint_internal[...]::cargo::{use#15})
561-
// |
562-
// = help: This is a known issue with the compiler. Run `cargo clean -p dylint_internal` or `cargo clean` to allow your project to compile
563-
// = note: Please follow the instructions below to create a bug report with the provided information
564-
// = note: See <https://github.com/rust-lang/rust/issues/84970> for more information
565-
set_var(env::CARGO_INCREMENTAL, "0");
566-
set_var(env::DYLINT_LIBRARY_PATH, dylint_library_path);
567-
568543
NameToolchainMap::new(&OPTS)
569544
}
570545

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "name_toolchain_map"
3+
version = "0.1.0"
4+
edition = "2021"
5+
publish = false
6+
7+
[workspace.metadata.dylint]
8+
libraries = [
9+
{ path = "../../examples/restriction/question_mark_in_expression" },
10+
{ path = "../../examples/testing/clippy" },
11+
{ path = "../../examples/testing/straggler" },
12+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)