Skip to content

Regression in 1.93.0 the type <XYZ as Archive>::Archived has an unknown layout #151791

@konnorandrews

Description

@konnorandrews

Code

I tried the following in a new cargo project. This is minimized from a real codebase.

[package]
name = "broken-nightly"
version = "0.1.0"
edition = "2024"

[dependencies]
cynic-codegen = { version = "3.12.0", features = [ "rkyv" ] }

[profile.dev.package.cynic-codegen]
opt-level = 1 # only 0 doesn't cause the issue

I expected to see this happen: compilation to succeed.

Instead, this happened: multiple errors that are basically impossible to track down the cause of.

error[E0080]: the type `<With<Cow<'_, str>, AsOwned> as Archive>::Archived` has an unknown layout
 --> /rustc/254b59607d4417e9dffbc307138ae5c86280fe4c/library/core/src/mem/mod.rs:1251:26
  |
  = note: evaluation of `<schema::names::ArchivedFieldName<'_> as std::mem::SizedTypeProperties>::ALIGN` failed here

error[E0080]: the type `<std::collections::HashMap<std::string::String, schema::types::Type<'_>> as Archive>::Archived` has an unknown layout
 --> /rustc/254b59607d4417e9dffbc307138ae5c86280fe4c/library/core/src/mem/mod.rs:1251:26
  |
  = note: evaluation of `<schema::type_index::optimised::ArchivedOptimisedTypes<'_> as std::mem::SizedTypeProperties>::ALIGN` failed here

error[E0080]: the type `<schema::types::ObjectType<'_> as Archive>::Archived` has an unknown layout
 --> /rustc/254b59607d4417e9dffbc307138ae5c86280fe4c/library/core/src/mem/mod.rs:1251:26
  |
  = note: evaluation of `<schema::types::ArchivedSchemaRoots<'_> as std::mem::SizedTypeProperties>::ALIGN` failed here

error[E0080]: the type `<schema::types::ScalarType<'_> as Archive>::Archived` has an unknown layout
 --> /rustc/254b59607d4417e9dffbc307138ae5c86280fe4c/library/core/src/mem/mod.rs:1251:26
  |
  = note: evaluation of `<schema::types::ArchivedType<'_> as std::mem::SizedTypeProperties>::ALIGN` failed here

...

For anyone that is encountering this in the wild, updating cynic to be the latest main that uses rkyv 0.8 resolves the issue.

It would seem specifically rkyv 0.7 is causing the issue when applied to the cynic-codegen types.

Version it worked on

It most recently worked on: 1.92.0

Version with regression

rustc --version --verbose:

rustc 1.93.0 (254b59607 2026-01-19)

Running a bisection I get the nightly that introduced the bug to be nightly-2025-10-24. I am unable to get the exact commit at the moment because of GitHub rate limiting.

@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged

Metadata

Metadata

Assignees

Labels

A-associated-itemsArea: Associated items (types, constants & functions)A-layoutArea: Memory layout of typesA-mir-optArea: MIR optimizationsA-raw-pointersArea: raw pointers, MaybeUninit, NonNullA-trait-systemArea: Trait systemC-bugCategory: This is a bug.P-highHigh priorityS-has-bisectionStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions