Skip to content

Commit 06a3354

Browse files
more compact compile errors
1 parent 807ffa0 commit 06a3354

File tree

2 files changed

+9
-65
lines changed

2 files changed

+9
-65
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ usbd-serial = "0.1.0"
4848
[features]
4949
default = ["unproven"]
5050
device-selected = []
51-
needs-subvariant = []
51+
direct-call-deprecated = []
5252
rt = ["stm32f3/rt"]
5353
# Any Changes here should be mirrored in README.md and src/lib.rs
54-
stm32f301 = ["stm32f3/stm32f301", "needs-subvariant"]
54+
stm32f301 = ["stm32f3/stm32f301", "direct-call-deprecated"]
5555
stm32f301xb = ["stm32f301", "device-selected"]
5656
stm32f301xc = ["stm32f301", "device-selected"]
5757
stm32f301xd = ["stm32f301", "device-selected"]
5858
stm32f301xe = ["stm32f301", "device-selected"]
5959
stm32f318 = ["stm32f3/stm32f3x8", "device-selected"]
6060
stm32f302 = ["stm32f3/stm32f302", "device-selected"]
61-
stm32f303 = ["stm32f3/stm32f303", "needs-subvariant"]
61+
stm32f303 = ["stm32f3/stm32f303", "direct-call-deprecated"]
6262
stm32f303xb = ["stm32f303", "stm32-usbd/ram_access_1x16", "device-selected"]
6363
stm32f303xc = ["stm32f303", "stm32-usbd/ram_access_1x16", "device-selected"]
6464
stm32f303xd = ["stm32f303", "stm32-usbd/ram_access_2x16", "device-selected"]

src/lib.rs

Lines changed: 6 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -66,71 +66,15 @@ compile_error!(
6666
"
6767
);
6868

69-
#[cfg(all(not(feature = "device-selected"), feature = "stm32f301"))]
69+
#[cfg(all(not(feature = "device-selected"), feature = "direct-call-deprecated",))]
7070
compile_error!(
71-
"This crate requires you to specify the subvariant of your chip.
71+
"The feature you selected is deprecated, because it was split up into sub-devices.
7272
73-
You probably see this error because you updated the stm32f3xxx-hal and are still using
74-
`--features stm32f301`.
75-
Don't worry, you probably don't neet to change your code.
76-
77-
Please check your datasheet and change `stm32f301` to one of those subvariants:
78-
(Note: `x` denotes any character in [a-z])
79-
* stm32f301xb
80-
* stm32f301xc
81-
* stm32f301xd
82-
* stm32f301xe
83-
84-
For more information, see README -> Selecting the right chip.
85-
86-
Also check the CHANGELOG for awesome new features for your chip that were made possible by
87-
forcing you to specify the subvariant.
88-
"
89-
);
90-
91-
#[cfg(all(not(feature = "device-selected"), feature = "stm32f303"))]
92-
compile_error!(
93-
"This crate requires you to specify the subvariant of your chip.
94-
95-
You probably see this error because you updated the stm32f3xxx-hal and are still using
96-
`--features stm32f303`.
97-
Don't worry, you probably don't neet to change your code.
98-
99-
Please check your datasheet and change your `stm32f303` to one of those subvariants:
100-
(Note: `x` denotes any character in [a-z])
101-
* stm32f303xb
102-
* stm32f303xc
103-
* stm32f303xd
104-
* stm32f303xe
105-
* stm32f303x6
106-
* stm32f303x8
107-
108-
For more information, see README -> Selecting the right chip.
109-
110-
Also check the CHANGELOG for awesome new features for your chip that were made possible by
111-
forcing you to specify the subvariant.
112-
"
113-
);
114-
#[cfg(all(
115-
not(feature = "device-selected"),
116-
feature = "needs-subvariant",
117-
not(any(feature = "stm32f303", feature = "stm32f301"))
118-
))]
119-
compile_error!(
120-
"This crate requires you to specify the subvariant of your chip.
121-
122-
However this compile error should also tell you which subvariants to pick from.
123-
As this is not the case, please
124-
125-
File an issue at
126-
https://github.com/stm32-rs/stm32f3xx-hal/issues/new
127-
including your call to `cargo` and the version of stm32f3xxx-hal you want to use.
73+
Example: The STM32F3Discovery board has a STM32F303VCT6 chip.
74+
You used to use `--features stm32f303` but now functionalities for the sub-device were added.
75+
Replace it with `--features stm32f303xc` to make your code build again.
12876
129-
You may also
130-
* See README -> Selecting the right chip.
131-
* Check the CHANGELOG for awesome new features for your chip that were made possible by
132-
forcing you to specify the subvariant.
133-
"
77+
Please select one of the chip features stated above."
13478
);
13579

13680
pub use embedded_hal as hal;

0 commit comments

Comments
 (0)