Skip to content

Conversation

@Enselic
Copy link
Member

@Enselic Enselic commented Jan 26, 2026

Since it does not make sense to do so. If someone prefers no dynamic stuff, the last thing they want to look for is an .so file. Also add a regression test. Without the fix, the test fails with:

error: test compilation failed although it shouldn't!
--- stderr -------------------------------
error: extern location for no_prefer_dynamic_lib does not exist: .../auxiliary/libno_prefer_dynamic_lib.so
  --> .../no-prefer-dynamic-means-no-so.rs:9:5
   |
LL |     no_prefer_dynamic_lib::return_42();
   |     ^^^^^^^^^^^^^^^^^^^^^

Needed for:

Blocked by:

Since it does not make sense to do so. If someone prefers no dynamic
stuff, the last thing they want to look for is an .so file. Also add a
regression test. Without the fix, the test fails with:

    error: test compilation failed although it shouldn't!
    --- stderr -------------------------------
    error: extern location for no_prefer_dynamic_lib does not exist: \
        .../auxiliary/libno_prefer_dynamic_lib.so
      --> .../no-prefer-dynamic-means-no-so.rs:9:5
       |
    LL |     no_prefer_dynamic_lib::return_42();
       |     ^^^^^^^^^^^^^^^^^^^^^
@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 26, 2026
@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test [ui] tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs#fat2 ... ok
test [ui] tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs#fat3 ... ok
test [ui] tests/ui/extern/issue-80074.rs ... ok
test [ui] tests/ui/extern/issue-95829.rs ... ok
test [ui] tests/ui/extern/lgamma-linkage.rs ... ok
test [ui] tests/ui/extern/no-mangle-associated-fn.rs ... ok
test [ui] tests/ui/extern/not-in-block.rs ... ok
test [ui] tests/ui/extern/unsized-extern-derefmove.rs ... ok
test [ui] tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs#thin1 ... ok
test [ui] tests/ui/feature-gates/allow-features-empty.rs ... ok
---
test [ui] tests/ui/imports/ambiguous-6.rs ... ok
test [ui] tests/ui/imports/ambiguous-4.rs ... ok
test [ui] tests/ui/imports/ambiguous-9.rs ... ok
test [ui] tests/ui/imports/ambiguous-7.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-globvsglob.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-glob-vs-multiouter.rs ... ok
test [ui] tests/ui/imports/ambiguous-8.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-no-implicit-prelude.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-non-prelude-core-glob.rs ... ok
test [ui] tests/ui/imports/ambiguous-glob-vs-expanded-extern.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-non-prelude-std-glob.rs ... ok
---
---- [ui] tests/ui/privacy/pub-priv-dep/pub-priv1.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/privacy/pub-priv-dep/pub-priv1/pub-priv1.stderr`
diff of stderr:

+ error: extern location for pm does not exist: $TEST_BUILD_DIR/auxiliary/libpm.rlib
+   --> $DIR/pub-priv1.rs:17:1
+    |
+ LL | extern crate pm;
+    | ^^^^^^^^^^^^^^^^
+ 
1 error: crate `priv_dep` from private dependency 'priv_dep' is re-exported
2   --> $DIR/pub-priv1.rs:12:1
3    |

16 LL | pub use priv_dep::m;
17    |         ^^^^^^^^^^^
18 
- error: macro `fn_like` from private dependency 'pm' is re-exported
-   --> $DIR/pub-priv1.rs:158:9
-    |
- LL | pub use pm::fn_like;
-    |         ^^^^^^^^^^^
- 
- error: derive macro `PmDerive` from private dependency 'pm' is re-exported
-   --> $DIR/pub-priv1.rs:160:9
-    |
- LL | pub use pm::PmDerive;
-    |         ^^^^^^^^^^^^
- 
- error: attribute macro `pm_attr` from private dependency 'pm' is re-exported
-   --> $DIR/pub-priv1.rs:162:9
-    |
- LL | pub use pm::pm_attr;
-    |         ^^^^^^^^^^^
- 
37 error: variant `V1` from private dependency 'priv_dep' is re-exported
38   --> $DIR/pub-priv1.rs:165:9
39    |

64 LL | pub use priv_dep::OtherType as Renamed;
65    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:29:5
-    |
- LL |     pub field: OtherType,
-    |     ^^^^^^^^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:36:5
-    |
- LL |     pub OtherType,
-    |     ^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:44:21
-    |
- LL |     ActualOtherType(OtherType, PubType),
-    |                     ^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:47:9
-    |
- LL |         field: OtherType,
-    |         ^^^^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:54:1
-    |
- LL | pub type ReexportedPublicGeneric = PublicGenericType<OtherType, ()>;
-    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:56:1
-    |
- LL | pub type ReexportedPrivateGeneric = PublicGenericType<(), OtherType>;
-    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: trait `OtherTrait` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:59:1
-    |
- LL | pub struct PublicGenericBoundedType<T: OtherTrait>(T);
-    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:63:5
-    |
- LL |     pub fn pub_fn_param(param: OtherType) {}
-    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:66:5
-    |
- LL |     pub fn pub_fn_return() -> OtherType { OtherType }
-    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: trait `OtherTrait` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:73:5
-    |
- LL |     type Foo: OtherTrait;
-    |     ^^^^^^^^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:80:5
-    |
- LL |     fn required_concrete() -> OtherType;
-    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:83:5
-    |
- LL |     fn provided_concrete() -> OtherType { OtherType }
-    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: trait `OtherTrait` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:87:1
-    |
- LL | pub trait WithSuperTrait: OtherTrait {}
-    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:96:5
-    |
- LL |     type X = OtherType;
-    |     ^^^^^^
- 
- error: trait `OtherTrait` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:100:1
-    |
- LL | pub fn in_bounds<T: OtherTrait>(x: T) { unimplemented!() }
-    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: trait `OtherTrait` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:103:1
-    |
- LL | pub fn private_return_impl_trait() -> impl OtherTrait { OtherType }
-    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:106:1
-    |
- LL | pub fn private_return() -> OtherType { OtherType }
-    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:109:1
-    |
- LL | pub fn private_in_generic() -> std::num::Saturating<OtherType> { unimplemented!() }
-    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:112:1
-    |
- LL | pub static STATIC: OtherType = OtherType;
-    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:115:1
-    |
- LL | pub const CONST: OtherType = OtherType;
-    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:118:1
-    |
- LL | pub type Alias = OtherType;
-    | ^^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:121:1
-    |
- LL | pub type AliasOfAlias = priv_dep::PubPub;
-    | ^^^^^^^^^^^^^^^^^^^^^
- 
- error: trait `OtherTrait` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:126:1
-    |
- LL | impl OtherTrait for PublicWithPrivateImpl {}
-    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:131:1
-    |
- LL | impl PubTraitOnPrivate for OtherType {}
-    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:131:1
-    |
- LL | impl PubTraitOnPrivate for OtherType {}
-    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-    |
-    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:137:1
-    |
- LL | impl From<OtherType> for PublicWithStdImpl {
-    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:139:5
-    |
- LL |     fn from(val: OtherType) -> Self { Self }
-    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:143:1
-    |
- LL | impl From<PublicWithStdImpl> for OtherType {
-    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:143:1
-    |
- LL | impl From<PublicWithStdImpl> for OtherType {
-    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-    |
-    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:146:5
-    |
- LL |     fn from(val: PublicWithStdImpl) -> Self { Self }
-    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
- error: type `OtherType` from private dependency 'priv_dep' in public interface
-   --> $DIR/pub-priv1.rs:146:5
-    |
- LL |     fn from(val: PublicWithStdImpl) -> Self { Self }
-    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-    |
-    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
- 
- error: aborting due to 41 previous errors
+ error: aborting due to 8 previous errors
260 
261 

Note: some mismatched output was normalized before being compared
- error: extern location for pm does not exist: /checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/privacy/pub-priv-dep/pub-priv1/auxiliary/libpm.rlib
-   --> /checkout/tests/ui/privacy/pub-priv-dep/pub-priv1.rs:17:1
+ error: extern location for pm does not exist: $TEST_BUILD_DIR/auxiliary/libpm.rlib
+   --> $DIR/pub-priv1.rs:17:1
+    |
+ LL | extern crate pm;
+    | ^^^^^^^^^^^^^^^^
+ 
---
To only update this specific test, also pass `--test-args privacy/pub-priv-dep/pub-priv1.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/privacy/pub-priv-dep/pub-priv1.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/privacy/pub-priv-dep/pub-priv1" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/privacy/pub-priv-dep/pub-priv1/auxiliary" "-Zunstable-options" "--extern" "priv:priv_dep=/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/privacy/pub-priv-dep/pub-priv1/auxiliary/libpriv_dep.so" "--extern" "priv:pm=/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/privacy/pub-priv-dep/pub-priv1/auxiliary/libpm.rlib"
stdout: none
--- stderr -------------------------------
error: extern location for pm does not exist: /checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/privacy/pub-priv-dep/pub-priv1/auxiliary/libpm.rlib
##[error]  --> /checkout/tests/ui/privacy/pub-priv-dep/pub-priv1.rs:17:1
   |
LL | extern crate pm;
   | ^^^^^^^^^^^^^^^^

error: crate `priv_dep` from private dependency 'priv_dep' is re-exported
##[error]  --> /checkout/tests/ui/privacy/pub-priv-dep/pub-priv1.rs:12:1
   |
LL | pub extern crate priv_dep;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: the lint level is defined here
  --> /checkout/tests/ui/privacy/pub-priv-dep/pub-priv1.rs:9:9
   |
LL | #![deny(exported_private_dependencies)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: macro `m` from private dependency 'priv_dep' is re-exported
##[error]  --> /checkout/tests/ui/privacy/pub-priv-dep/pub-priv1.rs:156:9
   |
LL | pub use priv_dep::m;
   |         ^^^^^^^^^^^

error: variant `V1` from private dependency 'priv_dep' is re-exported
##[error]  --> /checkout/tests/ui/privacy/pub-priv-dep/pub-priv1.rs:165:9
   |
LL | pub use priv_dep::E::V1;
   |         ^^^^^^^^^^^^^^^

error: type alias `Unit` from private dependency 'priv_dep' is re-exported
##[error]  --> /checkout/tests/ui/privacy/pub-priv-dep/pub-priv1.rs:168:9
   |
LL | pub use priv_dep::Unit;
   |         ^^^^^^^^^^^^^^

error: type alias `PubPub` from private dependency 'priv_dep' is re-exported
##[error]  --> /checkout/tests/ui/privacy/pub-priv-dep/pub-priv1.rs:170:9
   |
LL | pub use priv_dep::PubPub;
   |         ^^^^^^^^^^^^^^^^

error: type alias `PubPriv` from private dependency 'priv_dep' is re-exported
##[error]  --> /checkout/tests/ui/privacy/pub-priv-dep/pub-priv1.rs:172:9
   |
LL | pub use priv_dep::PubPriv;
   |         ^^^^^^^^^^^^^^^^^

error: struct `Renamed` from private dependency 'priv_dep' is re-exported
##[error]  --> /checkout/tests/ui/privacy/pub-priv-dep/pub-priv1.rs:174:9
   |
LL | pub use priv_dep::OtherType as Renamed;
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants