Skip to content

Commit c246d5c

Browse files
authored
Rust: Bump MSRV to 1.88 (#9640)
As required by the upcoming WGPU 27 update
1 parent 427cdaf commit c246d5c

File tree

9 files changed

+11
-76
lines changed

9 files changed

+11
-76
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
strategy:
5050
matrix:
5151
os: [ubuntu-22.04, macos-14, windows-2022]
52-
rust_version: [stable, "1.85"]
52+
rust_version: [stable, "1.88"]
5353
include:
5454
- os: windows-2022
5555
extra_args: "--exclude ffmpeg --exclude gstreamer-player"
@@ -60,13 +60,11 @@ jobs:
6060
extra_args: "--exclude ffmpeg --exclude gstreamer-player"
6161
- os: ubuntu-22.04
6262
rust_version: "nightly"
63-
# Bevy requires 1.86, won't compile with 1.85
64-
- rust_version: "1.85"
65-
maybe_exclude_bevy: "--exclude bevy-example"
6663
exclude:
64+
# There is only a limited amount of mac worker machine allocated and this is currently the bottleneck, so disable it
6765
- os: macos-14
68-
rust_version: "1.85"
69-
# We already test 1.85 and nightly. Stable is in the middle and already covered by other jobs
66+
rust_version: "1.88"
67+
# We already test 1.88 and nightly. Stable is in the middle and already covered by other jobs
7068
- os: ubuntu-22.04
7169
rust_version: "stable"
7270

@@ -274,7 +272,7 @@ jobs:
274272
matrix:
275273
include:
276274
- os: macos-14
277-
rust_version: "1.85"
275+
rust_version: "1.88"
278276
- os: windows-2022
279277
rust_version: "nightly"
280278
- os: ubuntu-22.04

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ All notable changes to this project are documented in this file.
3737

3838
### Rust
3939

40+
- Minimum Supported Rust Version (MSRV) is 1.88
4041
- Slint macro: Use new Rust 1.88 API proc_macro API to be able to access file relative to the .rs file
4142
- Fixed error in generated Rust code when convering some expressions to void
4243

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ homepage = "https://slint.dev"
113113
keywords = ["gui", "toolkit", "graphics", "design", "ui"]
114114
license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0"
115115
repository = "https://github.com/slint-ui/slint"
116-
rust-version = "1.85"
116+
rust-version = "1.88"
117117
version = "1.14.0"
118118

119119
[workspace.dependencies]

api/cpp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if (NOT Corrosion_FOUND)
2222
endif (NOT Corrosion_FOUND)
2323

2424
list(PREPEND CMAKE_MODULE_PATH ${Corrosion_SOURCE_DIR}/cmake)
25-
find_package(Rust 1.85 REQUIRED MODULE)
25+
find_package(Rust 1.88 REQUIRED MODULE)
2626

2727
option(BUILD_SHARED_LIBS "Build Slint as shared library" ON)
2828
option(SLINT_FEATURE_COMPILER "Enable support for compiling .slint files to C++ ahead of time" ON)

api/cpp/docs/cmake.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ In the next section you will learn how to use the installed library in your appl
4949
First you need to install the prerequisites:
5050

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

5555
You can either choose to compile Slint from source along with your application or include Slint as an external CMake package.

api/cpp/docs/mcu/generic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ following generic instructions on what's needed to compile and use Slint.
99
## Prerequisites
1010

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

1515
* A C++ cross-compiler compiler that supports C++20.

api/rs/macros/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ default = []
2323

2424
[dependencies]
2525
i-slint-compiler = { workspace = true, features = ["default", "proc_macro_span", "rust", "display-diagnostics"] }
26-
rustversion = "1.0"
2726
proc-macro2 = "1.0.17"
2827
quote = "1.0"
2928
spin_on = { workspace = true }

api/rs/macros/lib.rs

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use std::path::PathBuf;
1919
/// it was written like so in the source code: `foo-` but not when written like so `foo -`
2020
///
2121
/// Returns None if we couldn't detect whether they are touching (eg, our heuristics don't work with rust-analyzer)
22-
#[rustversion::since(1.88)]
2322
fn are_token_touching(token1: proc_macro::Span, token2: proc_macro::Span) -> Option<bool> {
2423
let t1 = token1.end();
2524
let t2 = token2.start();
@@ -31,63 +30,6 @@ fn are_token_touching(token1: proc_macro::Span, token2: proc_macro::Span) -> Opt
3130
}
3231
Some(t1.line() == t2.line() && t1_column == t2.column())
3332
}
34-
#[rustversion::before(1.88)]
35-
fn are_token_touching(token1: proc_macro::Span, token2: proc_macro::Span) -> Option<bool> {
36-
// There is no way with stable API to find out if the token are touching, so do it by
37-
// extracting the range from the debug representation of the span
38-
are_token_touching_impl(&format!("{token1:?}"), &format!("{token2:?}"))
39-
}
40-
41-
#[rustversion::before(1.88)]
42-
fn are_token_touching_impl(token1_debug: &str, token2_debug: &str) -> Option<bool> {
43-
// The debug representation of a span look like this: "#0 bytes(6662789..6662794)"
44-
// we just have to find out if the first number of the range of second span
45-
// is the same as the second number of the first span
46-
let is_byte_char = |c: char| c.is_numeric() || c == ':';
47-
let not_is_byte_char = |c: char| !is_byte_char(c);
48-
let end_of_token1 = token1_debug
49-
.trim_end_matches(not_is_byte_char)
50-
.rsplit(not_is_byte_char)
51-
.next()?
52-
.trim_matches(':');
53-
let begin_of_token2 = token2_debug
54-
.trim_end_matches(not_is_byte_char)
55-
.strip_suffix(is_byte_char)?
56-
.trim_end_matches(is_byte_char)
57-
.trim_end_matches(not_is_byte_char)
58-
.rsplit(not_is_byte_char)
59-
.next()?
60-
.trim_matches(':');
61-
(!begin_of_token2.is_empty()).then_some(end_of_token1 == begin_of_token2)
62-
}
63-
64-
#[rustversion::before(1.88)]
65-
#[test]
66-
fn are_token_touching_impl_test() {
67-
assert!(are_token_touching_impl("#0 bytes(6662788..6662789)", "#0 bytes(6662789..6662794)")
68-
.unwrap());
69-
assert!(!are_token_touching_impl("#0 bytes(6662788..6662789)", "#0 bytes(6662790..6662794)")
70-
.unwrap());
71-
assert!(!are_token_touching_impl("#0 bytes(6662789..6662794)", "#0 bytes(6662788..6662789)")
72-
.unwrap());
73-
assert!(
74-
!are_token_touching_impl("#0 bytes(6662788..6662789)", "#0 bytes(662789..662794)").unwrap()
75-
);
76-
assert!(are_token_touching_impl("#0 bytes(123..456)", "#0 bytes(456..789)").unwrap());
77-
78-
// Alternative representation on nightly with a special flag
79-
assert!(are_token_touching_impl("/foo/bar.rs:12:7: 12:18", "/foo/bar.rs:12:18: 12:19").unwrap());
80-
assert!(are_token_touching_impl("/foo/bar.rs:2:7: 13:18", "/foo/bar.rs:13:18: 14:29").unwrap());
81-
assert!(!are_token_touching_impl("/foo/bar.rs:2:7: 13:18", "/foo/bar.rs:14:18: 14:29").unwrap());
82-
assert!(!are_token_touching_impl("/foo/bar.rs:2:7: 2:8", "/foo/bar.rs:2:18: 2:29").unwrap());
83-
84-
// What happens if the representation change
85-
assert!(are_token_touching_impl("hello", "hello").is_none());
86-
assert!(are_token_touching_impl("hello42", "hello42").is_none());
87-
88-
// rust-analyzer just has indices that means nothing
89-
assert!(are_token_touching_impl("55", "56").is_none());
90-
}
9133

9234
fn fill_token_vec(stream: impl Iterator<Item = TokenTree>, vec: &mut Vec<parser::Token>) {
9335
let mut prev_spacing = Spacing::Alone;
@@ -410,14 +352,9 @@ pub fn slint(stream: TokenStream) -> TokenStream {
410352
let mut tokens = vec![];
411353
fill_token_vec(token_iter, &mut tokens);
412354

413-
#[rustversion::since(1.88)]
414355
fn local_file(tokens: &[parser::Token]) -> Option<PathBuf> {
415356
tokens.first()?.span?.local_file()
416357
}
417-
#[rustversion::before(1.88)]
418-
fn local_file(_: &[parser::Token]) -> Option<PathBuf> {
419-
None
420-
}
421358

422359
let source_file = if let Some(path) = local_file(&tokens) {
423360
diagnostics::SourceFileInner::from_path_only(path)

docs/building.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This page explains how to build and test Slint.
99
### Installing Rust
1010

1111
Install Rust by following the [Rust Getting Started Guide](https://www.rust-lang.org/learn/get-started). If you already
12-
have Rust installed, make sure that it's at least version 1.85 or newer. You can check which version you have installed
12+
have Rust installed, make sure that it's at least version 1.88 or newer. You can check which version you have installed
1313
by running `rustc --version`.
1414

1515
Once this is done, you should have the `rustc` compiler and the `cargo` build system installed in your path.

0 commit comments

Comments
 (0)