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: 2 additions & 0 deletions tests/ui/borrowck/borrowck-union-borrow-nested.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ fn main() {

trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
impl<T> Fake for T { }

//@ reference: items.union.ref.borrow
2 changes: 2 additions & 0 deletions tests/ui/borrowck/borrowck-union-borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,5 @@ fn main() {
}
}
}

//@ reference: items.union.ref.borrow
3 changes: 3 additions & 0 deletions tests/ui/consts/const-eval/union-const-eval-field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ fn main() {
assert_eq!(read_field2(), 1.0);
assert_eq!(read_field3(), unsafe { UNION.field3 });
}

//@ reference: items.union.fields.read
//@ reference: items.union.fields.validity
3 changes: 3 additions & 0 deletions tests/ui/consts/const-eval/union-ub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ const UNINIT_BOOL: bool = unsafe { DummyUnion { unit: () }.bool };
const BAD_UNION: Foo = unsafe { Bar { u8: 42 }.foo };

fn main() {}

//@ reference: items.union.fields.intro
//@ reference: items.union.fields.validity
2 changes: 2 additions & 0 deletions tests/ui/macros/stringify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1001,3 +1001,5 @@ fn test_punct() {
p!([ ,; ;, ** @@ $+$ >< <> ?? +== ], ",; ;, ** @@ $+$ >< <> ?? +==");
p!([ :#!@|$=&*,+;*~? ], ":#!@|$=&*,+;*~?");
}

//@ reference: items.union.fieldless
2 changes: 2 additions & 0 deletions tests/ui/nll/issue-45157.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ fn main() {
println!("{} {}", mref, nref)
}
}

//@ reference: items.union.ref.borrow
2 changes: 2 additions & 0 deletions tests/ui/nll/issue-57100.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,5 @@ fn first_union() {
}

fn main() {}

//@ reference: items.union.ref.borrow
2 changes: 2 additions & 0 deletions tests/ui/parser/recover/recover-field-semi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ enum Baz {
fn main() {
let _ = Foo { foo: "" }; //~ ERROR mismatched types
}

//@ reference: items.union.syntax
2 changes: 2 additions & 0 deletions tests/ui/privacy/union-field-privacy-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ fn main() { unsafe {
let m::U { b } = u; // OK
let m::U { c } = u; //~ ERROR field `c` of union `U` is private
}}

//@ reference: items.union.ref.use
2 changes: 2 additions & 0 deletions tests/ui/privacy/union-field-privacy-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ fn main() {
let b = u.b; // OK
let c = u.c; //~ ERROR field `c` of union `U` is private
}

//@ reference: items.union.ref.use
3 changes: 3 additions & 0 deletions tests/ui/union/union-basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ fn main() {
local();
xcrate();
}

//@ reference: items.union.common-storage
//@ reference: items.union.init.result
4 changes: 3 additions & 1 deletion tests/ui/union/union-inherent-method.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ run-pass
//@ reference: items.impl.inherent.allowed-items

union U {
a: u8,
Expand All @@ -13,3 +12,6 @@ fn main() {
let u = U { a: 10 };
assert_eq!(u.method(), 10);
}

//@ reference: items.impl.inherent.allowed-items
//@ reference: items.union.ref.use
2 changes: 2 additions & 0 deletions tests/ui/union/union-modification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ pub fn main() {
assert_eq!(unsafe { foo_holder.inner_foo.bar }, 4);
drop(foo_holder);
}

//@ reference: items.union.fields.write-safety
2 changes: 2 additions & 0 deletions tests/ui/union/union-nodrop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ fn main() {
assert!(needs_drop::<ActuallyDrop<u8>>());
assert!(needs_drop::<ActuallyDrop<Box<u8>>>());
}

//@ reference: items.union.drop
2 changes: 2 additions & 0 deletions tests/ui/union/union-repr-c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ extern "C" {
}

fn main() {}

//@ reference: type.union.layout
6 changes: 4 additions & 2 deletions tests/ui/union/union-transmute.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
//@ run-pass
//@ reference: items.union.common-storage
//@ reference: type.union.access

union U {
a: (u8, u8),
Expand All @@ -25,3 +23,7 @@ fn main() {
assert_eq!(w.a, 0b1_11111111_00000000000000000000000);
}
}

//@ reference: items.union.common-storage
//@ reference: items.union.fields.intro
//@ reference: type.union.access
2 changes: 2 additions & 0 deletions tests/ui/union/union.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ pub fn main() {
}
let Foo { bar: _ } = foo;
}

//@ reference: items.union.pattern.safety
Loading