Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gcc/rust/typecheck/rust-tyty-cmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,7 @@ class PointerCmp : public BaseCmp
: BaseCmp (base, emit_errors), base (base)
{}

void visit (const ReferenceType &type) override
void visit (const PointerType &type) override
{
auto base_type = base->get_base ();
auto other_base_type = type.get_base ();
Expand Down
16 changes: 16 additions & 0 deletions gcc/testsuite/rust/compile/issue-1031.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
extern "rust-intrinsic" {
pub fn offset<T>(dst: *const T, offset: isize) -> *const T;
}

#[lang = "const_ptr"]
impl<T> *const T {
pub const unsafe fn offset(self, count: isize) -> *const T {
// { dg-warning "associated function is never used" "" { target *-*-* } .-1 }
unsafe { offset(self, count) }
}

pub const unsafe fn add(self, count: usize) -> Self {
// { dg-warning "associated function is never used" "" { target *-*-* } .-1 }
unsafe { self.offset(count as isize) }
}
}