Skip to content
Open
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
1 change: 1 addition & 0 deletions tests/ui/eii/default/auxiliary/decl_with_default.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ no-prefer-dynamic
//@[dylib] compile-flags: --crate-type=dylib -Cprefer-dynamic
#![crate_type = "rlib"]

@bjorn3 bjorn3 Aug 11, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this and a couple other tests are missing a //@ revisions. In addition I'm not sure if --crate-type or #![crate_type] would win. Pleasw don't use the at the same time.

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. //@ revisions on an auxiliary file does not have any practical effect here. Its revision is inherited from the main test that references it. The same pattern is already used by these files.
  2. --crate-type explicitly takes precedence over #![crate_type]. This is implemented in collect_crate_types. So this is intentional behavior, although the combination may look a little unusual.
  3. I used this behavior so that the same auxiliary file can provide an rlib fallback unless a revision explicitly asks for a dylib. There are two cases where this is useful:
    • In call_impl.rs, the dylib-impl revision tests a declaration in an rlib with its implementation in a dylib. decl_with_default.rs should therefore be an rlib in both the rlib and dylib-impl revisions, so there is no need to repeat the same configuration for both.
    • The other case is duplicate1.rs, which I converted to rlib and dylib revisions, while leaving duplicate2.rs and duplicate3.rs "unrevisioned" because repeating the same matrix there did not seem useful. As a result, impl1.rs and impl2.rs are compiled with a revision and without a revision, with #![crate_type = "rlib"] providing the fallback. Anyway I can make all of these tests explicitly "revisioned" if consistency is preferred.

#![feature(extern_item_impls)]

Expand Down
2 changes: 2 additions & 0 deletions tests/ui/eii/default/auxiliary/decl_with_default_panics.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@ no-prefer-dynamic
//@[dylib] compile-flags: --crate-type=dylib -Cprefer-dynamic
//@ needs-unwind
//@ exec-env:RUST_BACKTRACE=1
#![crate_type = "rlib"]
Expand Down
1 change: 1 addition & 0 deletions tests/ui/eii/default/auxiliary/impl1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ no-prefer-dynamic
//@[dylib-impl] compile-flags: --crate-type=dylib -Cprefer-dynamic
//@ aux-build: decl_with_default.rs
#![crate_type = "rlib"]
#![feature(extern_item_impls)]
Expand Down
1 change: 1 addition & 0 deletions tests/ui/eii/default/call_default.rlib.run.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default 10
2 changes: 2 additions & 0 deletions tests/ui/eii/default/call_default.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@ revisions: rlib dylib
//@[dylib] needs-crate-type: dylib
//@ aux-build: decl_with_default.rs
//@ run-pass
//@ check-run-results
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/eii/default/call_default_panics.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@ revisions: rlib dylib
//@[dylib] needs-crate-type: dylib
//@ aux-build: decl_with_default_panics.rs
//@ edition: 2021
//@ run-pass
Expand Down
1 change: 1 addition & 0 deletions tests/ui/eii/default/call_impl.rlib.run.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
110
2 changes: 2 additions & 0 deletions tests/ui/eii/default/call_impl.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@ revisions: rlib dylib-impl
//@[dylib-impl] needs-crate-type: dylib
//@ aux-build: decl_with_default.rs
//@ aux-build: impl1.rs
//@ run-pass
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/eii/duplicate/auxiliary/impl1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@ no-prefer-dynamic
//@[dylib] compile-flags: --crate-type=dylib -Cprefer-dynamic
//@ aux-build: decl.rs
#![crate_type = "rlib"]
#![feature(extern_item_impls)]
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/eii/duplicate/auxiliary/impl2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@ no-prefer-dynamic
//@[dylib] compile-flags: --crate-type=dylib -Cprefer-dynamic
//@ aux-build: decl.rs
#![crate_type = "rlib"]
#![feature(extern_item_impls)]
Expand Down
1 change: 1 addition & 0 deletions tests/ui/eii/duplicate/auxiliary/impl3.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ no-prefer-dynamic
//@ aux-build: decl.rs
#![crate_type = "rlib"]
#![feature(extern_item_impls)]
Expand Down
1 change: 1 addition & 0 deletions tests/ui/eii/duplicate/auxiliary/impl4.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ no-prefer-dynamic
//@ aux-build: decl.rs
#![crate_type = "rlib"]
#![feature(extern_item_impls)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
error: multiple implementations of `#[eii1]`
--> $DIR/auxiliary/impl1.rs:9:1
--> $DIR/auxiliary/impl1.rs:11:1
|
LL | fn other(x: u64) {
| ^^^^^^^^^^^^^^^^ first implemented here in crate `impl1`
|
::: $DIR/auxiliary/impl2.rs:9:1
::: $DIR/auxiliary/impl2.rs:11:1
|
LL | fn other(x: u64) {
| ---------------- also implemented here in crate `impl2`
Expand Down
15 changes: 15 additions & 0 deletions tests/ui/eii/duplicate/duplicate1.rlib.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error: multiple implementations of `#[eii1]`
--> $DIR/auxiliary/impl1.rs:11:1
|
LL | fn other(x: u64) {
| ^^^^^^^^^^^^^^^^ first implemented here in crate `impl1`
|
::: $DIR/auxiliary/impl2.rs:11:1
|
LL | fn other(x: u64) {
| ---------------- also implemented here in crate `impl2`
|
= help: an "externally implementable item" can only have a single implementation in the final artifact. When multiple implementations are found, also in different crates, they conflict

error: aborting due to 1 previous error

2 changes: 2 additions & 0 deletions tests/ui/eii/duplicate/duplicate1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@ revisions: rlib dylib
//@[dylib] needs-crate-type: dylib
//@ aux-build: impl1.rs
//@ aux-build: impl2.rs
//@ ignore-backends: gcc
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/eii/duplicate/duplicate2.stderr
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
error: multiple implementations of `#[eii1]`
--> $DIR/auxiliary/impl1.rs:9:1
--> $DIR/auxiliary/impl1.rs:11:1
|
LL | fn other(x: u64) {
| ^^^^^^^^^^^^^^^^ first implemented here in crate `impl1`
|
::: $DIR/auxiliary/impl2.rs:9:1
::: $DIR/auxiliary/impl2.rs:11:1
|
LL | fn other(x: u64) {
| ---------------- also implemented here in crate `impl2`
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/eii/duplicate/duplicate3.stderr
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
error: multiple implementations of `#[eii1]`
--> $DIR/auxiliary/impl1.rs:9:1
--> $DIR/auxiliary/impl1.rs:11:1
|
LL | fn other(x: u64) {
| ^^^^^^^^^^^^^^^^ first implemented here in crate `impl1`
|
::: $DIR/auxiliary/impl2.rs:9:1
::: $DIR/auxiliary/impl2.rs:11:1
|
LL | fn other(x: u64) {
| ---------------- also implemented here in crate `impl2`
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/eii/duplicate/dylib_default_duplicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
//@ needs-crate-type: dylib
//@ compile-flags: --emit link
//@ ignore-backends: gcc
// FIXME: linking on windows (specifically mingw) not yet supported, see tracking issue #125418
//@ ignore-windows
// FIXME(#125418): linking on Windows GNU targets is not yet supported.
//@ ignore-windows-gnu
// Regression test for https://github.com/rust-lang/rust/issues/156320.
// A default implementation from an upstream dylib has already been selected and
// must not be overridden by a downstream explicit implementation.
Expand Down
3 changes: 2 additions & 1 deletion tests/ui/eii/linking/track_caller_cross_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
//@ aux-build: track_caller_cross_other_crate.rs
//@ compile-flags: -O
//@ ignore-backends: gcc
//@ ignore-windows
// FIXME(#125418): linking on Windows GNU targets is not yet supported.
//@ ignore-windows-gnu
// Tests that `#[track_caller]` on an EII declaration in one crate is derived
// onto an explicit implementation in another crate.

Expand Down
2 changes: 2 additions & 0 deletions tests/ui/eii/static/auxiliary/cross_crate_def.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@ no-prefer-dynamic
//@[dylib] compile-flags: --crate-type=dylib -Cprefer-dynamic
#![crate_type = "rlib"]
#![feature(extern_item_impls)]

Expand Down
1 change: 1 addition & 0 deletions tests/ui/eii/static/auxiliary/decl_with_default.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ no-prefer-dynamic
//@[dylib] compile-flags: --crate-type=dylib -Cprefer-dynamic
#![crate_type = "rlib"]
#![feature(extern_item_impls)]

Expand Down
1 change: 1 addition & 0 deletions tests/ui/eii/static/auxiliary/impl_default_override.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ no-prefer-dynamic
//@[dylib-impl] compile-flags: --crate-type=dylib -Cprefer-dynamic
//@ aux-build: decl_with_default.rs
#![crate_type = "rlib"]
#![feature(extern_item_impls)]
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/eii/static/cross_crate_def.rlib.run.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
5
5
2 changes: 2 additions & 0 deletions tests/ui/eii/static/cross_crate_def.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@ revisions: rlib dylib
//@[dylib] needs-crate-type: dylib
//@ run-pass
//@ check-run-results
//@ aux-build: cross_crate_def.rs
Expand Down
1 change: 1 addition & 0 deletions tests/ui/eii/static/default_cross_crate.rlib.run.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5
2 changes: 2 additions & 0 deletions tests/ui/eii/static/default_cross_crate.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@ revisions: rlib dylib
//@[dylib] needs-crate-type: dylib
//@ aux-build: decl_with_default.rs
//@ run-pass
//@ check-run-results
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
2 changes: 2 additions & 0 deletions tests/ui/eii/static/default_cross_crate_explicit.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@ revisions: rlib dylib-impl
//@[dylib-impl] needs-crate-type: dylib
//@ aux-build: decl_with_default.rs
//@ aux-build: impl_default_override.rs
//@ run-pass
Expand Down
3 changes: 2 additions & 1 deletion tests/ui/eii/track_caller.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ run-pass
//@ ignore-backends: gcc
//@ ignore-windows
// FIXME(#125418): linking on Windows GNU targets is not yet supported.
//@ ignore-windows-gnu
// Tests that `#[track_caller]` on an EII declaration is threaded through both
// the default impl (no override) and an explicit override (which does not
// repeat `#[track_caller]` — it is derived during codegen so the shim ABI matches).
Expand Down
Loading