-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Fix ICE when combining #[eii] with #[core::contracts::ensures] #153796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rust-bors
merged 3 commits into
rust-lang:main
from
GokhanKabar:fix-ice-missing-tokens-eii-attr-expansion
Apr 10, 2026
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
99821e1
Fix ICE when combining #[eii] with #[core::contracts::ensures]
GokhanKabar b544edd
Preserve EII link through AttrProcMacro token roundtrip and add run-p…
GokhanKabar 48eced8
Fix platform-specific stderr mismatch in ice_contract_attr_on_eii_gen…
GokhanKabar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| //@ compile-flags: --crate-type rlib | ||
|
|
||
| #![feature(extern_item_impls)] | ||
| #![feature(contracts)] | ||
| //~^ WARN the feature `contracts` is incomplete | ||
|
|
||
| #[eii] | ||
| #[core::contracts::ensures] | ||
| //~^ ERROR contract annotations is only supported in functions with bodies | ||
| //~| ERROR contract annotations can only be used on functions | ||
| fn implementation() {} | ||
| //~^ ERROR cannot find value `implementation` in module `self` | ||
30 changes: 30 additions & 0 deletions
30
tests/ui/eii/ice_contract_attr_on_eii_generated_item.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| error: contract annotations is only supported in functions with bodies | ||
| --> $DIR/ice_contract_attr_on_eii_generated_item.rs:8:1 | ||
| | | ||
| LL | #[core::contracts::ensures] | ||
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| error: contract annotations can only be used on functions | ||
| --> $DIR/ice_contract_attr_on_eii_generated_item.rs:8:1 | ||
| | | ||
| LL | #[core::contracts::ensures] | ||
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| error[E0425]: cannot find value `implementation` in module `self` | ||
| --> $DIR/ice_contract_attr_on_eii_generated_item.rs:11:4 | ||
| | | ||
| LL | fn implementation() {} | ||
| | ^^^^^^^^^^^^^^ not found in `self` | ||
|
|
||
| warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes | ||
| --> $DIR/ice_contract_attr_on_eii_generated_item.rs:4:12 | ||
| | | ||
| LL | #![feature(contracts)] | ||
| | ^^^^^^^^^ | ||
| | | ||
| = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information | ||
| = note: `#[warn(incomplete_features)]` on by default | ||
|
|
||
| error: aborting due to 3 previous errors; 1 warning emitted | ||
|
|
||
| For more information about this error, try `rustc --explain E0425`. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this error is sus to me. I think this also needs a test of a real EII, that we call at runtime (
// @run-pass) to make sure this works. I have a suspicion that the roundtrip of pretty printing destroys the EII link here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i.e. pretty printing and reparsing doesn't preserve the fact that the EII has an implementation.