about summary refs log tree commit diff
path: root/tests/ui/no_std/no-core-edition2018-syntax.rs
blob: 9a327e4c8e3163c103d225a1add0f3b895dc4fad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//! 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
//@ edition:2018

#![allow(dead_code, unused_imports)]
#![feature(no_core)]
#![no_core]

extern crate core;
extern crate std;
use core::prelude::v1::*;
use core::*;

fn test_for_loop() {
    for _ in &[()] {}
}

fn test_question_mark_operator() -> Option<()> {
    None?
}

fn main() {}