Skip to content

Commit 6f9b624

Browse files
authored
Fix build and 1.86.0 clippies (#1790)
- Fix rust 1.86.0 clippies - Build with rust 1.82.0 - required by dependencies - Remove repolinter as it is not working and no longer required by hyperledger Signed-off-by: Sean Young <sean@mess.org>
1 parent 71f0aa3 commit 6f9b624

File tree

10 files changed

+23
-41
lines changed

10 files changed

+23
-41
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
uses: actions/checkout@v4
1616
with:
1717
submodules: recursive
18-
- uses: dtolnay/rust-toolchain@1.81.0
18+
- uses: dtolnay/rust-toolchain@1.82.0
1919
- name: Build
2020
run: cargo build --verbose --release
2121
- name: Run tests
@@ -41,7 +41,7 @@ jobs:
4141
run: |
4242
sudo apt-get update
4343
sudo apt-get install -y gcc g++ make
44-
- uses: dtolnay/rust-toolchain@1.81.0
44+
- uses: dtolnay/rust-toolchain@1.82.0
4545
- name: Get LLVM
4646
run: curl -sSL --output llvm16.0-linux-arm64.tar.xz https://github.com/hyperledger-solang/solang-llvm/releases/download/llvm16-0/llvm16.0-linux-arm64.tar.xz
4747
- name: Extract LLVM
@@ -74,7 +74,7 @@ jobs:
7474
run: unzip c:\llvm.zip -d c:/
7575
- name: Add LLVM to Path
7676
run: echo "c:\llvm16.0\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
77-
- uses: dtolnay/rust-toolchain@1.81.0
77+
- uses: dtolnay/rust-toolchain@1.82.0
7878
with:
7979
components: clippy
8080
- name: Build
@@ -97,7 +97,7 @@ jobs:
9797
uses: actions/checkout@v4
9898
with:
9999
submodules: recursive
100-
- uses: dtolnay/rust-toolchain@1.81.0
100+
- uses: dtolnay/rust-toolchain@1.82.0
101101
- name: Get LLVM
102102
run: curl -sSL --output llvm16.0-mac-arm.tar.xz https://github.com/hyperledger-solang/solang-llvm/releases/download/llvm16-0/llvm16.0-mac-arm.tar.xz
103103
- name: Extract LLVM
@@ -124,7 +124,7 @@ jobs:
124124
uses: actions/checkout@v4
125125
with:
126126
submodules: recursive
127-
- uses: dtolnay/rust-toolchain@1.81.0
127+
- uses: dtolnay/rust-toolchain@1.82.0
128128
- name: Get LLVM
129129
run: wget -q -O llvm16.0-mac-intel.tar.xz https://github.com/hyperledger-solang/solang-llvm/releases/download/llvm16-0/llvm16.0-mac-intel.tar.xz
130130
- name: Extract LLVM

.github/workflows/test.yml

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,6 @@ env:
1010
LLVM_PROFILE_FILE: ${{ github.workspace }}/target/solang-%p-%10m.profraw
1111

1212
jobs:
13-
repolinter:
14-
name: Repolinter
15-
runs-on: solang-ubuntu-latest
16-
# spdx runs on python 3.10 but not any later versions
17-
container: ubuntu:22.04
18-
steps:
19-
- name: Install Python and npm
20-
run: |
21-
apt-get update
22-
apt-get install -y python3 git npm
23-
- name: Checkout sources
24-
uses: actions/checkout@v4
25-
- name: Run repolinter
26-
run: npx repolinter --rulesetUrl https://raw.githubusercontent.com/hyperledger-labs/hyperledger-community-management-tools/master/repo_structure/repolint.json
27-
- uses: enarx/spdx@master
28-
with:
29-
licenses: Apache-2.0
30-
3113
docs:
3214
name: Docs
3315
runs-on: solang-ubuntu-latest
@@ -69,7 +51,7 @@ jobs:
6951
- name: Install Rust
7052
uses: dtolnay/rust-toolchain@master
7153
with:
72-
toolchain: 1.81.0
54+
toolchain: 1.82.0
7355
components: |
7456
llvm-tools
7557
clippy
@@ -126,7 +108,7 @@ jobs:
126108
run: |
127109
sudo apt-get update
128110
sudo apt-get install -y gcc g++ make
129-
- uses: dtolnay/rust-toolchain@1.81.0
111+
- uses: dtolnay/rust-toolchain@1.82.0
130112
- name: Get LLVM
131113
run: curl -sSL --output llvm16.0-linux-arm64.tar.xz https://github.com/hyperledger-solang/solang-llvm/releases/download/llvm16-0/llvm16.0-linux-arm64.tar.xz
132114
- name: Extract LLVM
@@ -159,7 +141,7 @@ jobs:
159141
# Use C:\ as D:\ might run out of space
160142
- name: "Use C: for rust temporary files"
161143
run: echo "CARGO_TARGET_DIR=C:\target" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
162-
- uses: dtolnay/rust-toolchain@1.81.0
144+
- uses: dtolnay/rust-toolchain@1.82.0
163145
with:
164146
components: clippy
165147
# We run clippy on Linux in the lint job above, but this does not check #[cfg(windows)] items
@@ -185,7 +167,7 @@ jobs:
185167
uses: actions/checkout@v4
186168
with:
187169
submodules: recursive
188-
- uses: dtolnay/rust-toolchain@1.81.0
170+
- uses: dtolnay/rust-toolchain@1.82.0
189171
- name: Get LLVM
190172
run: curl -sSL --output llvm16.0-mac-arm.tar.xz https://github.com/hyperledger-solang/solang-llvm/releases/download/llvm16-0/llvm16.0-mac-arm.tar.xz
191173
- name: Extract LLVM
@@ -211,7 +193,7 @@ jobs:
211193
uses: actions/checkout@v4
212194
with:
213195
submodules: recursive
214-
- uses: dtolnay/rust-toolchain@1.81.0
196+
- uses: dtolnay/rust-toolchain@1.82.0
215197
- name: Get LLVM
216198
run: wget -q -O llvm16.0-mac-intel.tar.xz https://github.com/hyperledger-solang/solang-llvm/releases/download/llvm16-0/llvm16.0-mac-intel.tar.xz
217199
- name: Extract LLVM
@@ -273,7 +255,7 @@ jobs:
273255
- uses: actions/setup-node@v4
274256
with:
275257
node-version: '16'
276-
- uses: dtolnay/rust-toolchain@1.81.0
258+
- uses: dtolnay/rust-toolchain@1.82.0
277259
- name: Setup yarn
278260
run: npm install -g yarn
279261
- uses: actions/download-artifact@v4.1.8
@@ -324,7 +306,7 @@ jobs:
324306
- uses: actions/setup-node@v4
325307
with:
326308
node-version: '16'
327-
- uses: dtolnay/rust-toolchain@1.81.0
309+
- uses: dtolnay/rust-toolchain@1.82.0
328310
with:
329311
target: wasm32-unknown-unknown
330312
- uses: actions/download-artifact@v4.1.8
@@ -371,7 +353,7 @@ jobs:
371353
- uses: actions/setup-node@v4
372354
with:
373355
node-version: '16'
374-
- uses: dtolnay/rust-toolchain@1.81.0
356+
- uses: dtolnay/rust-toolchain@1.82.0
375357
- uses: actions/download-artifact@v4.1.8
376358
with:
377359
name: solang-linux-x86-64
@@ -548,7 +530,7 @@ jobs:
548530
- name: Install Rust
549531
uses: dtolnay/rust-toolchain@master
550532
with:
551-
toolchain: 1.81.0
533+
toolchain: 1.82.0
552534
components: llvm-tools
553535
- name: Install cargo-llvm-cov
554536
uses: taiki-e/install-action@cargo-llvm-cov

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "Apache-2.0"
88
build = "build.rs"
99
description = "Solang Solidity Compiler"
1010
keywords = [ "solidity", "compiler", "solana", "polkadot", "substrate" ]
11-
rust-version = "1.81.0"
11+
rust-version = "1.82.0"
1212
edition = "2021"
1313
exclude = [ "/.*", "/docs", "/examples", "/solana-library", "/tests", "/integration", "/vscode", "/testdata" ]
1414

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ COPY . src
44
WORKDIR /src/stdlib/
55
RUN make
66

7-
RUN rustup default 1.81.0
7+
RUN rustup default 1.82.0
88

99
WORKDIR /src
1010
RUN cargo build --release

docs/installing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Option 5: Build Solang from source
8989

9090
In order to build Solang from source, you will need:
9191

92-
* Rust version 1.81.0 or higher
92+
* Rust version 1.82.0 or higher
9393
* A C++ compiler with support for C++17
9494
* A build of LLVM based on the Solana LLVM tree. There are a few LLVM patches required that are not upstream yet.
9595

fmt/src/buffer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl<W> FormatBuffer<W> {
9191
/// Indent the buffer by delta
9292
pub fn indent(&mut self, delta: usize) {
9393
self.indents
94-
.extend(std::iter::repeat(IndentGroup::default()).take(delta));
94+
.extend(std::iter::repeat_n(IndentGroup::default(), delta));
9595
}
9696

9797
/// Dedent the buffer by delta

fmt/src/comments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl CommentWithMetadata {
9393
return Self::new(
9494
comment,
9595
CommentPosition::Prefix,
96-
last_line.map_or(true, str::is_empty),
96+
last_line.is_none_or(str::is_empty),
9797
indent_len,
9898
);
9999
}

solang-parser/src/pt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,7 @@ impl FunctionDefinition {
15321532
/// Returns `true` if the function body is empty.
15331533
#[inline]
15341534
pub fn is_empty(&self) -> bool {
1535-
self.body.as_ref().map_or(true, Statement::is_empty)
1535+
self.body.as_ref().is_none_or(Statement::is_empty)
15361536
}
15371537

15381538
/// Sorts the function attributes.

src/sema/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,8 +1640,8 @@ impl Type {
16401640
match self {
16411641
Type::Contract(_) | Type::Address(_) => ns.address_length as u8,
16421642
Type::Bool => 1,
1643-
Type::Int(n) => ((*n + 7) / 8) as u8,
1644-
Type::Uint(n) => ((*n + 7) / 8) as u8,
1643+
Type::Int(n) => (*n).div_ceil(8) as u8,
1644+
Type::Uint(n) => (*n).div_ceil(8) as u8,
16451645
Type::Rational => unreachable!(),
16461646
Type::Bytes(n) => *n,
16471647
Type::Enum(n) => ns.enums[*n].ty.bytes(ns),

tests/lir_tests/convert_lir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn assert_lir_str_eq_by_name(src: &str, cfg_name: &str, expected: &str, target:
5252
.cfg
5353
.iter()
5454
.filter(|cfg| cfg.name == cfg_name)
55-
.last()
55+
.next_back()
5656
.unwrap();
5757

5858
let converter = Converter::new(&ns, cfg);

0 commit comments

Comments
 (0)