Files
rust/tests/ui/no_std/no-core-edition2018-syntax.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
665 B
Rust
Raw Normal View History

2025-06-30 00:05:58 +05:00
//! Test that `#![no_core]` doesn't break modern Rust syntax in edition 2018.
//!
//! When you use `#![no_core]`, you lose the automatic prelude, but you can still
//! get everything back by manually importing `use core::{prelude::v1::*, *}`.
//! This test makes sure that after doing that, things like `for` loops and the
//! `?` operator still work as expected.
//@ run-pass
2025-06-30 00:05:58 +05:00
//@ edition:2018
2019-03-27 16:08:47 +09:00
#![allow(dead_code, unused_imports)]
#![feature(no_core)]
#![no_core]
extern crate core;
2025-06-30 00:05:58 +05:00
extern crate std;
use core::prelude::v1::*;
use core::*;
2019-03-27 16:08:47 +09:00
2025-06-30 00:05:58 +05:00
fn test_for_loop() {
2019-03-27 16:08:47 +09:00
for _ in &[()] {}
}
2025-06-30 00:05:58 +05:00
fn test_question_mark_operator() -> Option<()> {
2019-03-27 16:08:47 +09:00
None?
}
fn main() {}