From f9d51e76910dd999fa1e70ab6668f9ac5b9505ff Mon Sep 17 00:00:00 2001 From: IGI-111 Date: Thu, 18 Jul 2024 18:41:50 +0200 Subject: [PATCH 1/2] Fix namespace documentation example Namespace annotation is no longer supported and has been replaced by namespacing syntax. --- examples/storage_namespace/src/main.sw | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/storage_namespace/src/main.sw b/examples/storage_namespace/src/main.sw index 40ddb1632a8..f662f787c2d 100644 --- a/examples/storage_namespace/src/main.sw +++ b/examples/storage_namespace/src/main.sw @@ -3,10 +3,11 @@ contract; use std::storage::storage_api::{read, write}; // ANCHOR: storage_namespace -#[namespace(example_namespace)] storage { + example_namespace { + foo: u64 = 0, + } // ANCHOR_END: storage_namespace - foo: u64 = 0, } abi StorageNamespaceExample { From 9a7a183404dac5175192af00c909cdca0c911257 Mon Sep 17 00:00:00 2001 From: IGI-111 Date: Thu, 18 Jul 2024 18:54:13 +0200 Subject: [PATCH 2/2] Remove support for namespace attribute --- .../transform/to_parsed_lang/convert_parse_tree.rs | 13 +++---------- sway-types/src/constants.rs | 2 -- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/sway-core/src/transform/to_parsed_lang/convert_parse_tree.rs b/sway-core/src/transform/to_parsed_lang/convert_parse_tree.rs index 614b451e645..78ed08eee4e 100644 --- a/sway-core/src/transform/to_parsed_lang/convert_parse_tree.rs +++ b/sway-core/src/transform/to_parsed_lang/convert_parse_tree.rs @@ -34,9 +34,9 @@ use sway_types::{ ALLOW_ATTRIBUTE_NAME, CFG_ATTRIBUTE_NAME, CFG_EXPERIMENTAL_NEW_ENCODING, CFG_PROGRAM_TYPE_ARG_NAME, CFG_TARGET_ARG_NAME, DEPRECATED_ATTRIBUTE_NAME, DOC_ATTRIBUTE_NAME, DOC_COMMENT_ATTRIBUTE_NAME, FALLBACK_ATTRIBUTE_NAME, - INLINE_ATTRIBUTE_NAME, NAMESPACE_ATTRIBUTE_NAME, PAYABLE_ATTRIBUTE_NAME, - STORAGE_PURITY_ATTRIBUTE_NAME, STORAGE_PURITY_READ_NAME, STORAGE_PURITY_WRITE_NAME, - TEST_ATTRIBUTE_NAME, VALID_ATTRIBUTE_NAMES, + INLINE_ATTRIBUTE_NAME, PAYABLE_ATTRIBUTE_NAME, STORAGE_PURITY_ATTRIBUTE_NAME, + STORAGE_PURITY_READ_NAME, STORAGE_PURITY_WRITE_NAME, TEST_ATTRIBUTE_NAME, + VALID_ATTRIBUTE_NAMES, }, integer_bits::IntegerBits, BaseIdent, @@ -4698,13 +4698,6 @@ fn item_attrs_to_map( let attrs = attr_decl.attribute.get().into_iter(); for attr in attrs { let name = attr.name.as_str(); - if name == NAMESPACE_ATTRIBUTE_NAME { - handler.emit_warn(CompileWarning { - span: attr_decl.span().clone(), - warning_content: Warning::NamespaceAttributeDeprecated, - }); - continue; - } if !VALID_ATTRIBUTE_NAMES.contains(&name) { handler.emit_warn(CompileWarning { span: attr_decl.span().clone(), diff --git a/sway-types/src/constants.rs b/sway-types/src/constants.rs index 5cbbabe1d97..7d1cc136cef 100644 --- a/sway-types/src/constants.rs +++ b/sway-types/src/constants.rs @@ -53,8 +53,6 @@ pub const CFG_EXPERIMENTAL_NEW_ENCODING: &str = "experimental_new_encoding"; pub const DEPRECATED_ATTRIBUTE_NAME: &str = "deprecated"; -pub const NAMESPACE_ATTRIBUTE_NAME: &str = "namespace"; - pub const FALLBACK_ATTRIBUTE_NAME: &str = "fallback"; /// The list of valid attributes.