Skip to content

Commit

Permalink
Bump MSRV to 1.82
Browse files Browse the repository at this point in the history
Fixes #7254
  • Loading branch information
tronical committed Jan 14, 2025
1 parent d17d5dd commit 980461d
Show file tree
Hide file tree
Showing 18 changed files with 1,849 additions and 18 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-22.04, macos-14, windows-2022]
rust_version: [stable, "1.77"]
rust_version: [stable, "1.82"]
include:
- os: windows-2022
extra_args: "--exclude ffmpeg --exclude gstreamer-player"
Expand All @@ -43,8 +43,8 @@ jobs:
rust_version: "nightly"
exclude:
- os: macos-14
rust_version: "1.77"
# We already test 1.77 and nightly. Stable is in the middle and already covered by other jobs
rust_version: "1.82"
# We already test 1.82 and nightly. Stable is in the middle and already covered by other jobs
- os: ubuntu-22.04
rust_version: "stable"

Expand Down Expand Up @@ -78,13 +78,13 @@ jobs:
with:
toolchain: ${{ matrix.rust_version }}
key: x-v3
- name: Pin dependencies to make it build with our MSRV
if: matrix.rust_version == '1.77'
shell: bash
run: |
if [ ! -f ./Cargo.lock ]; then
cargo update -p home --precise 0.5.9
fi
# - name: Pin dependencies to make it build with our MSRV
# if: matrix.rust_version == '1.82'
# shell: bash
# run: |
# if [ ! -f ./Cargo.lock ]; then
# cargo update -p home --precise 0.5.9
# fi
- name: Run tests (not qt)
run: cargo test --verbose --all-features --workspace ${{ matrix.extra_args }} --exclude slint-node --exclude pyslint --exclude test-driver-node --exclude slint-node --exclude test-driver-nodejs --exclude test-driver-cpp --exclude mcu-board-support --exclude printerdemo_mcu --exclude uefi-demo --exclude slint-cpp --exclude slint-python -- --skip=_qt::t
env:
Expand Down Expand Up @@ -233,7 +233,7 @@ jobs:
matrix:
include:
- os: macos-14
rust_version: "1.77"
rust_version: "1.82"
- os: windows-2022
rust_version: "nightly"
- os: ubuntu-22.04
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
# Changelog
All notable changes to this project are documented in this file.

## 1.10.0 - Unreleased

### General

- Minimum Supported Rust Version (MSRV) is 1.82.

## 1.9.2 - 2025-01-13

### General
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ homepage = "https://slint.dev"
keywords = ["gui", "toolkit", "graphics", "design", "ui"]
license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0"
repository = "https://github.com/slint-ui/slint"
rust-version = "1.77"
rust-version = "1.82"
version = "1.10.0"

[workspace.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion api/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ FetchContent_Declare(
FetchContent_MakeAvailable(Corrosion)

list(PREPEND CMAKE_MODULE_PATH ${Corrosion_SOURCE_DIR}/cmake)
find_package(Rust 1.77 REQUIRED MODULE)
find_package(Rust 1.82 REQUIRED MODULE)

option(BUILD_SHARED_LIBS "Build Slint as shared library" ON)
option(SLINT_FEATURE_COMPILER "Enable support for compiling .slint files to C++ ahead of time" ON)
Expand Down
2 changes: 1 addition & 1 deletion api/cpp/docs/cmake.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ In the next section you will learn how to use the installed library in your appl
First you need to install the prerequisites:

* Install Rust by following the [Rust Getting Started Guide](https://www.rust-lang.org/learn/get-started). If you already
have Rust installed, make sure that it's at least version 1.77 or newer. You can check which version you have installed
have Rust installed, make sure that it's at least version 1.82 or newer. You can check which version you have installed
by running `rustc --version`. Once this is done, you should have the `rustc` compiler and the `cargo` build system installed in your path.

You can either choose to compile Slint from source along with your application or include Slint as an external CMake package.
Expand Down
2 changes: 1 addition & 1 deletion api/cpp/docs/mcu/generic.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ following generic instructions on what's needed to compile and use Slint.
## Prerequisites

* Install Rust by following the [Rust Getting Started Guide](https://www.rust-lang.org/learn/get-started). If you already
have Rust installed, make sure that it's at least version 1.77 or newer. You can check which version you have installed
have Rust installed, make sure that it's at least version 1.82 or newer. You can check which version you have installed
by running `rustc --version`. Once this is done, you should have the `rustc` compiler and the `cargo` build system installed in your path.

* A C++ cross-compiler compiler that supports C++20.
Expand Down
2 changes: 1 addition & 1 deletion api/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ You need to install the following components:

* **[Node.js](https://nodejs.org/download/release/)** (v16. or newer)
* **[pnpm](https://www.pnpm.io/)**
* **[Rust compiler](https://www.rust-lang.org/tools/install)** (1.77 or newer)
* **[Rust compiler](https://www.rust-lang.org/tools/install)** (1.82 or newer)

You will also need a few more dependencies, see <https://github.com/slint-ui/slint/blob/master/docs/building.md#prerequisites>

Expand Down
203 changes: 203 additions & 0 deletions api/node/build/api.spec.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
// Copyright © SixtyFPS GmbH <[email protected]>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
import test from "ava";
import * as path from "node:path";
import { fileURLToPath } from "node:url";
import { loadFile, loadSource, CompileError } from "../dist/index.js";
const dirname = path.dirname(fileURLToPath(import.meta.url).replace("build", "__test__"));
// loadFile api
test("loadFile", (t) => {
const demo = loadFile(path.join(dirname, "resources/test.slint"));
const test = new demo.Test();
t.is(test.check, "Test");
const errorPath = path.join(dirname, "resources/error.slint");
const error = t.throws(() => {
loadFile(errorPath);
}, { instanceOf: CompileError });
const formattedDiagnostics = error?.diagnostics
.map((d) => `[${d.fileName}:${d.lineNumber}:${d.columnNumber}] ${d.message}`)
.join("\n");
t.is(error?.message, "Could not compile " +
errorPath +
`\nDiagnostics:\n${formattedDiagnostics}`);
t.deepEqual(error?.diagnostics, [
{
columnNumber: 18,
level: 0,
lineNumber: 5,
message: "Missing type. The syntax to declare a property is `property <type> name;`. Only two way bindings can omit the type",
fileName: errorPath,
},
{
columnNumber: 22,
level: 0,
lineNumber: 5,
message: "Syntax error: expected ';'",
fileName: errorPath,
},
{
columnNumber: 22,
level: 0,
lineNumber: 5,
message: "Parse error",
fileName: errorPath,
},
]);
});
test("loadFile constructor parameters", (t) => {
const demo = loadFile(path.join(dirname, "resources/test-constructor.slint"));
let hello = "";
const test = new demo.Test({
say_hello: function () {
hello = "hello";
},
check: "test",
});
test.say_hello();
t.is(test.check, "test");
t.is(hello, "hello");
});
test("loadFile component instances and modules are sealed", (t) => {
const demo = loadFile(path.join(dirname, "resources/test.slint"));
t.throws(() => {
demo.no_such_property = 42;
}, { instanceOf: TypeError });
const test = new demo.Test();
t.is(test.check, "Test");
t.throws(() => {
test.no_such_callback = () => { };
}, { instanceOf: TypeError });
});
// loadSource api
test("loadSource", (t) => {
const source = `export component Test {
out property <string> check: "Test";
}`;
const path = "api.spec.ts";
const demo = loadSource(source, path);
const test = new demo.Test();
t.is(test.check, "Test");
const errorSource = `export component Error {
out property bool> check: "Test";
}`;
const error = t.throws(() => {
loadSource(errorSource, path);
}, { instanceOf: CompileError });
const formattedDiagnostics = error?.diagnostics
.map((d) => `[${d.fileName}:${d.lineNumber}:${d.columnNumber}] ${d.message}`)
.join("\n");
t.is(error?.message, "Could not compile " + path + `\nDiagnostics:\n${formattedDiagnostics}`);
// console.log(error?.diagnostics)
t.deepEqual(error?.diagnostics, [
{
columnNumber: 22,
level: 0,
lineNumber: 2,
message: "Missing type. The syntax to declare a property is `property <type> name;`. Only two way bindings can omit the type",
fileName: path,
},
{
columnNumber: 26,
level: 0,
lineNumber: 2,
message: "Syntax error: expected ';'",
fileName: path,
},
{
columnNumber: 26,
level: 0,
lineNumber: 2,
message: "Parse error",
fileName: path,
},
]);
});
test("loadSource constructor parameters", (t) => {
const source = `export component Test {
callback say_hello();
in-out property <string> check;
}`;
const path = "api.spec.ts";
const demo = loadSource(source, path);
let hello = "";
const test = new demo.Test({
say_hello: function () {
hello = "hello";
},
check: "test",
});
test.say_hello();
t.is(test.check, "test");
t.is(hello, "hello");
});
test("loadSource component instances and modules are sealed", (t) => {
const source = `export component Test {
out property <string> check: "Test";
}`;
const path = "api.spec.ts";
const demo = loadSource(source, path);
t.throws(() => {
demo.no_such_property = 42;
}, { instanceOf: TypeError });
const test = new demo.Test();
t.is(test.check, "Test");
t.throws(() => {
test.no_such_callback = () => { };
}, { instanceOf: TypeError });
});
test("loadFile struct", (t) => {
const demo = loadFile(path.join(dirname, "resources/test-struct.slint"));
const test = new demo.Test({
check: new demo.TestStruct(),
});
t.deepEqual(test.check, { text: "", flag: false, value: 0 });
});
test("loadFile struct constructor parameters", (t) => {
const demo = loadFile(path.join(dirname, "resources/test-struct.slint"));
const test = new demo.Test({
check: new demo.TestStruct({ text: "text", flag: true, value: 12 }),
});
t.deepEqual(test.check, { text: "text", flag: true, value: 12 });
test.check = new demo.TestStruct({
text: "hello world",
flag: false,
value: 8,
});
t.deepEqual(test.check, { text: "hello world", flag: false, value: 8 });
});
test("loadFile struct constructor more parameters", (t) => {
const demo = loadFile(path.join(dirname, "resources/test-struct.slint"));
const test = new demo.Test({
check: new demo.TestStruct({
text: "text",
flag: true,
value: 12,
noProp: "hello",
}),
});
t.deepEqual(test.check, { text: "text", flag: true, value: 12 });
});
test("loadFile enum", (t) => {
const demo = loadFile(path.join(dirname, "resources/test-enum.slint"));
const test = new demo.Test({
check: demo.TestEnum.b,
});
t.deepEqual(test.check, "b");
test.check = demo.TestEnum.c;
t.deepEqual(test.check, "c");
});
test("file loader", (t) => {
const testSource = `export component Test {
in-out property <string> text: "Hello World";
}`;
const demo = loadFile(path.join(dirname, "resources/test-fileloader.slint"), {
fileLoader: (path) => {
if (path.includes("lib.slint")) {
return testSource;
}
return "";
},
});
const test = new demo.App();
t.deepEqual(test.test_text, "Hello World");
});
Loading

0 comments on commit 980461d

Please sign in to comment.