Skip to content

Commit b456636

Browse files
authored
Bump minimal supported rust version (MSRV) to 1.56 (#2334)
* Bump MSRV to 1.54 * add rust version to Cargo.toml * update macro test stderr * 1.56 go brrrr * 1.56 go brrrr: part 2 electric boogaloo
1 parent f6f0e34 commit b456636

File tree

26 files changed

+319
-238
lines changed

26 files changed

+319
-238
lines changed

.github/workflows/pull-request.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ jobs:
147147
strategy:
148148
matrix:
149149
toolchain:
150-
- 1.49.0 # MSRV
150+
- 1.56.0 # MSRV
151151
- stable
152152

153153
steps:
@@ -188,7 +188,7 @@ jobs:
188188
strategy:
189189
matrix:
190190
toolchain:
191-
- 1.51.0 # min version with const generics
191+
- 1.56.0 # MSRV
192192
- stable
193193
- nightly
194194

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Alternatively, you can set the `ECHO_SERVER_URL` environment variable to the URL
6060

6161
When adding or updating tests, please make sure to update the appropriate `stderr` file, which you can find [here](https://github.com/yewstack/yew/tree/master/packages/yew-macro/tests/macro) for the `html!` macro.
6262
These files ensure that macro compilation errors are correct and easy to understand.
63-
These errors can change with each release of the compiler so they should be generated with the Rust version 1.51
63+
These errors can change with each release of the compiler, so they should be generated with the Rust version 1.56
6464
(because some tests make use of const generics which were stabilized in that version).
6565

6666
To update or generate a new `stderr` file you can run `cargo make test-overwrite` in the `yew-macro` directory.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<a href="https://docs.rs/yew/"><img alt="API Docs" src="https://img.shields.io/badge/docs.rs-yew-green"/></a>
1313
<a href="https://discord.gg/VQck8X4"><img alt="Discord Chat" src="https://img.shields.io/discord/701068342760570933"/></a>
1414
<a href="https://gitlocalize.com/repo/4999"> <img src="https://gitlocalize.com/repo/4999/whole_project/badge.svg" /> </a>
15-
<a href="https://blog.rust-lang.org/2020/12/31/Rust-1.49.0.html"><img alt="Rustc Version 1.49.0+" src="https://img.shields.io/badge/rustc-1.49%2B-lightgrey.svg"/></a>
15+
<a href="https://blog.rust-lang.org/2020/12/31/Rust-1.56.0.html"><img alt="Rustc Version 1.56.0+" src="https://img.shields.io/badge/rustc-1.56%2B-lightgrey.svg"/></a>
1616
</p>
1717

1818
<h4>

packages/yew-macro/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ license = "MIT OR Apache-2.0"
1010
keywords = ["web", "wasm", "frontend", "webasm", "webassembly"]
1111
categories = ["gui", "web-programming", "wasm"]
1212
description = "A framework for making client-side single-page apps"
13+
rust-version = "1.56.0"
1314

1415
[lib]
1516
proc-macro = true

packages/yew-macro/Makefile.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tasks.test]
22
clear = true
3-
toolchain = "1.51"
3+
toolchain = ""
44
command = "cargo"
55
# test target can be optionally specified like `cargo make test html_macro`,
66
args = ["test", "${@}"]

packages/yew-macro/tests/classes_macro_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#[allow(dead_code)]
2-
#[rustversion::attr(stable(1.51), test)]
2+
#[rustversion::attr(stable(1.56), test)]
33
fn classes_macro() {
44
let t = trybuild::TestCases::new();
55
t.pass("tests/classes_macro/*-pass.rs");
Lines changed: 52 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
error: unexpected end of input, expected expression
2-
--> $DIR/fail.rs:57:18
2+
--> tests/derive_props/fail.rs:57:19
33
|
44
57 | #[prop_or()]
5-
| ^^
5+
| ^
66

77
error: cannot find attribute `props` in this scope
8-
--> $DIR/fail.rs:22:11
8+
--> tests/derive_props/fail.rs:22:11
99
|
1010
22 | #[props(default)]
1111
| ^^^^^
12-
|
13-
= note: consider importing one of these items:
14-
yew::props
15-
yew_macro::props
1612

1713
error[E0425]: cannot find value `foo` in this scope
18-
--> $DIR/fail.rs:87:24
14+
--> tests/derive_props/fail.rs:87:24
1915
|
2016
87 | #[prop_or_else(foo)]
2117
| ^^^ not found in this scope
@@ -27,86 +23,98 @@ help: consider importing one of these items
2723
83 | use crate::t9::foo;
2824
|
2925

30-
error[E0277]: the trait bound `Value: Default` is not satisfied
31-
--> $DIR/fail.rs:9:21
32-
|
33-
9 | #[derive(Clone, Properties, PartialEq)]
34-
| ^^^^^^^^^^ the trait `Default` is not implemented for `Value`
35-
|
36-
= note: required by `Option::<T>::unwrap_or_default`
37-
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
38-
39-
error[E0369]: binary operation `==` cannot be applied to type `Value`
40-
--> $DIR/fail.rs:13:9
41-
|
42-
13 | value: Value,
43-
| ^^^^^^^^^^^^
44-
|
45-
= note: an implementation of `std::cmp::PartialEq` might be missing for `Value`
46-
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
47-
48-
error[E0369]: binary operation `!=` cannot be applied to type `Value`
49-
--> $DIR/fail.rs:13:9
50-
|
51-
13 | value: Value,
52-
| ^^^^^^^^^^^^
53-
|
54-
= note: an implementation of `std::cmp::PartialEq` might be missing for `Value`
55-
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
56-
5726
error[E0599]: no method named `build` found for struct `t3::PropsBuilder<t3::PropsBuilderStep_missing_required_prop_value>` in the current scope
58-
--> $DIR/fail.rs:35:26
27+
--> tests/derive_props/fail.rs:35:26
5928
|
6029
29 | #[derive(Clone, Properties, PartialEq)]
6130
| ---------- method `build` not found for this
6231
...
6332
35 | Props::builder().build();
6433
| ^^^^^ method not found in `t3::PropsBuilder<t3::PropsBuilderStep_missing_required_prop_value>`
34+
|
35+
= note: the method was found for
36+
- `t3::PropsBuilder<t3::PropsBuilderStepPropsBuilder>`
6537

6638
error[E0599]: no method named `b` found for struct `t4::PropsBuilder<PropsBuilderStep_missing_required_prop_a>` in the current scope
67-
--> $DIR/fail.rs:48:26
39+
--> tests/derive_props/fail.rs:48:26
6840
|
6941
41 | #[derive(Clone, Properties, PartialEq)]
7042
| ---------- method `b` not found for this
7143
...
7244
48 | Props::builder().b(1).a(2).build();
7345
| ^ help: there is an associated function with a similar name: `a`
7446

47+
error[E0277]: the trait bound `Value: Default` is not satisfied
48+
--> tests/derive_props/fail.rs:9:21
49+
|
50+
9 | #[derive(Clone, Properties, PartialEq)]
51+
| ^^^^^^^^^^ the trait `Default` is not implemented for `Value`
52+
|
53+
note: required by `Option::<T>::unwrap_or_default`
54+
= note: this error originates in the derive macro `Properties` (in Nightly builds, run with -Z macro-backtrace for more info)
55+
56+
error[E0369]: binary operation `==` cannot be applied to type `Value`
57+
--> tests/derive_props/fail.rs:13:9
58+
|
59+
9 | #[derive(Clone, Properties, PartialEq)]
60+
| --------- in this derive macro expansion
61+
...
62+
13 | value: Value,
63+
| ^^^^^^^^^^^^
64+
|
65+
= note: an implementation of `std::cmp::PartialEq` might be missing for `Value`
66+
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
67+
68+
error[E0369]: binary operation `!=` cannot be applied to type `Value`
69+
--> tests/derive_props/fail.rs:13:9
70+
|
71+
9 | #[derive(Clone, Properties, PartialEq)]
72+
| --------- in this derive macro expansion
73+
...
74+
13 | value: Value,
75+
| ^^^^^^^^^^^^
76+
|
77+
= note: an implementation of `std::cmp::PartialEq` might be missing for `Value`
78+
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
79+
7580
error[E0308]: mismatched types
76-
--> $DIR/fail.rs:67:19
81+
--> tests/derive_props/fail.rs:67:19
7782
|
7883
67 | #[prop_or(123)]
7984
| ^^^ expected struct `String`, found integer
8085
|
8186
help: try using a conversion method
8287
|
8388
67 | #[prop_or(123.to_string())]
84-
| ^^^^^^^^^^^^^^^
89+
| ++++++++++++
8590
67 | #[prop_or(123.to_string())]
86-
| ^^^^^^^^^^^^^^^
91+
| ++++++++++++
8792

8893
error[E0277]: expected a `FnOnce<()>` closure, found `{integer}`
89-
--> $DIR/fail.rs:77:24
94+
--> tests/derive_props/fail.rs:77:24
9095
|
9196
77 | #[prop_or_else(123)]
9297
| ^^^ expected an `FnOnce<()>` closure, found `{integer}`
9398
|
9499
= help: the trait `FnOnce<()>` is not implemented for `{integer}`
95100
= note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }`
101+
note: required by a bound in `Option::<T>::unwrap_or_else`
96102

97103
error[E0593]: function is expected to take 0 arguments, but it takes 1 argument
98-
--> $DIR/fail.rs:97:24
104+
--> tests/derive_props/fail.rs:97:24
99105
|
100106
97 | #[prop_or_else(foo)]
101107
| ^^^ expected function that takes 0 arguments
102108
...
103109
101 | fn foo(bar: i32) -> String {
104110
| -------------------------- takes 1 argument
111+
|
112+
note: required by a bound in `Option::<T>::unwrap_or_else`
105113

106114
error[E0271]: type mismatch resolving `<fn() -> i32 {t10::foo} as FnOnce<()>>::Output == String`
107-
--> $DIR/fail.rs:111:24
115+
--> tests/derive_props/fail.rs:111:24
108116
|
109117
111 | #[prop_or_else(foo)]
110118
| ^^^ expected struct `String`, found `i32`
111119
|
112-
= note: required by `Option::<T>::unwrap_or_else`
120+
note: required by `Option::<T>::unwrap_or_else`

packages/yew-macro/tests/derive_props_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#[allow(dead_code)]
2-
#[rustversion::attr(stable(1.51), test)]
2+
#[rustversion::attr(stable(1.56), test)]
33
fn derive_props() {
44
let t = trybuild::TestCases::new();
55
t.pass("tests/derive_props/pass.rs");

packages/yew-macro/tests/function_attr_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#[allow(dead_code)]
2-
#[rustversion::attr(stable(1.51), test)]
2+
#[rustversion::attr(stable(1.56), test)]
33
fn tests() {
44
let t = trybuild::TestCases::new();
55
t.pass("tests/function_component_attr/*-pass.rs");

packages/yew-macro/tests/function_component_attr/bad-return-type-fail.stderr

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,9 @@ error[E0277]: the trait bound `u32: IntoHtmlResult` is not satisfied
1010
11 | #[function_component(Comp)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoHtmlResult` is not implemented for `u32`
1212
|
13-
= note: required by `into_html_result`
14-
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
13+
note: required by `into_html_result`
14+
--> $WORKSPACE/packages/yew/src/html/mod.rs
15+
|
16+
| fn into_html_result(self) -> HtmlResult;
17+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18+
= note: this error originates in the attribute macro `function_component` (in Nightly builds, run with -Z macro-backtrace for more info)

0 commit comments

Comments
 (0)