-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Open
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.I-compiletimeIssue: Problems and improvements with respect to compile times.Issue: Problems and improvements with respect to compile times.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.Fixed by the next-generation trait solver, `-Znext-solver`.
Description
Given the following code, rustc hangs:
mod asn1 {
pub trait Asn1Writable: Sized {}
pub trait SimpleAsn1Writable: Sized {}
impl<T: SimpleAsn1Writable> Asn1Writable for T {}
impl<T: SimpleAsn1Writable> SimpleAsn1Writable for &T {}
impl<T: SimpleAsn1Writable> SimpleAsn1Writable for Box<T> {}
impl<T: Asn1Writable> Asn1Writable for Option<T> {}
pub trait Asn1DefinedByWritable: Sized {}
}
mod common {
use crate::asn1;
pub struct AlgorithmIdentifier<'a> {
pub params: AlgorithmParameters<'a>,
}
impl<'a> asn1::SimpleAsn1Writable for AlgorithmIdentifier<'a> where
AlgorithmParameters<'a>: asn1::Asn1DefinedByWritable
{
}
pub enum AlgorithmParameters<'a> {
Sha1,
Pbkdf2(PBKDF2Params<'a>),
}
impl<'a> asn1::Asn1DefinedByWritable for AlgorithmParameters<'a>
where
PBES2Params<'a>: asn1::Asn1Writable,
PBKDF2Params<'a>: asn1::Asn1Writable,
{
}
pub const PSS_SHA1_HASH_ALG: AlgorithmIdentifier<'_> = AlgorithmIdentifier {
params: AlgorithmParameters::Sha1,
};
pub struct RsaPssParameters<'a> {
pub hash_algorithm: AlgorithmIdentifier<'a>,
}
impl<'a> asn1::SimpleAsn1Writable for RsaPssParameters<'a> {}
pub struct PBES2Params<'a> {
pub key_derivation_func: Box<AlgorithmIdentifier<'a>>,
}
impl<'a> asn1::SimpleAsn1Writable for PBES2Params<'a> where
Box<AlgorithmIdentifier<'a>>: asn1::Asn1Writable
{
}
pub struct PBKDF2Params<'a> {
pub salt: &'a [u8],
}
impl<'a> asn1::SimpleAsn1Writable for PBKDF2Params<'a> where
Box<AlgorithmIdentifier<'a>>: asn1::Asn1Writable
{
}
}
pub fn write_element<T: asn1::Asn1Writable>(val: &T) {
todo!()
}
pub fn f(p: &common::RsaPssParameters<'_>) {
write_element(&Some(&p.hash_algorithm));
}
fn main() {}/t/q ❯❯❯ rustc src/main.rs
[no amount of patience is enough]
This is minimized from https://github.com/pyca/cryptography and https://github.com/alex/rust-asn1.
Meta
rustc --version --verbose:
rustc 1.82.0 (f6e511eec 2024-10-15)
binary: rustc
commit-hash: f6e511eec7342f59a25f7c0534f1dbea00d01b14
commit-date: 2024-10-15
host: aarch64-apple-darwin
release: 1.82.0
LLVM version: 19.1.1
Metadata
Metadata
Assignees
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.I-compiletimeIssue: Problems and improvements with respect to compile times.Issue: Problems and improvements with respect to compile times.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.Fixed by the next-generation trait solver, `-Znext-solver`.