Skip to content

Commit

Permalink
Remove support for namespace attribute (#6279)
Browse files Browse the repository at this point in the history
## Description
Namespace annotation is no longer supported and has been replaced by
namespacing syntax.


## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
  • Loading branch information
IGI-111 authored Jul 19, 2024
1 parent efda039 commit e9cdaac
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
5 changes: 3 additions & 2 deletions examples/storage_namespace/src/main.sw
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
13 changes: 3 additions & 10 deletions sway-core/src/transform/to_parsed_lang/convert_parse_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(),
Expand Down
2 changes: 0 additions & 2 deletions sway-types/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const S_13: b256 = 0x00000000000000000000000000000000000000000000000000000000000
const S_14: b256 = 0x0000000000000000000000000000000000000000000000000000000000000014;
const S_15: b256 = 0x0000000000000000000000000000000000000000000000000000000000000015;

#[namespace(my_storage_namespace)]
abi StorageTest {
#[storage(read, write)]
fn store_bool(value: bool);
Expand Down

0 comments on commit e9cdaac

Please sign in to comment.