Skip to content

ICE in canonical path generation of slices #1005

@philberty

Description

@philberty

Code

extern "rust-intrinsic" {
    pub fn abort() -> !;
    pub fn offset<T>(dst: *const T, offset: isize) -> *const T;
}

#[lang = "Range"]
pub struct Range<Idx> {
    pub start: Idx,
    pub end: Idx,
}

#[lang = "index"]
trait Index<Idx> {
    type Output;

    fn index(&self, index: Idx) -> &Self::Output;
}

pub unsafe trait SliceIndex<T> {
    type Output;

    unsafe fn get_unchecked(self, slice: *const T) -> *const Self::Output;

    fn index(self, slice: &T) -> &Self::Output;
}

union Repr<T> {
    rust: *const [T],
    rust_mut: *mut [T],
    raw: FatPtr<T>,
}

struct FatPtr<T> {
    data: *const T,
    len: usize,
}

impl<T, I> Index<I> for [T]
where
    I: SliceIndex<[T]>,
{
    type Output = I::Output;

    fn index(&self, index: I) -> &I::Output {
        index.index(self)
    }
}

#[lang = "const_ptr"]
impl<T> *const T {
    pub const unsafe fn offset(self, count: isize) -> *const T {
        unsafe { offset(self, count) }
    }

    pub const unsafe fn add(self, count: usize) -> Self {
        unsafe { self.offset(count as isize) }
    }

    pub const fn as_ptr(self) -> *const T {
        self as *const T
    }
}

Meta

  • What version of Rust GCC were you using, git sha if possible. 77a4950

Error output

rust1: internal compiler error: in append, at rust/util/rust-canonical-path.h:90
Backtrace

rust1: internal compiler error: in append, at rust/util/rust-canonical-path.h:90
0x1202f00 Rust::Resolver::CanonicalPath::append(Rust::Resolver::CanonicalPath const&) const
      ../../gccrs/gcc/rust/util/rust-canonical-path.h:90
0xfba983 Rust::AST::InherentImpl::accept_vis(Rust::AST::ASTVisitor&)
      ../../gccrs/gcc/rust/ast/rust-ast-full-test.cc:5470
0x120138f Rust::Resolver::NameResolution::go(Rust::AST::Crate&)
      ../../gccrs/gcc/rust/resolve/rust-ast-resolve.cc:382
0x1201131 Rust::Resolver::NameResolution::Resolve(Rust::AST::Crate&)
      ../../gccrs/gcc/rust/resolve/rust-ast-resolve.cc:352
0x10aa15b Rust::Session::parse_file(char const*)
      ../../gccrs/gcc/rust/rust-session-manager.cc:573
0x10a9d7c Rust::Session::parse_files(int, char const**)
      ../../gccrs/gcc/rust/rust-session-manager.cc:483
0xf7225b grs_langhook_parse_file
      ../../gccrs/gcc/rust/rust-lang.cc:171
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
[Inferior 1 (process 486858) exited with code 04]

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions