Skip to content

Commit d591829

Browse files
author
CDirkx
committed
Add a test for const
Similar to the tests for Option and Result.
1 parent af24bdb commit d591829

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/test/ui/consts/cow-is-borrowed.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// run-pass
2+
3+
#![feature(cow_is_borrowed)]
4+
5+
use std::borrow::Cow;
6+
7+
fn main() {
8+
const COW: Cow<str> = Cow::Borrowed("moo");
9+
10+
const IS_BORROWED: bool = COW.is_borrowed();
11+
assert!(IS_BORROWED);
12+
13+
const IS_OWNED: bool = COW.is_owned();
14+
assert!(!IS_OWNED);
15+
}

0 commit comments

Comments
 (0)