Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
3e29fdb
Remove a number of vec UI tests, make them unit tests in the alloc li…
CraftSpider Sep 3, 2020
791f93c
Allow try blocks as the argument to return expressions
scottmcm Sep 3, 2020
2278c72
Remove vec-to_str.rs, merge the remaining test in with vec
CraftSpider Sep 3, 2020
a2e077e
Make `Ipv4Addr` and `Ipv6Addr` const tests unit tests under `library`
CDirkx Sep 3, 2020
8c93125
Address review comments on `Peekable::next_if`
jyn514 Sep 3, 2020
7b823df
Link to `#capacity-and-reallocation` when using with_capacity
jyn514 Sep 3, 2020
538e198
Move various ui const tests to `library`
CDirkx Sep 4, 2020
a3ee65f
Remove a useless allowed attr
tesuji Sep 4, 2020
8f11127
time.rs: Make spelling of "Darwin" consistent
numbermaniac Sep 4, 2020
fac2726
Use ops::ControlFlow in graph::iterate
scottmcm Sep 4, 2020
d16bbd1
Move Vec slice UI tests in library
Sep 4, 2020
8f2d906
Implementation of incompatible features error
Amjad50 Sep 3, 2020
2ed1a21
add some intra-doc links to `Iterator`
euclio Sep 4, 2020
bcfd15b
Remove unused duplicated `trivial_dropck_outlives`
jonas-schievink Sep 4, 2020
85b11d5
Improve docs for `std::env::args()`
camelid Sep 4, 2020
5456414
Fix nlink example typo
gillespiecd Sep 4, 2020
59e3733
Add `BREAK` too, and improve the comments
scottmcm Sep 4, 2020
dfd219d
Indent a note to make folding work nicer
tesuji Sep 5, 2020
4806e0a
Minor grammar fix in doc comment for soft-deprecated methods
Wilfred Sep 5, 2020
61ac138
Disable atomics on avr target.
m-ou-se Sep 5, 2020
e488c4f
Rollup merge of #76273 - CraftSpider:master, r=matklad
Dylan-DPC Sep 6, 2020
6545985
Rollup merge of #76274 - scottmcm:fix-76271, r=petrochenkov
Dylan-DPC Sep 6, 2020
7ad2b3a
Rollup merge of #76287 - lzutao:rm-allowed, r=jyn514
Dylan-DPC Sep 6, 2020
3d834bc
Rollup merge of #76293 - Amjad50:incompatible_features_error, r=lcnr
Dylan-DPC Sep 6, 2020
2c62189
Rollup merge of #76299 - CDirkx:ip-tests, r=matklad
Dylan-DPC Sep 6, 2020
ee840db
Rollup merge of #76302 - jyn514:peekable-2, r=Dylan-DPC
Dylan-DPC Sep 6, 2020
5b8f76d
Rollup merge of #76303 - jyn514:vec-assert-doc, r=Dylan-DPC
Dylan-DPC Sep 6, 2020
52d9162
Rollup merge of #76305 - CDirkx:const-tests, r=matklad
Dylan-DPC Sep 6, 2020
8ff13f4
Rollup merge of #76309 - lzutao:indent-note, r=jyn514
Dylan-DPC Sep 6, 2020
e735247
Rollup merge of #76312 - numbermaniac:patch-1, r=shepmaster
Dylan-DPC Sep 6, 2020
acd33e1
Rollup merge of #76318 - scottmcm:one-control-flow, r=ecstatic-morse
Dylan-DPC Sep 6, 2020
1b24f14
Rollup merge of #76324 - ayushmishra2005:move_vec_tests_in_library, r…
Dylan-DPC Sep 6, 2020
9f69a23
Rollup merge of #76338 - euclio:intra-link-iterator, r=jyn514
Dylan-DPC Sep 6, 2020
1db9290
Rollup merge of #76340 - jonas-schievink:rm-dupe, r=Mark-Simulacrum
Dylan-DPC Sep 6, 2020
346d54d
Rollup merge of #76344 - camelid:patch-6, r=KodrAus
Dylan-DPC Sep 6, 2020
d444913
Rollup merge of #76346 - gillespiecd:nlinks-docs, r=Dylan-DPC
Dylan-DPC Sep 6, 2020
5d89259
Rollup merge of #76358 - Wilfred:patch-3, r=lcnr
Dylan-DPC Sep 6, 2020
23f8dd1
Rollup merge of #76364 - fusion-engineering-forks:avr-no-atomic, r=jo…
Dylan-DPC Sep 6, 2020
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
13 changes: 13 additions & 0 deletions library/alloc/tests/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,16 @@ fn test_from_cow_path() {
let path = Path::new("hello");
test_from_cow!(path: &Path);
}

#[test]
fn cow_const() {
// test that the methods of `Cow` are usable in a const context

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);
}
1 change: 1 addition & 0 deletions library/alloc/tests/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![feature(allocator_api)]
#![feature(box_syntax)]
#![feature(cow_is_borrowed)]
#![feature(drain_filter)]
#![feature(exact_size_is_empty)]
#![feature(new_uninit)]
Expand Down
11 changes: 11 additions & 0 deletions library/core/tests/ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,3 +397,14 @@ fn test_is_ascii_align_size_thoroughly() {
}
}
}

#[test]
fn ascii_const() {
// test that the `is_ascii` methods of `char` and `u8` are usable in a const context

const CHAR_IS_ASCII: bool = 'a'.is_ascii();
assert!(CHAR_IS_ASCII);

const BYTE_IS_ASCII: bool = 97u8.is_ascii();
assert!(BYTE_IS_ASCII);
}
17 changes: 17 additions & 0 deletions library/core/tests/nonzero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,20 @@ fn test_nonzero_from_int_on_err() {
assert!(NonZeroI8::try_from(0).is_err());
assert!(NonZeroI32::try_from(0).is_err());
}

#[test]
fn nonzero_const() {
// test that the methods of `NonZeroX>` are usable in a const context
// Note: only tests NonZero8

const NONZERO: NonZeroU8 = unsafe { NonZeroU8::new_unchecked(5) };

const GET: u8 = NONZERO.get();
assert_eq!(GET, 5);

const ZERO: Option<NonZeroU8> = NonZeroU8::new(0);
assert!(ZERO.is_none());

const ONE: Option<NonZeroU8> = NonZeroU8::new(1);
assert!(ONE.is_some());
}
16 changes: 0 additions & 16 deletions src/test/ui/consts/const-nonzero.rs

This file was deleted.

15 changes: 0 additions & 15 deletions src/test/ui/consts/cow-is-borrowed.rs

This file was deleted.

15 changes: 0 additions & 15 deletions src/test/ui/consts/is_ascii.rs

This file was deleted.