Skip to content

Commit c8fa49f

Browse files
committed
Auto merge of #50006 - rcoh:reorder-compiler-builtins, r=oli-obk
Reorder injection of std to get better compilation error Per #49851, reorder injection imports to get a better error message. r? @oli-obk
2 parents 3dfda16 + 084d2bc commit c8fa49f

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

src/libsyntax/std_inject.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ pub fn maybe_inject_crates_ref(mut krate: ast::Crate, alt_std_name: Option<&str>
5757
&["std"]
5858
};
5959

60-
for name in names {
60+
// .rev() to preserve ordering above in combination with insert(0, ...)
61+
for name in names.iter().rev() {
6162
krate.module.items.insert(0, P(ast::Item {
6263
attrs: vec![attr::mk_attr_outer(DUMMY_SP,
6364
attr::mk_attr_id(),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//~ ERROR 1:1: 1:1: can't find crate for `core` [E0463]
2+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
3+
// file at the top-level directory of this distribution and at
4+
// http://rust-lang.org/COPYRIGHT.
5+
//
6+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9+
// option. This file may not be copied, modified, or distributed
10+
// except according to those terms.
11+
12+
// compile-flags: --target thumbv7em-none-eabihf
13+
#![deny(unsafe_code)]
14+
#![deny(warnings)]
15+
#![no_std]
16+
17+
extern crate cortex_m;
18+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
error[E0463]: can't find crate for `core`
2+
|
3+
= note: the `thumbv7em-none-eabihf` target may not be installed
4+
5+
error: aborting due to previous error
6+
7+
For more information about this error, try `rustc --explain E0463`.

0 commit comments

Comments
 (0)