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

error: internal compiler error: compiler\rustc_lint\src\types.rs:859:17: malformed transparent type #93419

Closed
SStarosielec opened this issue Jan 28, 2022 · 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

@SStarosielec
Copy link

// minimal example: each line and derive seems important.

extern "C" {
    pub fn Fg_Init() -> *mut Fg_Struct;
}

#[derive(Debug, Copy, Clone)]
pub struct Fg_Struct_s {
    _unused: [u8; 0],
}

#[repr(transparent)]
pub struct Fg_Struct(pub Fg_Struct_s);

fn main() {
    println!("Hello, world!");
}

Meta

rustc --version --verbose:

rustc 1.56.1 (59eed8a2a 2021-11-01)
binary: rustc
commit-hash: 59eed8a2aac0230a8b53e89d4e99d55912ba6b35
commit-date: 2021-11-01
host: x86_64-pc-windows-msvc
release: 1.56.1
LLVM version: 13.0.0

Error output

error: internal compiler error: compiler\rustc_lint\src\types.rs:859:17: malformed transparent type
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
note: the compiler unexpectedly panicked. this is a bug.
Backtrace

query stack during panic:
#0 [lint_mod] linting top-level module
#1 [analysis] running analysis passes on this crate
end of query stack

@SStarosielec SStarosielec added 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. labels Jan 28, 2022
@ChrisDenton
Copy link
Contributor

ChrisDenton commented Jan 28, 2022

Seems to have been fixed in 1.57.0? Edit: see #87529.

@matthiaskrgr
Copy link
Member

Yeah, it seems compile fine on lastest nightly:

warning: type `Fg_Struct_s` should have an upper camel case name
 --> c.rs:8:12
  |
8 | pub struct Fg_Struct_s {
  |            ^^^^^^^^^^^ help: convert the identifier to upper camel case: `FgStructS`
  |
  = note: `#[warn(non_camel_case_types)]` on by default

warning: type `Fg_Struct` should have an upper camel case name
  --> c.rs:13:12
   |
13 | pub struct Fg_Struct(pub Fg_Struct_s);
   |            ^^^^^^^^^ help: convert the identifier to upper camel case: `FgStruct`

warning: `extern` block uses type `Fg_Struct`, which is not FFI-safe
  --> c.rs:4:25
   |
4  |     pub fn Fg_Init() -> *mut Fg_Struct;
   |                         ^^^^^^^^^^^^^^ not FFI-safe
   |
   = note: `#[warn(improper_ctypes)]` on by default
   = note: this struct contains only zero-sized fields
note: the type is defined here
  --> c.rs:13:1
   |
13 | pub struct Fg_Struct(pub Fg_Struct_s);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: 3 warnings emitted

@SStarosielec please update your rust toolchain if you can 🙂

Closing as fixed.

@SStarosielec
Copy link
Author

Thx yes, an update didn't crash rustc anymore.

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

3 participants