Skip to content

Commit

Permalink
Bump minimal supported rust version (MSRV) to 1.56 (#2334)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
hamza1311 committed Jan 6, 2022
1 parent f6f0e34 commit b456636
Show file tree
Hide file tree
Showing 26 changed files with 319 additions and 238 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pull-request.yml
Expand Up @@ -147,7 +147,7 @@ jobs:
strategy:
matrix:
toolchain:
- 1.49.0 # MSRV
- 1.56.0 # MSRV
- stable

steps:
Expand Down Expand Up @@ -188,7 +188,7 @@ jobs:
strategy:
matrix:
toolchain:
- 1.51.0 # min version with const generics
- 1.56.0 # MSRV
- stable
- nightly

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Expand Up @@ -60,7 +60,7 @@ Alternatively, you can set the `ECHO_SERVER_URL` environment variable to the URL

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.
These files ensure that macro compilation errors are correct and easy to understand.
These errors can change with each release of the compiler so they should be generated with the Rust version 1.51
These errors can change with each release of the compiler, so they should be generated with the Rust version 1.56
(because some tests make use of const generics which were stabilized in that version).

To update or generate a new `stderr` file you can run `cargo make test-overwrite` in the `yew-macro` directory.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -12,7 +12,7 @@
<a href="https://docs.rs/yew/"><img alt="API Docs" src="https://img.shields.io/badge/docs.rs-yew-green"/></a>
<a href="https://discord.gg/VQck8X4"><img alt="Discord Chat" src="https://img.shields.io/discord/701068342760570933"/></a>
<a href="https://gitlocalize.com/repo/4999"> <img src="https://gitlocalize.com/repo/4999/whole_project/badge.svg" /> </a>
<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>
<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>
</p>

<h4>
Expand Down
1 change: 1 addition & 0 deletions packages/yew-macro/Cargo.toml
Expand Up @@ -10,6 +10,7 @@ license = "MIT OR Apache-2.0"
keywords = ["web", "wasm", "frontend", "webasm", "webassembly"]
categories = ["gui", "web-programming", "wasm"]
description = "A framework for making client-side single-page apps"
rust-version = "1.56.0"

[lib]
proc-macro = true
Expand Down
2 changes: 1 addition & 1 deletion packages/yew-macro/Makefile.toml
@@ -1,6 +1,6 @@
[tasks.test]
clear = true
toolchain = "1.51"
toolchain = ""
command = "cargo"
# test target can be optionally specified like `cargo make test html_macro`,
args = ["test", "${@}"]
Expand Down
2 changes: 1 addition & 1 deletion packages/yew-macro/tests/classes_macro_test.rs
@@ -1,5 +1,5 @@
#[allow(dead_code)]
#[rustversion::attr(stable(1.51), test)]
#[rustversion::attr(stable(1.56), test)]
fn classes_macro() {
let t = trybuild::TestCases::new();
t.pass("tests/classes_macro/*-pass.rs");
Expand Down
96 changes: 52 additions & 44 deletions packages/yew-macro/tests/derive_props/fail.stderr
@@ -1,21 +1,17 @@
error: unexpected end of input, expected expression
--> $DIR/fail.rs:57:18
--> tests/derive_props/fail.rs:57:19
|
57 | #[prop_or()]
| ^^
| ^

error: cannot find attribute `props` in this scope
--> $DIR/fail.rs:22:11
--> tests/derive_props/fail.rs:22:11
|
22 | #[props(default)]
| ^^^^^
|
= note: consider importing one of these items:
yew::props
yew_macro::props

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

error[E0277]: the trait bound `Value: Default` is not satisfied
--> $DIR/fail.rs:9:21
|
9 | #[derive(Clone, Properties, PartialEq)]
| ^^^^^^^^^^ the trait `Default` is not implemented for `Value`
|
= note: required by `Option::<T>::unwrap_or_default`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0369]: binary operation `==` cannot be applied to type `Value`
--> $DIR/fail.rs:13:9
|
13 | value: Value,
| ^^^^^^^^^^^^
|
= note: an implementation of `std::cmp::PartialEq` might be missing for `Value`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0369]: binary operation `!=` cannot be applied to type `Value`
--> $DIR/fail.rs:13:9
|
13 | value: Value,
| ^^^^^^^^^^^^
|
= note: an implementation of `std::cmp::PartialEq` might be missing for `Value`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no method named `build` found for struct `t3::PropsBuilder<t3::PropsBuilderStep_missing_required_prop_value>` in the current scope
--> $DIR/fail.rs:35:26
--> tests/derive_props/fail.rs:35:26
|
29 | #[derive(Clone, Properties, PartialEq)]
| ---------- method `build` not found for this
...
35 | Props::builder().build();
| ^^^^^ method not found in `t3::PropsBuilder<t3::PropsBuilderStep_missing_required_prop_value>`
|
= note: the method was found for
- `t3::PropsBuilder<t3::PropsBuilderStepPropsBuilder>`

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

error[E0277]: the trait bound `Value: Default` is not satisfied
--> tests/derive_props/fail.rs:9:21
|
9 | #[derive(Clone, Properties, PartialEq)]
| ^^^^^^^^^^ the trait `Default` is not implemented for `Value`
|
note: required by `Option::<T>::unwrap_or_default`
= note: this error originates in the derive macro `Properties` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0369]: binary operation `==` cannot be applied to type `Value`
--> tests/derive_props/fail.rs:13:9
|
9 | #[derive(Clone, Properties, PartialEq)]
| --------- in this derive macro expansion
...
13 | value: Value,
| ^^^^^^^^^^^^
|
= note: an implementation of `std::cmp::PartialEq` might be missing for `Value`
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0369]: binary operation `!=` cannot be applied to type `Value`
--> tests/derive_props/fail.rs:13:9
|
9 | #[derive(Clone, Properties, PartialEq)]
| --------- in this derive macro expansion
...
13 | value: Value,
| ^^^^^^^^^^^^
|
= note: an implementation of `std::cmp::PartialEq` might be missing for `Value`
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
--> $DIR/fail.rs:67:19
--> tests/derive_props/fail.rs:67:19
|
67 | #[prop_or(123)]
| ^^^ expected struct `String`, found integer
|
help: try using a conversion method
|
67 | #[prop_or(123.to_string())]
| ^^^^^^^^^^^^^^^
| ++++++++++++
67 | #[prop_or(123.to_string())]
| ^^^^^^^^^^^^^^^
| ++++++++++++

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

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

error[E0271]: type mismatch resolving `<fn() -> i32 {t10::foo} as FnOnce<()>>::Output == String`
--> $DIR/fail.rs:111:24
--> tests/derive_props/fail.rs:111:24
|
111 | #[prop_or_else(foo)]
| ^^^ expected struct `String`, found `i32`
|
= note: required by `Option::<T>::unwrap_or_else`
note: required by `Option::<T>::unwrap_or_else`
2 changes: 1 addition & 1 deletion packages/yew-macro/tests/derive_props_test.rs
@@ -1,5 +1,5 @@
#[allow(dead_code)]
#[rustversion::attr(stable(1.51), test)]
#[rustversion::attr(stable(1.56), test)]
fn derive_props() {
let t = trybuild::TestCases::new();
t.pass("tests/derive_props/pass.rs");
Expand Down
2 changes: 1 addition & 1 deletion packages/yew-macro/tests/function_attr_test.rs
@@ -1,5 +1,5 @@
#[allow(dead_code)]
#[rustversion::attr(stable(1.51), test)]
#[rustversion::attr(stable(1.56), test)]
fn tests() {
let t = trybuild::TestCases::new();
t.pass("tests/function_component_attr/*-pass.rs");
Expand Down
Expand Up @@ -10,5 +10,9 @@ error[E0277]: the trait bound `u32: IntoHtmlResult` is not satisfied
11 | #[function_component(Comp)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoHtmlResult` is not implemented for `u32`
|
= note: required by `into_html_result`
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
note: required by `into_html_result`
--> $WORKSPACE/packages/yew/src/html/mod.rs
|
| fn into_html_result(self) -> HtmlResult;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the attribute macro `function_component` (in Nightly builds, run with -Z macro-backtrace for more info)
Expand Up @@ -15,6 +15,9 @@ error[E0599]: no method named `build` found for struct `PropsBuilder<PropsBuilde
...
22 | html! { <Comp<Props> /> };
| ^^^^ method not found in `PropsBuilder<PropsBuilderStep_missing_required_prop_a>`
|
= note: the method was found for
- `PropsBuilder<PropsBuilderStepPropsBuilder>`

error[E0277]: the trait bound `FunctionComponent<CompFunctionProvider<MissingTypeBounds>>: BaseComponent` is not satisfied
--> tests/function_component_attr/generic-props-fail.rs:27:14
Expand Down Expand Up @@ -45,27 +48,32 @@ error[E0277]: the trait bound `MissingTypeBounds: yew::Properties` is not satisf
27 | html! { <Comp<MissingTypeBounds> /> };
| ^^^^ the trait `yew::Properties` is not implemented for `MissingTypeBounds`
|
::: $WORKSPACE/packages/yew/src/functional/mod.rs
note: required because of the requirements on the impl of `FunctionProvider` for `CompFunctionProvider<MissingTypeBounds>`
--> tests/function_component_attr/generic-props-fail.rs:8:1
|
| pub struct FunctionComponent<T: FunctionProvider + 'static> {
| ---------------- required by this bound in `FunctionComponent`
8 | #[function_component(Comp)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `FunctionComponent`
--> $WORKSPACE/packages/yew/src/functional/mod.rs
|
= note: required because of the requirements on the impl of `FunctionProvider` for `CompFunctionProvider<MissingTypeBounds>`
| pub struct FunctionComponent<T: FunctionProvider + 'static> {
| ^^^^^^^^^^^^^^^^ required by this bound in `FunctionComponent`
= note: this error originates in the attribute macro `function_component` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0107]: missing generics for type alias `Comp`
--> tests/function_component_attr/generic-props-fail.rs:30:14
|
30 | html! { <Comp /> };
| ^^^^ expected 1 type argument
| ^^^^ expected 1 generic argument
|
note: type alias defined here, with 1 type parameter: `P`
note: type alias defined here, with 1 generic parameter: `P`
--> tests/function_component_attr/generic-props-fail.rs:8:22
|
8 | #[function_component(Comp)]
| ^^^^
9 | fn comp<P>(_props: &P) -> Html
| -
help: use angle brackets to add missing type argument
help: add missing generic argument
|
30 | html! { <Comp<P> /> };
| ^^^
| ~~~~~~~
64 changes: 32 additions & 32 deletions packages/yew-macro/tests/html_macro/block-fail.stderr
@@ -1,46 +1,46 @@
error[E0277]: `()` doesn't implement `std::fmt::Display`
--> $DIR/block-fail.rs:6:15
|
6 | { () }
| ^^ `()` cannot be formatted with the default formatter
|
= help: the trait `std::fmt::Display` is not implemented for `()`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
= note: required because of the requirements on the impl of `ToString` for `()`
= note: required because of the requirements on the impl of `From<()>` for `VNode`
= note: required because of the requirements on the impl of `Into<VNode>` for `()`
= note: 2 redundant requirements hidden
= note: required because of the requirements on the impl of `Into<NodeSeq<(), VNode>>` for `()`
= note: required by `into`
--> tests/html_macro/block-fail.rs:6:15
|
6 | { () }
| ^^ `()` cannot be formatted with the default formatter
|
= help: the trait `std::fmt::Display` is not implemented for `()`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
= note: required because of the requirements on the impl of `ToString` for `()`
= note: required because of the requirements on the impl of `From<()>` for `VNode`
= note: required because of the requirements on the impl of `Into<VNode>` for `()`
= note: 2 redundant requirements hidden
= note: required because of the requirements on the impl of `Into<NodeSeq<(), VNode>>` for `()`
note: required by `into`

error[E0277]: `()` doesn't implement `std::fmt::Display`
--> $DIR/block-fail.rs:12:16
|
12 | <div>{ not_tree() }</div>
| ^^^^^^^^ `()` cannot be formatted with the default formatter
|
= help: the trait `std::fmt::Display` is not implemented for `()`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
= note: required because of the requirements on the impl of `ToString` for `()`
= note: required because of the requirements on the impl of `From<()>` for `VNode`
= note: required because of the requirements on the impl of `Into<VNode>` for `()`
= note: 2 redundant requirements hidden
= note: required because of the requirements on the impl of `Into<NodeSeq<(), VNode>>` for `()`
= note: required by `into`
--> tests/html_macro/block-fail.rs:12:16
|
12 | <div>{ not_tree() }</div>
| ^^^^^^^^ `()` cannot be formatted with the default formatter
|
= help: the trait `std::fmt::Display` is not implemented for `()`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
= note: required because of the requirements on the impl of `ToString` for `()`
= note: required because of the requirements on the impl of `From<()>` for `VNode`
= note: required because of the requirements on the impl of `Into<VNode>` for `()`
= note: 2 redundant requirements hidden
= note: required because of the requirements on the impl of `Into<NodeSeq<(), VNode>>` for `()`
note: required by `into`

error[E0277]: `()` doesn't implement `std::fmt::Display`
--> $DIR/block-fail.rs:15:17
--> tests/html_macro/block-fail.rs:15:17
|
15 | <>{ for (0..3).map(|_| not_tree()) }</>
| ^^^^^^ `()` cannot be formatted with the default formatter
|
::: $WORKSPACE/packages/yew/src/utils/mod.rs
|
| T: Into<R>,
| ------- required by this bound in `into_node_iter`
|
= help: the trait `std::fmt::Display` is not implemented for `()`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
= note: required because of the requirements on the impl of `ToString` for `()`
= note: required because of the requirements on the impl of `From<()>` for `VNode`
= note: required because of the requirements on the impl of `Into<VNode>` for `()`
note: required by a bound in `into_node_iter`
--> $WORKSPACE/packages/yew/src/utils/mod.rs
|
| T: Into<R>,
| ^^^^^^^ required by this bound in `into_node_iter`

0 comments on commit b456636

Please sign in to comment.