Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc panics with &'static [u8] and ouroboros self_referencing #113997

Open
muja opened this issue Jul 24, 2023 · 3 comments
Open

rustc panics with &'static [u8] and ouroboros self_referencing #113997

muja opened this issue Jul 24, 2023 · 3 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@muja
Copy link

muja commented Jul 24, 2023

While trying to check my code with miri, I had to replace occurrences of std::fs::File with &'static [u8] (and use include_bytes!).

The following code triggers a rustc panic. The same code with std::fs::File compiles fine.

use ouroboros::self_referencing;
use rc_zip::reader::sync::{EntryReader, HasCursor, SyncArchive};

#[self_referencing]
pub struct Docx {
    file: &'static [u8],
    #[borrows(file)]
    #[covariant]
    arc: SyncArchive<'this, &'static [u8]>,
    #[borrows(arc)]
    #[covariant]
    readers: Vec<xml::EventReader<EntryReader<<&'static [u8] as HasCursor>::Cursor<'this>>>>,
}

fn main(){}

stderr/stdout combined (was too long for GitHub, so attaching): output.txt

The same error occurs with stable: note: rustc 1.71.0 (8ede3aae2 2023-07-12) running on x86_64-apple-darwin

Cargo.toml:

[package]
name = "ziptest"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
ouroboros = "0.17.2"
rc-zip = "2.0.1"

xml-rs = "0.8.16"

Cargo.lock is attached.

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 24, 2023
@muja
Copy link
Author

muja commented Jul 24, 2023

I believe this has to do with the GAT inside HasCursor. Replacing that with the hard-coded associated type doesn't panic

@fmease
Copy link
Member

fmease commented Jul 24, 2023

For searchability, here is the linked ICE message:

error: internal compiler error: /rustc/903e279f468590fa3425f8aff7f3d61a5a873dbb/compiler/rustc_infer/src/infer/outlives/env.rs:148:26: add_outlives_bounds: unexpected regions: (RePlaceholder(!7_BoundRegion { var: 0, kind: BrNamed(DefId(0:26 ~ ziptest[6cbf]::ouroboros_impl_docx_processor::DocxProcessorBuilder::'this#1), 'this) }), ReStatic)

@saethlin saethlin added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jul 24, 2023
@matthiaskrgr
Copy link
Member

could be related to #113793

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants