Auto merge of #51181 - mbrubeck:prelude, r=petrochenkov
Add std/core to prelude if extern_prelude enabled Fixes #50605
This commit is contained in:
commit
577a5b2703
3 changed files with 60 additions and 1 deletions
27
src/test/run-pass/extern-prelude-core.rs
Normal file
27
src/test/run-pass/extern-prelude-core.rs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(extern_prelude, lang_items, start, alloc)]
|
||||
#![no_std]
|
||||
|
||||
extern crate std as other;
|
||||
|
||||
mod foo {
|
||||
pub fn test() {
|
||||
let x = core::cmp::min(2, 3);
|
||||
assert_eq!(x, 2);
|
||||
}
|
||||
}
|
||||
|
||||
#[start]
|
||||
fn start(_argc: isize, _argv: *const *const u8) -> isize {
|
||||
foo::test();
|
||||
0
|
||||
}
|
||||
22
src/test/run-pass/extern-prelude-std.rs
Normal file
22
src/test/run-pass/extern-prelude-std.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(extern_prelude)]
|
||||
|
||||
mod foo {
|
||||
pub fn test() {
|
||||
let x = std::cmp::min(2, 3);
|
||||
assert_eq!(x, 2);
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
foo::test();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue