Skip to content

Commit a9a0f4c

Browse files
committed
Add a UI test for the missing allocator error message
1 parent 6ec1b62 commit a9a0f4c

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/test/ui/missing-allocator.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-flags: -C panic=abort
12+
// no-prefer-dynamic
13+
14+
#![no_std]
15+
#![crate_type = "staticlib"]
16+
#![feature(panic_implementation, lang_items, alloc)]
17+
18+
#[panic_implementation]
19+
fn panic(_: &core::panic::PanicInfo) -> ! {
20+
loop {}
21+
}
22+
23+
#[lang = "oom"]
24+
fn oom() {}
25+
26+
extern crate alloc;

src/test/ui/missing-allocator.stderr

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
error: no #[default_lib_allocator] found but one is required; is libstd not linked?
2+
3+
error: aborting due to previous error
4+

0 commit comments

Comments
 (0)