diff --git a/compiler/rustc_passes/src/eii.rs b/compiler/rustc_passes/src/eii.rs index f3e84665f21d..2916f5355e7b 100644 --- a/compiler/rustc_passes/src/eii.rs +++ b/compiler/rustc_passes/src/eii.rs @@ -18,8 +18,8 @@ enum CheckingMode { } fn get_checking_mode(tcx: TyCtxt<'_>) -> CheckingMode { - // if any of the crate types is not rlib or dylib, we must check for existence. - if tcx.crate_types().iter().any(|i| !matches!(i, CrateType::Rlib | CrateType::Dylib)) { + // if any of the crate types is not rlib, we must check for existence. + if tcx.crate_types().iter().any(|i| !matches!(i, CrateType::Rlib)) { CheckingMode::CheckExistence } else { CheckingMode::CheckDuplicates diff --git a/tests/ui/eii/dylib_needs_impl.rs b/tests/ui/eii/dylib_needs_impl.rs new file mode 100644 index 000000000000..bb1ec22b0488 --- /dev/null +++ b/tests/ui/eii/dylib_needs_impl.rs @@ -0,0 +1,7 @@ +//@ no-prefer-dynamic +//@ needs-crate-type: dylib +#![crate_type = "dylib"] +#![feature(extern_item_impls)] + +#[eii(eii1)] //~ ERROR `#[eii1]` required, but not found +fn decl1(x: u64); diff --git a/tests/ui/eii/dylib_needs_impl.stderr b/tests/ui/eii/dylib_needs_impl.stderr new file mode 100644 index 000000000000..60ef656c3017 --- /dev/null +++ b/tests/ui/eii/dylib_needs_impl.stderr @@ -0,0 +1,10 @@ +error: `#[eii1]` required, but not found + --> $DIR/dylib_needs_impl.rs:6:7 + | +LL | #[eii(eii1)] + | ^^^^ expected because `#[eii1]` was declared here in crate `dylib_needs_impl` + | + = help: expected at least one implementation in crate `dylib_needs_impl` or any of its dependencies + +error: aborting due to 1 previous error +