-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improved error reporting for
near
macro
- Loading branch information
Showing
6 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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 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,13 @@ | ||
use near_sdk::near; | ||
|
||
#[near(contract_state)] | ||
pub struct Contract {} | ||
|
||
pub mod mod1 { | ||
use near_sdk::near; | ||
|
||
#[near(contract_state)] | ||
struct Contract {} | ||
} | ||
|
||
fn main() {} |
7 changes: 7 additions & 0 deletions
7
near-sdk/compilation_tests/double_contract_state_error.stderr
This file contains 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,7 @@ | ||
error: Contract state can only be defined once per crate | ||
--> compilation_tests/double_contract_state_error.rs:9:5 | ||
| | ||
9 | #[near(contract_state)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the attribute macro `near` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file contains 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,14 @@ | ||
//! Method signature uses lifetime. | ||
use near_sdk::near; | ||
|
||
#[near(contract_state)] | ||
#[near(contract_metadata( | ||
version = "39f2d2646f2f60e18ab53337501370dc02a5661c", | ||
link = "https://github.com/near-examples/nft-tutorial", | ||
standard(standard = "nep171", version = "1.0.0"), | ||
standard(standard = "nep177", version = "2.0.0"), | ||
))] | ||
struct CompileFailure {} | ||
|
||
fn main() {} |
This file contains 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,7 @@ | ||
error: The `near` macro cannot be nested with other `near` or `near_bindgen` macros. Please comma-separate the attributes instead of nesting them | ||
--> compilation_tests/nested_near_error.rs:5:1 | ||
| | ||
5 | #[near(contract_state)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the attribute macro `near` (in Nightly builds, run with -Z macro-backtrace for more info) |