Without critical-section
feature, Rust gets confused about missing take()
#704
Labels
critical-section
feature, Rust gets confused about missing take()
#704
Currently the
Peripherals::take()
method is gated behind thecritical-section
optional dependency (and thus feature). Without the feature enabled, the method isn't available, because it requires thecritical-section
crate and we wanted to make that dependency optional (#651).However it turns out if you call
take()
on a struct that doesn't have that method, Rust thinks you wanted to call the method on theIterator
trait that's imported by default, and then you get a pretty confusing error message aboutPeripherals
not implementingIterator
(example):This seems to really throw people off because there's no indication that
take()
didn't exist or was feature-gated. I wonder if we should either...take()
; it should build fine and only error about a missing c-s implementation iftake()
is actually called, in which case at least the error message is better, ortake()
, but if thecritical-section
feature is not enabled, usecompile_error!()
to emit a custom compiler error instead of the very confusing one we currently get.The text was updated successfully, but these errors were encountered: