Rust-GCC / Rust-GCC/gccrs

mismatched types, expected ‘u64’ but got ‘u32’

Open
#4,913 0 comments 0 reactions 1 assignee View on GitHub

@philberty is already working on this.

Since Sep 18, 2026.

core
Dominant language
C++
Stars
2.9k
Forks
231
Avg merge
19h 55m
Merged PRs (30d)
67

Description

Summary

should compile

Reproducer

I tried this code:

#![feature(no_core, lang_items)]
#![no_core]

#[lang = "sized"]
pub trait Sized {}

impl u32 {
    pub const BITS: u32 = 32;
}

fn from_u64(mut v: u64) -> u64 {
    let mut sz: u64 = 0;
    while v > 0 {
        v >>= <u32>::BITS;
        sz += 1;
    }
    sz
}

fn main() {
    let _ = from_u64(5);
}
Does the code make use of any (1.49) nightly feature ?
  • Nightly
Godbolt link

No response

Actual behavior

The current behavior is...

test.rs:14:9: error: mismatched types, expected ‘u64’ but got ‘u32’ [E0308]
14 | v >>= ::BITS;
| ^ ~

Expected behavior

I expected to see...

GCC Version

HEAD

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.