Skip to content
Open
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
26 changes: 26 additions & 0 deletions gcc/testsuite/rust/compile/issue-3875.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#![crate_type = "lib"]
#![feature(no_core)]
#![feature(lang_items)]
#![no_core]
// { dg-options "-w" }

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

#[lang = "clone"]
pub trait Clone: Sized {
fn clone(&self) -> Self;
}

#[lang = "copy"]
pub trait Copy: Clone {}

#[derive(Clone)] // { dg-error "derive may only be applied to structs, enums and unions" }
fn foo() {}

#[derive(Clone)] // { dg-error "derive may only be applied to structs, enums and unions" }
trait Bar {}

// Valid test: Derive Copy and Clone on a unit struct
#[derive(Copy, Clone)]
struct TupleStruct;
Loading