We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8008ba1 commit 1bb0872Copy full SHA for 1bb0872
tests/ui/precondition-checks/as_ascii_unchecked.rs
@@ -0,0 +1,17 @@
1
+//@ run-crash
2
+//@ compile-flags: -Copt-level=3 -Cdebug-assertions=no -Zub-checks=yes
3
+//@ error-pattern: as_ascii_unchecked requires that the
4
+//@ revisions: char str
5
+
6
+#![feature(ascii_char)]
7
8
+use std::ascii::Char;
9
10
+fn main() {
11
+ unsafe {
12
+ #[cfg(char)]
13
+ let _c: Char = '🦀'.as_ascii_unchecked();
14
+ #[cfg(str)]
15
+ let _c: &[Char] = "🦀".as_ascii_unchecked();
16
+ }
17
+}
0 commit comments