Closed kaczmarczyck closed 2 years ago
You are using rustc 1.42.0-nightly (f43c34a13 2020-02-02)
which is a nightly version several months out of date. Can you reproduce with 1.45.0
stable or the latest nightly?
I can't reproduce with your provided repository:
RUST_BACKTRACE=1 cargo test --release --features std --verbose
Updating crates.io index
error: failed to get `libtock` as a dependency of package `ctap2 v0.1.0 (/home/joshua/src/OpenSK)`
Caused by:
failed to load source for dependency `libtock`
Caused by:
Unable to update /home/joshua/src/OpenSK/third_party/libtock-rs
Caused by:
failed to read `/home/joshua/src/OpenSK/third_party/libtock-rs/Cargo.toml`
Caused by:
No such file or directory (os error 2)
I'm going to remove I-prioritize
label but if @jyn514 is right, it seems that we should close this issue. Anyway, let's wait to hear from @kaczmarczyck to be 100% sure about it.
Here is a smaller self-contained example failing on 1.46.0-nightly:
// test.rs
use std::collections::BTreeMap;
#[derive(PartialEq, Eq, PartialOrd, Ord)]
struct KeyType;
struct Value;
trait IntoCborKey {
fn into_cbor_key(self) -> KeyType;
}
trait IntoCborValue {
fn into_cbor_value(self) -> Value;
}
impl IntoCborValue for i32 {
fn into_cbor_value(self) -> Value {
Value
}
}
impl IntoCborKey for i32 {
fn into_cbor_key(self) -> KeyType {
KeyType
}
}
macro_rules! cbor_map {
( $( $key:expr => $value:expr, )+ ) => {
cbor_map! ( $($key => $value),+ )
};
( $( $key:expr => $value:expr ),* ) => {
{
let mut _map = BTreeMap::new();
$(
_map.insert($key.into_cbor_key(), $value.into_cbor_value());
)*
_map
}
};
}
fn main() {
let _ = cbor_map! {
1 => 1,
2 => 2,
3 => 3,
#[cfg(test)]
4 => 4,
};
}
% rustc test.rs
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/librustc_resolve/late.rs:2124:52
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.46.0-nightly (50fc24d8a 2020-06-25) running on x86_64-unknown-linux-gnu
@spastorino Is the minimal example provided by @ia0 sufficient to put back this issue in the I-prioritize
queue?
I can't reproduce with your provided repository:
RUST_BACKTRACE=1 cargo test --release --features std --verbose Updating crates.io index error: failed to get `libtock` as a dependency of package `ctap2 v0.1.0 (/home/joshua/src/OpenSK)` Caused by: failed to load source for dependency `libtock` Caused by: Unable to update /home/joshua/src/OpenSK/third_party/libtock-rs Caused by: failed to read `/home/joshua/src/OpenSK/third_party/libtock-rs/Cargo.toml` Caused by: No such file or directory (os error 2)
@jyn514 FYI, this error was due to a git submodule that must be initialized in that repository before starting the compilation.
Further minimized
macro_rules! cbor_map {
($key:expr) => {
$key.signum();
};
}
fn main() {
cbor_map! { #[cfg(test)] 4};
}
This is a fun case.
AST represents receiver.method(args...)
as MethodCall(PathSegment, Vec<P<Expr>>, Span)
where the vector is [receiver, args...]
.
I.e. the parser does some light lowering into a semantic form by merging the receiver and arguments into a single list.
The parser shouldn't do that because it changes observable behavior.
Expressions that are a part of a list can be cfg
-ed away into nothing, the list just shrinks in that case, but you cannot do that with single expressions.
fn main() {
let x = #[cfg(test)] 4; // error: removing an expression is not supported in this position
}
So, merging the receiver and the arguments loses the part-of-the-list-ness property and should not be done until HIR.
Assigning P-medium
as discussed as part of the Prioritization Working Group procedure and removing I-prioritize
.
I get an ICE when trying to use
#[cfg(feature = "with_ctap2_1")]
inside a map-like macro call.I tried this code:
https://github.com/kaczmarczyck/OpenSK/commits/internal-compiler-error The last commit does NOT reproduce the error, but shows the 2 line diff to commit https://github.com/kaczmarczyck/OpenSK/commit/4fec405fb5bb1b986a8fbbb518d4fe88f4dbd38f that is reproducing the problem.
Please clone the branch above, run ./setup.sh if you want to check that everything works, then execute:
RUST_BACKTRACE=1 cargo test --release --features std --verbose
I expected a regular compiler error (or a successful test).
Instead, the above mentioned ICE occurred.
Meta
rustc --version --verbose
: