Add a test for const
Similar to the tests for Option and Result.
This commit is contained in:
parent
af24bdbd96
commit
d591829ed0
15
src/test/ui/consts/cow-is-borrowed.rs
Normal file
15
src/test/ui/consts/cow-is-borrowed.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// run-pass
|
||||
|
||||
#![feature(cow_is_borrowed)]
|
||||
|
||||
use std::borrow::Cow;
|
||||
|
||||
fn main() {
|
||||
const COW: Cow<str> = Cow::Borrowed("moo");
|
||||
|
||||
const IS_BORROWED: bool = COW.is_borrowed();
|
||||
assert!(IS_BORROWED);
|
||||
|
||||
const IS_OWNED: bool = COW.is_owned();
|
||||
assert!(!IS_OWNED);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user