Skip to content

Commit 882f9d2

Browse files
committed
Merge branch 'master' into ironcev/panic-expression
2 parents 02733a4 + d258921 commit 882f9d2

File tree

75 files changed

+1072
-606
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1072
-606
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
* @FuelLabs/leads
33

44
# Documentation
5-
/docs/ @FuelLabs/tooling @FuelLabs/sway-compiler @FuelLabs/swayex @FuelLabs/Devrel
5+
/docs/ @FuelLabs/tooling @FuelLabs/sway-compiler @FuelLabs/onchain @FuelLabs/Devrel
66

77
# Sway files and standard library
8-
/examples/ @FuelLabs/sway-compiler @FuelLabs/swayex
9-
/sway-lib-std/ @FuelLabs/sway-compiler @FuelLabs/swayex
8+
/examples/ @FuelLabs/sway-compiler @FuelLabs/onchain
9+
/sway-lib-std/ @FuelLabs/sway-compiler @FuelLabs/onchain
1010

1111
# Tooling
1212
/forc/ @FuelLabs/tooling

.github/workflows/ci.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,16 @@ jobs:
221221
run: cargo install --locked --debug --path ./forc
222222
- name: Install Forc plugins
223223
run: |
224-
cargo install --locked --debug --path ./forc-plugins/forc-fmt
225-
cargo install --locked --debug --path ./forc-plugins/forc-lsp
226224
cargo install --locked --debug --path ./forc-plugins/forc-client
225+
cargo install --locked --debug --path ./forc-plugins/forc-crypto
227226
cargo install --locked --debug --path ./forc-plugins/forc-debug
228227
cargo install --locked --debug --path ./forc-plugins/forc-doc
229-
cargo install --locked --debug --path ./forc-plugins/forc-tx
230-
cargo install --locked --debug --path ./forc-plugins/forc-crypto
231-
cargo install --locked --debug --path ./forc-plugins/forc-node
228+
cargo install --locked --debug --path ./forc-plugins/forc-fmt
229+
cargo install --locked --debug --path ./forc-plugins/forc-lsp
232230
cargo install --locked --debug --path ./forc-plugins/forc-migrate
231+
cargo install --locked --debug --path ./forc-plugins/forc-node
232+
cargo install --locked --debug --path ./forc-plugins/forc-publish
233+
cargo install --locked --debug --path ./forc-plugins/forc-tx
233234
cargo install --locked --debug forc-explore
234235
- name: Install mdbook-forc-documenter
235236
run: cargo install --locked --debug --path ./scripts/mdbook-forc-documenter
@@ -992,13 +993,13 @@ jobs:
992993
- name: Strip release binaries x86_64-linux-gnu
993994
if: matrix.job.target == 'x86_64-unknown-linux-gnu'
994995
run: |
995-
for BINARY in forc forc-fmt forc-lsp forc-debug forc-deploy forc-run forc-doc forc-crypto forc-tx forc-submit forc-migrate forc-node; do
996+
for BINARY in forc forc-fmt forc-lsp forc-debug forc-deploy forc-run forc-doc forc-crypto forc-tx forc-submit forc-migrate forc-node forc-publish; do
996997
strip "target/${{ matrix.job.target }}/release/$BINARY"
997998
done
998999
- name: Strip release binaries aarch64-linux-gnu
9991000
if: matrix.job.target == 'aarch64-unknown-linux-gnu'
10001001
run: |
1001-
for BINARY in forc forc-fmt forc-lsp forc-debug forc-deploy forc-run forc-doc forc-crypto forc-tx forc-submit forc-migrate forc-node; do
1002+
for BINARY in forc forc-fmt forc-lsp forc-debug forc-deploy forc-run forc-doc forc-crypto forc-tx forc-submit forc-migrate forc-node forc-publish; do
10021003
docker run --rm -v \
10031004
"$PWD/target:/target:Z" \
10041005
ghcr.io/cross-rs/${{ matrix.job.target }}:main \
@@ -1008,7 +1009,7 @@ jobs:
10081009
- name: Strip release binaries mac
10091010
if: matrix.job.os == 'macos-latest'
10101011
run: |
1011-
for BINARY in forc forc-fmt forc-lsp forc-debug forc-deploy forc-run forc-doc forc-crypto forc-tx forc-submit forc-migrate forc-node; do
1012+
for BINARY in forc forc-fmt forc-lsp forc-debug forc-deploy forc-run forc-doc forc-crypto forc-tx forc-submit forc-migrate forc-node forc-publish; do
10121013
strip -x "target/${{ matrix.job.target }}/release/$BINARY"
10131014
done
10141015
@@ -1022,7 +1023,7 @@ jobs:
10221023
ZIP_FILE_NAME=forc-binaries-${{ env.PLATFORM_NAME }}_${{ env.ARCH }}.tar.gz
10231024
echo "ZIP_FILE_NAME=$ZIP_FILE_NAME" >> $GITHUB_ENV
10241025
mkdir -pv ./forc-binaries
1025-
for BINARY in forc forc-fmt forc-lsp forc-debug forc-deploy forc-run forc-doc forc-crypto forc-tx forc-submit forc-migrate forc-node; do
1026+
for BINARY in forc forc-fmt forc-lsp forc-debug forc-deploy forc-run forc-doc forc-crypto forc-tx forc-submit forc-migrate forc-node forc-publish; do
10261027
cp "target/${{ matrix.job.target }}/release/$BINARY" ./forc-binaries
10271028
done
10281029
tar -czvf $ZIP_FILE_NAME ./forc-binaries

.github/workflows/gh-pages.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ jobs:
2525
args: --locked --debug --path ./forc
2626
- name: Install Forc plugins
2727
run: |
28-
cargo install --locked --debug --path ./forc-plugins/forc-fmt
29-
cargo install --locked --debug --path ./forc-plugins/forc-lsp
3028
cargo install --locked --debug --path ./forc-plugins/forc-client
29+
cargo install --locked --debug --path ./forc-plugins/forc-crypto
3130
cargo install --locked --debug --path ./forc-plugins/forc-debug
31+
cargo install --locked --debug --path ./forc-plugins/forc-fmt
3232
cargo install --locked --debug --path ./forc-plugins/forc-doc
33-
cargo install --locked --debug --path ./forc-plugins/forc-crypto
33+
cargo install --locked --debug --path ./forc-plugins/forc-lsp
3434
cargo install --locked --debug --path ./forc-plugins/forc-migrate
3535
cargo install --locked --debug --path ./forc-plugins/forc-node
36+
cargo install --locked --debug --path ./forc-plugins/forc-publish
3637
cargo install --locked --debug forc-explore
3738
- name: Install mdbook-forc-documenter
3839
uses: actions-rs/cargo@v1

.github/workflows/scripts/verify_tag.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ for toml_path in \
5757
"workspace.dependencies.forc-lsp.version" \
5858
"workspace.dependencies.forc-tx.version" \
5959
"workspace.dependencies.forc-migrate.version" \
60+
"workspace.dependencies.forc-publish.version" \
6061
"workspace.dependencies.sway-ast.version" \
6162
"workspace.dependencies.sway-core.version" \
6263
"workspace.dependencies.sway-error.version" \

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fuel-abi-types = "0.8"
8989
# Although ALL verions are "X.Y", we need the complete semver for
9090
# fuel-core-client as the GitHub Actions workflow parses this value to pull down
9191
# the correct tarball
92-
fuel-core-client = { version = "0.43.1", default-features = false }
92+
fuel-core-client = { version = "0.43.2", default-features = false }
9393
fuel-core-types = { version = "0.43", default-features = false }
9494

9595
# Dependencies from the `fuels-rs` repository:

docs/book/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,4 @@
107107
- [forc lsp](./forc/plugins/forc_lsp.md)
108108
- [forc migrate](./forc/plugins/forc_migrate.md)
109109
- [forc node](./forc/plugins/forc_node.md)
110+
- [forc publish](./forc/plugins/forc_publish.md)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# forc publish

forc-plugins/forc-doc/src/render/item/type_anchor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub(crate) fn render_type_anchor(
2727
render_plan,
2828
current_module_info,
2929
)?;
30-
let len_string = format!("{:?}", render_plan.engines.help_out(len));
30+
let len_string = format!("{:?}", render_plan.engines.help_out(len.expr()));
3131
Ok(box_html! {
3232
: "[";
3333
: inner;

forc-plugins/forc-publish/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use forc_tracing::{
99
use tempfile::tempdir;
1010
use url::Url;
1111

12-
const FORC_PUB_URL: &str = "https://forc-pub-dev.swayswap.io";
12+
const FORC_PUB_URL: &str = "https://api.forc.pub";
1313

1414
#[derive(Parser, Debug)]
1515
#[clap(name = "forc-publish", version)]

sway-ast/src/item/item_const.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::priv_prelude::*;
22

33
#[derive(Clone, Debug, Serialize)]
44
pub struct ItemConst {
5-
pub visibility: Option<PubToken>,
5+
pub pub_token: Option<PubToken>,
66
pub const_token: ConstToken,
77
pub name: Ident,
88
pub ty_opt: Option<(ColonToken, Ty)>,
@@ -13,7 +13,7 @@ pub struct ItemConst {
1313

1414
impl Spanned for ItemConst {
1515
fn span(&self) -> Span {
16-
let start = match &self.visibility {
16+
let start = match &self.pub_token {
1717
Some(pub_token) => pub_token.span(),
1818
None => self.const_token.span(),
1919
};

sway-ast/src/ty/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pub enum Ty {
3030
Never {
3131
bang_token: BangToken,
3232
},
33+
Expr(Box<Expr>),
3334
}
3435

3536
impl Spanned for Ty {
@@ -54,6 +55,7 @@ impl Spanned for Ty {
5455
ty,
5556
} => Span::join(ampersand_token.span(), &ty.span()),
5657
Ty::Never { bang_token } => bang_token.span(),
58+
Ty::Expr(expr) => expr.span(),
5759
}
5860
}
5961
}

sway-core/src/abi_generation/abi_str.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ impl TypeId {
5050
}
5151
(TypeInfo::Array(_, length), TypeInfo::Array(type_arg, resolved_length)) => {
5252
assert_eq!(
53-
length.as_literal_val().unwrap(),
54-
resolved_length.as_literal_val().unwrap()
53+
length.expr().as_literal_val().unwrap(),
54+
resolved_length.expr().as_literal_val().unwrap()
5555
);
5656
let inner_type = if ctx.abi_with_fully_specified_types {
5757
type_engine
@@ -60,7 +60,7 @@ impl TypeId {
6060
} else {
6161
"_".to_string()
6262
};
63-
format!("[{}; {:?}]", inner_type, engines.help_out(length))
63+
format!("[{}; {:?}]", inner_type, engines.help_out(length.expr()))
6464
}
6565
(TypeInfo::Slice(type_arg), TypeInfo::Slice(_)) => {
6666
let inner_type = if ctx.abi_with_fully_specified_types {
@@ -130,13 +130,13 @@ impl TypeInfo {
130130
Enum(decl_ref) => {
131131
let decl = decl_engine.get_enum(decl_ref);
132132
let type_params = if (ctx.abi_root_type_without_generic_type_parameters && is_root)
133-
|| decl.type_parameters.is_empty()
133+
|| decl.generic_parameters.is_empty()
134134
{
135135
"".into()
136136
} else {
137137
format!(
138138
"<{}>",
139-
decl.type_parameters
139+
decl.generic_parameters
140140
.iter()
141141
.map(|p| p.abi_str(engines, ctx, false))
142142
.collect::<Vec<_>>()
@@ -152,13 +152,13 @@ impl TypeInfo {
152152
Struct(decl_ref) => {
153153
let decl = decl_engine.get_struct(decl_ref);
154154
let type_params = if (ctx.abi_root_type_without_generic_type_parameters && is_root)
155-
|| decl.type_parameters.is_empty()
155+
|| decl.generic_parameters.is_empty()
156156
{
157157
"".into()
158158
} else {
159159
format!(
160160
"<{}>",
161-
decl.type_parameters
161+
decl.generic_parameters
162162
.iter()
163163
.map(|p| p.abi_str(engines, ctx, false))
164164
.collect::<Vec<_>>()
@@ -178,7 +178,7 @@ impl TypeInfo {
178178
format!(
179179
"[{}; {:?}]",
180180
elem_ty.abi_str(ctx, engines, false),
181-
engines.help_out(length)
181+
engines.help_out(length.expr())
182182
)
183183
}
184184
RawUntypedPtr => "raw untyped ptr".into(),

sway-core/src/abi_generation/evm_abi.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ fn get_type_str(type_id: &TypeId, engines: &Engines, resolved_type_id: TypeId) -
4747
}
4848
(TypeInfo::Array(_, length), TypeInfo::Array(_, resolved_length)) => {
4949
assert_eq!(
50-
length.as_literal_val().unwrap(),
51-
resolved_length.as_literal_val().unwrap()
50+
length.expr().as_literal_val().unwrap(),
51+
resolved_length.expr().as_literal_val().unwrap()
5252
);
53-
format!("[_; {:?}]", engines.help_out(length))
53+
format!("[_; {:?}]", engines.help_out(length.expr()))
5454
}
5555
(TypeInfo::Slice(_), TypeInfo::Slice(_)) => "__slice[_]".into(),
5656
(TypeInfo::Custom { .. }, _) => {
@@ -119,7 +119,7 @@ pub fn abi_str(type_info: &TypeInfo, engines: &Engines) -> String {
119119
format!(
120120
"{}[{:?}]",
121121
abi_str_type_arg(elem_ty, engines),
122-
engines.help_out(length),
122+
engines.help_out(length.expr()),
123123
)
124124
}
125125
RawUntypedPtr => "raw untyped ptr".into(),

sway-core/src/abi_generation/fuel_abi.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ impl TypeId {
991991

992992
let mut new_metadata_types_to_add =
993993
Vec::<program_abi::TypeMetadataDeclaration>::new();
994-
for p in decl.type_parameters.iter() {
994+
for p in decl.generic_parameters.iter() {
995995
let p = p
996996
.as_type_parameter()
997997
.expect("only works with type parameters");
@@ -1008,7 +1008,7 @@ impl TypeId {
10081008
}
10091009

10101010
let type_arguments = decl
1011-
.type_parameters
1011+
.generic_parameters
10121012
.iter()
10131013
.map(|p| {
10141014
let p = p
@@ -1045,7 +1045,7 @@ impl TypeId {
10451045

10461046
let mut new_metadata_types_to_add =
10471047
Vec::<program_abi::TypeMetadataDeclaration>::new();
1048-
for p in decl.type_parameters.iter() {
1048+
for p in decl.generic_parameters.iter() {
10491049
let p = p
10501050
.as_type_parameter()
10511051
.expect("only works with type parameters");
@@ -1062,7 +1062,7 @@ impl TypeId {
10621062
}
10631063

10641064
let type_arguments = decl
1065-
.type_parameters
1065+
.generic_parameters
10661066
.iter()
10671067
.map(|p| {
10681068
let p = p
@@ -1141,7 +1141,7 @@ impl TypeId {
11411141
TypeInfo::Enum(decl_ref) => {
11421142
let decl = decl_engine.get_enum(decl_ref);
11431143
Some(
1144-
decl.type_parameters
1144+
decl.generic_parameters
11451145
.iter()
11461146
.map(|p| {
11471147
let p = p
@@ -1163,7 +1163,7 @@ impl TypeId {
11631163
TypeInfo::Struct(decl_ref) => {
11641164
let decl = decl_engine.get_struct(decl_ref);
11651165
Some(
1166-
decl.type_parameters
1166+
decl.generic_parameters
11671167
.iter()
11681168
.map(|p| {
11691169
let p = p

sway-core/src/control_flow_analysis/dead_code_analysis.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ fn get_struct_type_info_from_type_id(
925925
match type_info {
926926
TypeInfo::Enum(decl_ref) => {
927927
let decl = decl_engine.get_enum(&decl_ref);
928-
for p in decl.type_parameters.iter() {
928+
for p in decl.generic_parameters.iter() {
929929
let p = p
930930
.as_type_parameter()
931931
.expect("only works with type parameters");
@@ -2515,7 +2515,7 @@ fn connect_type_id<'eng: 'cfg, 'cfg>(
25152515
if let Some(enum_idx) = enum_idx.cloned() {
25162516
graph.add_edge(entry_node, enum_idx, "".into());
25172517
}
2518-
for p in &decl.type_parameters {
2518+
for p in &decl.generic_parameters {
25192519
let p = p
25202520
.as_type_parameter()
25212521
.expect("only works with type parameters");
@@ -2528,10 +2528,11 @@ fn connect_type_id<'eng: 'cfg, 'cfg>(
25282528
if let Some(struct_idx) = struct_idx.cloned() {
25292529
graph.add_edge(entry_node, struct_idx, "".into());
25302530
}
2531-
for p in &decl.type_parameters {
2532-
let p = p
2533-
.as_type_parameter()
2534-
.expect("only works with type parameters");
2531+
for p in decl
2532+
.generic_parameters
2533+
.iter()
2534+
.filter_map(|x| x.as_type_parameter())
2535+
{
25352536
connect_type_id(engines, p.type_id, graph, entry_node)?;
25362537
}
25372538
}

sway-core/src/ir_generation/convert.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,10 @@ fn convert_resolved_type_info(
122122
context,
123123
&decl_engine.get_enum(decl_ref).variants,
124124
)?,
125-
TypeInfo::Array(elem_type, length) if length.as_literal_val().is_some() => {
125+
TypeInfo::Array(elem_type, length) if length.expr().as_literal_val().is_some() => {
126126
// SAFETY: Safe by the guard above
127127
let len = length
128+
.expr()
128129
.as_literal_val()
129130
.expect("unexpected non literal array length");
130131

0 commit comments

Comments
 (0)