Skip to content

Commit 48eced8

Browse files
committed
Fix platform-specific stderr mismatch in ice_contract_attr_on_eii_generated_item test
The previous test used `fn implementation() {}` with a body, which caused `generate_default_impl` to generate a `const _: () = { fn implementation() {} }` item containing `self::implementation`. On Linux (aarch64-gnu-llvm-21), the resolver's `suggest_ident_hidden_by_hygiene` emitted an extra help span on the resulting E0425 error that did not appear on macOS, causing a stderr mismatch. Switch the declaration to `fn implementation();` (no body) so that `generate_default_impl` is not called and no `self::implementation` path is emitted. The test still validates that `#[eii]` + `#[core::contracts::ensures]` produces graceful errors instead of an ICE, via the two contract-annotation errors on the generated foreign item.
1 parent b544edd commit 48eced8

2 files changed

Lines changed: 3 additions & 20 deletions

File tree

tests/ui/eii/ice_contract_attr_on_eii_generated_item.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
#![feature(extern_item_impls)]
44
#![feature(contracts)]
5-
//~^ WARN the feature `contracts` is incomplete
5+
#![allow(incomplete_features)]
66

77
#[eii]
88
#[core::contracts::ensures]
99
//~^ ERROR contract annotations is only supported in functions with bodies
1010
//~| ERROR contract annotations can only be used on functions
11-
fn implementation() {}
12-
//~^ ERROR cannot find value `implementation` in module `self`
11+
fn implementation();

tests/ui/eii/ice_contract_attr_on_eii_generated_item.stderr

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,5 @@ error: contract annotations can only be used on functions
1010
LL | #[core::contracts::ensures]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

13-
error[E0425]: cannot find value `implementation` in module `self`
14-
--> $DIR/ice_contract_attr_on_eii_generated_item.rs:11:4
15-
|
16-
LL | fn implementation() {}
17-
| ^^^^^^^^^^^^^^ not found in `self`
18-
19-
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
20-
--> $DIR/ice_contract_attr_on_eii_generated_item.rs:4:12
21-
|
22-
LL | #![feature(contracts)]
23-
| ^^^^^^^^^
24-
|
25-
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
26-
= note: `#[warn(incomplete_features)]` on by default
27-
28-
error: aborting due to 3 previous errors; 1 warning emitted
13+
error: aborting due to 2 previous errors
2914

30-
For more information about this error, try `rustc --explain E0425`.

0 commit comments

Comments
 (0)