Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Prototype run-make test to check core::ffi::c_* types against clang #133944

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ricci009
Copy link

@ricci009 ricci009 commented Dec 6, 2024

Hello,

I have been working on issue #133058 for a bit of time now and would love some feedback as I seem to be stuck and not sure if I am approaching this correctly.

I currently have the following setup:

  1. Get the rust target list

  2. Use rust target to query the llvm target

  3. Get clang definitions through querying the clang command with llvm target. I only save the necessary defines. Here is an example of the saved info (code can easily be modified to store Width as well):

Target: riscv64-unknown-linux-musl
CHAR_BIT = 8
CHAR_UNSIGNED = 1
SIZEOF_DOUBLE = 8
SIZEOF_INT = 4
SIZEOF_LONG = 8
SIZEOF_PTRDIFF_T = 8
SIZEOF_SIZE_T = 8
SIZEOF_FLOAT = 4
SIZEOF_LONG_LONG = 8
SIZEOF_SHORT = 2
Target: riscv64-unknown-fuchsia
CHAR_UNSIGNED = 1
SIZEOF_SHORT = 2
CHAR_BIT = 8
SIZEOF_INT = 4
SIZEOF_SIZE_T = 8
SIZEOF_FLOAT = 4
SIZEOF_LONG = 8
SIZEOF_DOUBLE = 8
SIZEOF_PTRDIFF_T = 8
SIZEOF_LONG_LONG = 8

  • I then save this into a hash map with the following format: <LLVM TARGET, <DEFINE NAME, DEFINE VALUE>>
  • Ex: <x86_64-unknown-linux-gnu, <SIZEOF_INT, 4>>

This is where it gets a bit shaky as I have been brainstorming ways to get the available c types in core::ffi to verify the size of the defined types but do not think I have the expertise to do this.

For the current implementation I specifically focus on the c_char type (unsigned vs signed). The test is currently failing as there are type mismatches which are expected (issue #129945 highlights this). I just do not know how to continue executing tests even with the type mismatches as it creates an error when running the run-make test. Or maybe I am doing something wrong in generating the test? Not too sure but would love your input. Thanks

r? @tgross35 @jieyouxu

@rustbot
Copy link
Collaborator

rustbot commented Dec 6, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @tgross35 (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 6, 2024
@rustbot rustbot assigned jieyouxu and unassigned tgross35 Dec 6, 2024
Comment on lines 6 to 21
("c_char", "__CHAR_BIT__"), // Character width
("char_signedness", "__CHAR_UNSIGNED__"),
("c_double", "__SIZEOF_DOUBLE__"), // Double precision floating-point
("c_float", "__SIZEOF_FLOAT__"), // Single precision floating-point
("c_int", "__SIZEOF_INT__"), // Signed integer
("c_long", "__SIZEOF_LONG__"), // Signed long integer
("c_longlong", "__SIZEOF_LONG_LONG__"), // Signed long long integer
("c_schar", "__SIZEOF_CHAR__"), // Signed char
("c_short", "__SIZEOF_SHORT__"), // Signed short integer
("c_uchar", "__SIZEOF_CHAR__"), // Unsigned char
("c_uint", "__SIZEOF_INT__"), // Unsigned integer
("c_ulong", "__SIZEOF_LONG__"), // Unsigned long integer
("c_ulonglong", "__SIZEOF_LONG_LONG__"), // Unsigned long long integer
("c_ushort", "__SIZEOF_SHORT__"), // Unsigned short integer
("c_size_t", "__SIZEOF_SIZE_T__"), // Size type
("c_ptrdiff_t", "__SIZEOF_PTRDIFF_T__"), // Pointer difference type];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should either prefer the standard macros of CHAR_WIDTH and so on where available (which will be in bits instead of bytes, but eh, just hit it with >> 3), or simply use the actual sizeof operator within the generated C code.

@rust-log-analyzer

This comment has been minimized.

@jyn514
Copy link
Member

jyn514 commented Dec 6, 2024

This is where it gets a bit shaky as I have been brainstorming ways to get the available c types in core::ffi to verify the size of the defined types but do not think I have the expertise to do this.

try a program like this:

    println!("{}", std::mem::size_of::<core::ffi::c_long>())

(and so on for the other types.) From there you can parse them into a map like you have for LLVM.

to get a list of the available types you could use something like grep 'type c_[^ ]*' library/core/src/ffi/mod.rs -o | cut -d' ' -f2 | sort -u. on my machine that prints

c_char
c_int
c_long
c_ptrdiff_t
c_size_t
c_ssize_t
c_uint
c_ulong

@tgross35
Copy link
Contributor

tgross35 commented Dec 9, 2024

Oh hey, thanks for working on this!

There are two interesting bits here:

  1. There is value in running this for all targets, not just the ones that get native tests run. We can't reasonably build core because of the time that takes.
  2. Because of this, we can't actually check what core::ffi::... looks like

What I mentioned in #133058 (comment) works, I was able to prototype this out relatively easily.

Solution to #1

Rust has the internal no_core feature which lets you skip building core and bring only the features you need. It's pretty weird to work with since you need to redefine every little thing you want to use (we provide minicore.rs to help with some of that), but it's pretty useful for running tests. Here, we need to hook a few additional lang items and intrinsics:

// smallcore.rs (within this run-make directory)
#![allow(internal_features)]
#![feature(decl_macro)]
#![feature(intrinsics)]
#![feature(lang_items)]
#![feature(link_cfg)]
#![feature(no_core)]
#![feature(rustc_attrs)]

#![no_core]
#![no_std]

// This is in `tests/auxiliary/minicore.rs`
extern crate minicore;
use minicore::Sized;

// Copy the body from https://github.com/rust-lang/rust/blob/df5b8e39b7def660696340b199ae395a869b3064/library/core/src/internal_macros.rs#L149
macro_rules! cfg_if { /* ... */ }

macro_rules! panic {
    ($msg:literal) => { $crate::panic(&$msg) };
}

/* Intrinsics are function signatures that `rustc` does something magic with.
 * The body doesn't matter. */

#[rustc_intrinsic]
#[rustc_intrinsic_const_stable_indirect]
#[rustc_intrinsic_must_be_overridden]
pub const fn size_of<T>() -> usize {
    loop {}
}

#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
pub const fn abort() -> ! {
    loop {}
}

/* Lang items are similar to intrinsics but aren't limited to function signatures */

// This is what `panic!()` usually eventually expands to
#[lang = "panic"]
#[rustc_const_panic_str]
const fn panic(_expr: &&'static str) -> ! {
    abort();
}

/* We need to reimplement some basic traits so rustc knows what to do with `==` and `!` */

#[lang = "eq"]
pub trait PartialEq<Rhs: ?Sized = Self> {
    fn eq(&self, other: &Rhs) -> bool;
    fn ne(&self, other: &Rhs) -> bool {
        !self.eq(other)
    }
}

#[lang = "not"]
pub trait Not {
    type Output;
    fn not(self) -> Self::Output;
}

impl PartialEq for usize {
    fn eq(&self, other: &usize) -> bool {
        (*self) == (*other)
    }
}

impl Not for bool {
    type Output = bool;
    fn not(self) -> Self {
        !self
    }
}

(@jieyouxu any interest in just putting some of this in minicore?)

Solution to #2

We can't build core so that means we can't just access the types via core::ffi. This module is simple enough that it can be cleaned up into something that doesn't depend on the rest of core, I just quickly with perl for experimentation but you can just use regex from run_make_support.

# Start with core/src/ffi copied to a temporary directory

# Remove stability attrbutes since they can't be used outside of std
perl -i -0777 -pe 's/#!?\[(un)?stable.*?\]//gs' ffi/mod.rs

# Remove doc attributes since we'll be removing some items they apply to
perl -i -0777 -pe 's/#\[doc.*?\]//gs' ffi/mod.rs

# Remove lang item indicators so they don't conflict if `minicore` gets updated
perl -i -0777 -pe 's/#\[lang.*?\]//gs' ffi/mod.rs

# Remove non-inline modules since we don't need `cstr` or `va_list`
perl -i -0777 -pe 's/.*mod.*;//g' ffi/mod.rs

# Remove reexports that go with those modules
perl -i -0777 -pe 's/.*use.*;//g' ffi/mod.rs

# Remove the `Debug` implementation for `c_void`. This is done in two steps
# to avoid regex tripping over `{`/`}`
perl -i -0777 -pe 's/fn fmt.*?\{.*?\}//gs' ffi/mod.rs
perl -i -0777 -pe 's/impl fmt::Debug for.*?\{.*?\}//gs' ffi/mod.rs

# Just for sanity sake when looking at the generated files, eliminate repeated empty lines
perl -i -0777 -pe 's/\n{3,}/\n\n/gs' ffi/mod.rs

What might actually be better is to move the types we care about into a new mod types, then only the stability attributes need to be stripped (edit: yeah, you should just do this rather than copying my regex hacks).

Tests

Write a test file that asserts each size at compile time, using what we have in smallcore for something like assert_eq! (you could also add an assert_eq macro but 🤷)

// tests.rs

use super::*; // `super` will include everything from `smallcore` once glued together

pub const TEST_C_CHAR_SIZE: () = if size_of::<ffi::c_char>() != CLANG_C_CHAR_SIZE {
    panic!("wrong c_char size");
};

pub const TEST_C_LONG_SIZE: () = if size_of::<ffi::c_long>() != CLANG_C_LONG_SIZE {
    panic!("wrong c_long size");
};

Glue

This is the only target-specific part: each target needs to generate its own file where you fill in the CLANG_* variables based on whatever you collected from Clang.

/* boilerplate part */
#![allow(unused)]

// include! rather than `mod` with `path` since this one has crate-level
// attributes
include!("path/to/smallcore.rs");

// Path to the simplified FFI file
#[path = "path/to/ffi.rs"]
mod ffi;

#[path = "path/to/tests.rs"]
mod tests;

/* end boilerplate */

/* Per-target: append to the template based on Clang's output */

const CLANG_C_CHAR_SIZE: usize = 1;
const CLANG_C_LONG_SIZE: usize = 8;
// ...

Then just have rustc build the file for the relevant target; if our sizes are wrong, we'll get a failure at const eval. You can even pass -Zno-codegen to make this faster (the rustc equivalent of cargo c).

@jieyouxu
Copy link
Member

jieyouxu commented Dec 9, 2024

I'll take a look later today, thanks for the detailed writeup.

@tgross35
Copy link
Contributor

tgross35 commented Dec 9, 2024

For checking the sign, you could do add something like this to tests.rs:

trait Signed {
    const SIGNED: bool;
}

impl Signed for i8 {
    const SIGNED: bool = true;
}

impl Signed for u8 {
    const SIGNED: bool = false;
}

const TEST_C_CHAR_SIGNED: () = if ffi::c_char::SIGNED ^ CLANG_C_CHAR_SIGNED {
    panic("mismatched c_char sign");
};

This requires adding a BitXor trait and impl (like Not/PartialEq)

@tgross35
Copy link
Contributor

tgross35 commented Dec 9, 2024

I'll take a look later today, thanks for the detailed writeup.

Thanks! This is less nice than having core available ofc, but this builds a no_core crate for all targets in about a minute on my computer, and it seems reasonably robust.

Most fragile thing is probably the text processing of ffi/mod.rs, but I think we could move everything relevant to ffi/types.rs and just leave a note there not to import anything from crate.

@tgross35
Copy link
Contributor

tgross35 commented Dec 9, 2024

One other thought: this PR shouldn't fix anything that doesn't currently line up, so there should be xfails. It might be easiest to just do this in tests.rs:

// tests that always pass don't need a cfg_if

cfg_if! {
    if #[cfg(target_os = "foobar")] {
        // FIXME: long isn't long enough on foobar
        const XFAIL_C_LONG_SIZE: usize = 16;
        pub const TEST_C_LONG_SIZE: () = if size_of::<ffi::c_long>() != XFAIL_C_LONG_SIZE {
            panic("wrong c_long size");
        };
    } else {
        // Default test
        pub const TEST_C_LONG_SIZE: () = if size_of::<ffi::c_long>() != CLANG_C_LONG_SIZE {
            panic("wrong c_long size");
        };
    }
}

@ricci009
Copy link
Author

ricci009 commented Dec 10, 2024

Thanks for the write up, I appreciate it! Will read it and look to understand it tonight :).

Just a quick question that might be off topic but I created the following function for testing purposes:

pub fn create_type_sizes() -> std::collections::HashMap<String, String> {
    let mut sizes = std::collections::HashMap::new();
    sizes.insert("c_char".to_string(), std::mem::size_of::<core::ffi::c_char>().to_string());
    sizes.insert("c_int".to_string(), std::mem::size_of::<core::ffi::c_int>().to_string());
    sizes.insert("c_long".to_string(), std::mem::size_of::<core::ffi::c_long>().to_string());
    sizes.insert("c_ptrdiff_t".to_string(), std::mem::size_of::<core::ffi::c_ptrdiff_t>().to_string());
    sizes.insert("c_size_t".to_string(), std::mem::size_of::<core::ffi::c_size_t>().to_string());
    sizes.insert("c_ssize_t".to_string(), std::mem::size_of::<core::ffi::c_ssize_t>().to_string());
    sizes.insert("c_uint".to_string(), std::mem::size_of::<core::ffi::c_uint>().to_string());
    sizes.insert("c_ulong".to_string(), std::mem::size_of::<core::ffi::c_ulong>().to_string());
    sizes
}

I wanted to save the sizes for the c types for the current target but I get 3 errors for the following types:

c_ptrdiff_t
c_size_t
c_ssize_t

The error is as follows:

use of unstable library feature c_size_t.

The open issue is issue #88345

My concern is that in the tests we are using size_of::ffi::TYPE(). If we input the type as c_size_t or the other 2 we will get an error. Should this effect the run-make test at all or is it fine?

Edit: I am assuming adding #![feature(c_size_t)] allows the run-make test not to be affected by this.

@ricci009
Copy link
Author

ricci009 commented Dec 10, 2024

disregard this commit, gonna be following what you outlined for the solution.

@rust-log-analyzer

This comment has been minimized.

@jieyouxu
Copy link
Member

jieyouxu commented Dec 10, 2024

I was eepy yesterday, going to revisit this in a moment today. I'll need to revisit what the test requirements are.

@tgross35
Copy link
Contributor

Edit: I am assuming adding #![feature(c_size_t)] allows the run-make test not to be affected by this.

Just for reference, this would be correct if importing from core. It shouldn't be relevant though with the no_core solution since the file has to get copied out of core and have the stability attributes stripped.

@jieyouxu
Copy link
Member

Solution to #1

Rust has the internal no_core feature which lets you skip building core and bring only the features you need. It's pretty weird to work with since you need to redefine every little thing you want to use (we provide minicore.rs to help with some of that), but it's pretty useful for running tests. Here, we need to hook a few additional lang items and intrinsics:

[... trimmde ...]

(@jieyouxu any interest in just putting some of this in minicore?)

Yes, if these items are only in core (not alloc, not std-only), please do add them to tests/auxiliary/minicore.rs.

Solution to #2

We can't build core so that means we can't just access the types via core::ffi. This module is simple enough that it can be cleaned up into something that doesn't depend on the rest of core, I just quickly with perl for experimentation but you can just use regex from run_make_support.

[... trimmed ...]

What might actually be better is to move the types we care about into a new mod types, then only the stability attributes need to be stripped (edit: yeah, you should just do this rather than copying my regex hacks).

Moving to mod types; sounds less fragile to me, and if the resulting test can properly exercise mod types; through proper name resolution + type checking etc., then please do that instead of regex hacks which will necessarily be fragile.

Glue

This is the only target-specific part: each target needs to generate its own file where you fill in the CLANG_* variables based on whatever you collected from Clang.

/* boilerplate part */
#![allow(unused)]

// include! rather than `mod` with `path` since this one has crate-level
// attributes
include!("path/to/smallcore.rs");

// Path to the simplified FFI file
#[path = "path/to/ffi.rs"]
mod ffi;

#[path = "path/to/tests.rs"]
mod tests;

/* end boilerplate */

/* Per-target: append to the template based on Clang's output */

const CLANG_C_CHAR_SIZE: usize = 1;
const CLANG_C_LONG_SIZE: usize = 8;
// ...

Then just have rustc build the file for the relevant target; if our sizes are wrong, we'll get a failure at const eval. You can even pass -Zno-codegen to make this faster (the rustc equivalent of cargo c).

I don't actually know what -Z no-codegen does, but --emit=metadata is what the check-pass mode does.

@tgross35 tgross35 self-assigned this Dec 22, 2024
@tgross35
Copy link
Contributor

tgross35 commented Dec 27, 2024

@rustbot author

@ricci009 just let us know if you get stuck (absolutely no pressure if it's just a time thing)

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 27, 2024
@ricci009
Copy link
Author

@tgross35
Hi, sorry I just got swarmed over this month with holiday and work stuff. I am still working on it and will let you know if there are any issues or I get stuck. Thanks for reaching out :)

@ricci009
Copy link
Author

ricci009 commented Jan 12, 2025

@tgross35
I believe I am building the target file incorrectly.

let rustc_output = rustc() .arg("-Z") .arg("unstable-options") .arg("--target") .arg(target) .arg(&file_name) .run();

this is how I attempt to build it but I receive this error:

error[E0463]: can't find crate for std

I have tried to fix this problem through defining #![no_std] in the target file but that does not seem right and does not work.

Smallcore is still the same as what you outlined and I created a mod.rs file like you explained.

@rust-log-analyzer

This comment has been minimized.

@tgross35
Copy link
Contributor

tgross35 commented Jan 12, 2025

I have tried to fix this problem through defining #![no_std] in the target file but that does not seem right and does not work.

That file also needs #![feature(no_core)] and #[no_core]. I'll take a closer look at the rest soon to see if it looks right.

Also as @jieyouxu mentioned above, you can add whatever is missing to tests/auxiliary/minicore.rs and include that rather than creating a new file smallcore.rs (sorry my advice was a bit outdated), so that may make some things simpler.

Comment on lines 69 to 80
let rustc_output = rustc()
.arg("-Z")
.arg("unstable-options")
.arg("--target")
.arg(target)
.arg(&file_name)
.run();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add --emit=metadata so it just checks without building

}
}

// default sizing here, not sure if this is necessary tho or should be included.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know which specific targets are missing these types? I think it is probably better to not have a fallback since that might mean things pass when they shouldn't if clang's output is weird for some reason.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, will delete the defaulting portion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will eventually need to be generated rather than checked in (I assume this is for testing, just making sure)

for target in targets.lines() {
// Run clang to get target info

//TODO: someone please test riscv targets as clang on my machine does not have that llvm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI should :) (I think)

Comment on lines 16 to 19
if target.starts_with("riscv") {
continue;
}
if target.starts_with("wasm") {
continue;
}
if target.starts_with("xtensa") {
continue;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this instead be a const SKIPPED_TARGETS: &[&str] = &[...] at the top of the file, with the full exact target names? So we don't cross off more than is needed.

@ricci009
Copy link
Author

ricci009 commented Jan 12, 2025

@tgross35
Another question in regards to the glue aspect of test.rs, mod.rs and minicore.rs.

It seems that just generating a file that has

include!("path/to/smallcore.rs");
#[path = "./ffi/mod.rs"]
mod ffi;
#[path = "./tests.rs"]
mod tests;

does not glue it together properly as it does not find the custom macros (panic, cfg_if, etc...) and the macro include does not exist for this scope.

Could I just directly inline the parsed mod.rs and tests.rs and then use a modified minicore with the added checks that are in smallcore?

What I am thinking code wise:

let mut rmake_content = String::from(
    r#"
    #![no_std]
    #![no_core]
    #![feature(no_core)]
    #![allow(unused)]
    
    extern crate minicore; //would contain the added macros from smallcore.rs 
    use minicore::Sized;
    "#,
);

// direct inline of mod.rs content (FFI types)
let mod_content = rfs::read_to_string("./ffi/mod.rs");
rmake_content.push_str(&mod_content);

rmake_content.push_str(&format!(
    "
    const CLANG_C_CHAR_SIZE: usize = {};
    const CLANG_C_CHAR_SIGNED: bool = {};
    const CLANG_C_SHORT_SIZE: usize = {};
    const CLANG_C_INT_SIZE: usize = {};
    const CLANG_C_LONG_SIZE: usize = {};
    const CLANG_C_LONGLONG_SIZE: usize = {};
    const CLANG_C_FLOAT_SIZE: usize = {};
    const CLANG_C_DOUBLE_SIZE: usize = {};
    ",
    parse_size(&defines, "CHAR"),
    parse_signed(&defines, "CHAR"),
    parse_size(&defines, "SHORT"),
    parse_size(&defines, "INT"),
    parse_size(&defines, "LONG"),
    parse_size(&defines, "LONG_LONG"),
    parse_size(&defines, "FLOAT"),
    parse_size(&defines, "DOUBLE"),
));

// direct inline of tests.rs
let test_content = rfs::read_to_string("tests.rs"); //super is deleted from tests.rs
rmake_content.push_str(&test_content);

what do you think? Maybe the structure or something else is messed up but I am unsure on how else it can all be glued together in order to use the newly specified macros as well as include tests.rs.

I would still like to use super and make it clean instead of writing out literally everything to the target file. I will continue to think about it but if you have any insight it is greatly appreciated. Thanks!

EDIT: this code does not fix the issues nor does it really change anything.

@tgross35
Copy link
Contributor

It seems that just generating a file that has

include!("path/to/smallcore.rs");
#[path = "./ffi/mod.rs"]
mod ffi;
#[path = "./tests.rs"]
mod tests;

does not glue it together properly as it does not find the custom macros (panic, cfg_if, etc...) and the macro include does not exist for this scope.

Would you mind pushing if code is updated from what is here currently, or pasting the error messages? It should work as long as smallcore has those macros. Note that smallcore isn't needed anymore and can just be merged into minicore (smallcore was my suggestion before knowing that was okay), but that's beside the point.

I think this test will need //@ needs-force-clang-based-tests to make sure Clang is available (@jieyouxu these tests don't get run in PR CI do they?)

Could I just directly inline the parsed mod.rs and tests.rs and then use a modified minicore with the added checks that are in smallcore?

Using extern crate minicore; should be fine, I believe you just need to build it with a separate rustc() invocation and then link it with --extern when you build the test file. So include! is a bit more straightforward if you can get it to work.

@jieyouxu
Copy link
Member

I think this test will need //@ needs-force-clang-based-tests to make sure Clang is available (@jieyouxu these tests don't get run in PR CI do they?)

They do in two(?) specific runners, I believe it's aarch64-gnu-debug and x86_64-gnu-debug, but the job names may have shuffled around a bit since I last used these specifically.

@jieyouxu jieyouxu changed the title initial non-working draft for issue #133058 [WIP] Prototype run-make test to check core::ffi::c_* types against clang Jan 12, 2025
@ricci009
Copy link
Author

ricci009 commented Jan 13, 2025

@tgross35 Alrighty, I pushed the code.

Here are a few examples of some of the errors (42 output when I run):

size_of not found

error[E0425]: cannot find function `size_of` in this scope
  --> tests.rs:65:39
   |
65 | pub const TEST_C_DOUBLE_SIZE: () = if size_of::<ffi::c_double>() != CLANG_C_DOUBLE_SIZE {
   |                                       ^^^^^^^ not found in this scope
   

not finding the types in ffi

rror[E0412]: cannot find type `c_char` in module `ffi`
--> tests.rs:34:52
|
34 | pub const TEST_C_CHAR_SIZE: () = if size_of::<ffi::c_char>() != CLANG_C_CHAR_SIZE {
|                                                    ^^^^^^ not found in `ffi`
sassembler mipsinfo mirparser msp430 msp430asmparser ms
error[E0412]: cannot find type `c_short` in module `ffi`
--> tests.rs:44:53
|
44 | pub const TEST_C_SHORT_SIZE: () = if size_of::<ffi::c_short>() != CLANG_C_SHORT_SIZE {
|                                                     ^^^^^^^ not found in `ffi`
ctiondag sparc sparcasmparser sparccodegen sparcdesc sp
error[E0412]: cannot find type `c_int` in module `ffi`
--> tests.rs:49:51
|
49 | pub const TEST_C_INT_SIZE: () = if size_of::<ffi::c_int>() != CLANG_C_INT_SIZE {
|                                                   ^^^^^ not found in `ffi`
codegen x86desc x86disassembler x86info x86targetmca xr

panic macro not found

error: cannot find macro `panic` in this scope
  --> tests.rs:66:5
   |
66 |     panic!("wrong c_double size");
   |     ^^^^^

alias not found

error: cannot find macro `type_alias` in this scope
  --> ffi/mod.rs:16:1
   |
16 | type_alias! { "c_double.md", c_double = f64; }
   | ^^^^^^^^^^

Comment on lines 28 to 40
r#"
#![no_std]
#![no_core]
#![feature(no_core)]
#![allow(unused)]
#[path = "ffi/mod.rs"]
mod ffi;
#[path = "tests.rs"]
mod tests;
"#,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing an include!("../../path/to/minicore.rs")? :)

You should be able to populate the path with something like run_make_support::source_root.join("tests/auxiliary/minicore.rs").

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could I do it like this?

    let minicore_path = run_make_support::source_root().join("tests/auxiliary/minicore.rs");

    // For each target:
    for target in targets.lines() {
        // Run clang to get target info

        //TODO: someone please test riscv targets as clang on my machine does not have that llvm
        //target

        if SKIPPED_TARGETS.iter().any(|prefix| target.starts_with(prefix)) {
            continue;
        }

        let clang_output =
            clang().args(&["-E", "-dM", "-x", "c", "/dev/null", "-target", target]).run();

        let defines = String::from_utf8(clang_output.stdout()).expect("Invalid UTF-8");

        // TODO: mod rs file will need to be generated based off of core_ffi - can use regex
        // availble in run-make to handle.
        let minicore_content = rfs::read_to_string(&minicore_path);
        let mut rmake_content = format!(
            r#"
            #![no_std]
            #![no_core]
            #![feature(no_core)]
            #![allow(unused)]
            {}
            #[path = "ffi/mod.rs"]
            mod ffi;
            #[path = "tests.rs"]
            mod tests;
            "#,
            minicore_content
        );
        

the issue I am seeing with the include! is it does not exist because the macro is undefined. Hence, I just decided to directly insert the file contents into here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I forgot that cyclic dependency; yeah, just combining it there should work. Otherwise you could redefine the macro like https://doc.rust-lang.org/1.84.0/src/core/macros/mod.rs.html#1540, or build it separately, but I think what you suggested is easiest.

@ricci009
Copy link
Author

ricci009 commented Jan 15, 2025

@tgross35

I have most of the test now working properly! Just a few issues with specific targets.

To verify, these are the types that have mismatches:

const SKIPPED_TARGETS: &[&str] = &[
    "riscv",
    "wasm",   //error: unknown target triple 'wasm32v1-none'
    "xtensa", //error: unknown target triple 'xtensa-esp32-espidf'
    "aarch64",
    "arm",
    "avr",
    "csky",
    "hexagon",
    "msp430",
    "thumb",
    "x86_64-unknown-l4re-uclibc", //idk how to define this one
];
//riscv32 unsigned char
//aarch64 unsigned char
//arm unsigned char
//csky unsigned char
//hexagon unsigned char
//thumb unsigned char
//x86_64-unknown-l4re-uclibc unsigned char

//avr incorrect c_int size
//msp430 incorrect c_int size

With these skipped the test passes.

I don't want to skip them but instead handle these properly in tests.rs as you highlighted with the following:

cfg_if! {
    if #[cfg(any(
        all(
            target_os = "darwin",
            target_arch = "aarch64"
        )
    ))] {
        const XFAIL_C_CHAR_SIGNED: bool = true;  
        pub const TEST_C_CHAR_UNSIGNED: () = if ffi::c_char::SIGNED ^ XFAIL_C_CHAR_SIGNED {
            panic!("mismatched c_char sign");
        };
    } else {
        pub const TEST_C_CHAR_UNSIGNED: () = if ffi::c_char::SIGNED ^ CLANG_C_CHAR_SIGNED {
            panic!("mismatched c_char sign");
        };
    }
}

but for some reason it is not matching up the target and executing that if branch (just testing with the aarch64 target atm).

I have tried multiple ways to define it and highlight it but it always executes the else branch and I am stumped on why.

Any ideas?

@tgross35
Copy link
Contributor

           target_os = "darwin",

Is this the actual code that is failing? If so, target_os = "macos" is the cfg (or target_vendor = "apple" if that is more accurate). If you add #![deny(warnings)] to the top of the generated code, that might give you some better feedback (I think warnings just get eaten when running via ./x?)

For future reference, you can run rustc --print cfg --target ... to see the target_os target_arch etc config for each target.

@ricci009
Copy link
Author

Oh nice. Thanks, that fixed it. Will do this for the rest and then the PR should be ready :) .

@ricci009
Copy link
Author

ricci009 commented Jan 15, 2025

           target_os = "darwin",

Is this the actual code that is failing? If so, target_os = "macos" is the cfg (or target_vendor = "apple" if that is more accurate). If you add #![deny(warnings)] to the top of the generated code, that might give you some better feedback (I think warnings just get eaten when running via ./x?)

For future reference, you can run rustc --print cfg --target ... to see the target_os target_arch etc config for each target.

In regards to this tho, would it be better to just include it into mod.rs?

mod c_char_definition {
    cfg_if! {
        // These are the targets on which c_char is unsigned.
        if #[cfg(any(
            all(
                target_os = "linux",
                any(
                    target_arch = "aarch64",
                    target_arch = "arm",
                    target_arch = "hexagon",
                    target_arch = "powerpc",
                    target_arch = "powerpc64",
                    target_arch = "s390x",
                    target_arch = "riscv64",
                    target_arch = "riscv32",
                    target_arch = "csky"
                )
            ),
            all(target_os = "android", any(target_arch = "aarch64", target_arch = "arm")),
            all(target_os = "l4re", target_arch = "x86_64"),
            all(
                any(target_os = "freebsd", target_os = "openbsd", target_os = "rtems"),
                any(
                    target_arch = "aarch64",
                    target_arch = "arm",
                    target_arch = "powerpc",
                    target_arch = "powerpc64",
                    target_arch = "riscv64"
                )
            ),
            all(
                target_os = "netbsd",
                any(
                    target_arch = "aarch64",
                    target_arch = "arm",
                    target_arch = "powerpc",
                    target_arch = "riscv64"
                )
            ),
            all(
                target_os = "vxworks",
                any(
                    target_arch = "aarch64",
                    target_arch = "arm",
                    target_arch = "powerpc64",
                    target_arch = "powerpc"
                )
            ),
            all(
                target_os = "fuchsia",
                any(target_arch = "aarch64", target_arch = "riscv64")
            ),
            all(target_os = "nto", target_arch = "aarch64"),
            target_os = "horizon",
            target_os = "aix",
        ))] {
            pub type c_char = u8;
        } else {
            // On every other target, c_char is signed.
            pub type c_char = i8;
        }
    }
}

Basically in this just add the additional targets (os as well) I found that have an unsigned char.

@tgross35
Copy link
Contributor

That file was updated recently so it's as bad,

if #[cfg(all(
not(windows),
not(target_vendor = "apple"),
any(
target_arch = "aarch64",
target_arch = "arm",
target_arch = "csky",
target_arch = "hexagon",
target_arch = "msp430",
target_arch = "powerpc",
target_arch = "powerpc64",
target_arch = "riscv64",
target_arch = "riscv32",
target_arch = "s390x",
target_arch = "xtensa",
)
))] {
pub type c_char = u8;
} else {
// On every other target, c_char is signed.
pub type c_char = i8;
}
.

However, it shouldn't matter right? Once you have that autogenerated from library/core/src/ffi/mod.rs (or move it to a separate module first as mentioned in item # at #133944 (comment)), there won't be anything manual to copy.

@ricci009
Copy link
Author

ricci009 commented Jan 18, 2025

@tgross35 I noticed that the most recent mod.rs does not handle different sizes for doubles (ex: avr having a size of 4 bytes for a double leading to a mismatch in sizes). Would it be a good idea to add this to the ffi/mod.rs? Otherwise it just always panics at the misalignment because size_of::<ffi::c_double> is always 8 bytes while in the target avr the size is 4 bytes.

Edit: avr-unknown-gnu-atmega328 is the only one that fails test_c_double_size due to a size misalignment.

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-18 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#22 exporting to docker image format
#22 sending tarball 28.0s done
#22 DONE 33.7s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-18]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-18', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-18/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
---- [ui] tests/ui/abi/compatibility.rs#aarch64 stdout ----

error in revision `aarch64`: auxiliary build of "/checkout/tests/auxiliary/minicore.rs" failed to compile: 
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/auxiliary/minicore.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--cfg" "aarch64" "--check-cfg" "cfg(test,FALSE,host,i686,x86_64,x86_64_win,arm,aarch64,s390x,mips,mips64,sparc,sparc64,powerpc64,riscv,loongarch64,wasip1,bpf,m68k,csky,nvptx64)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/abi/compatibility.aarch64/libminicore.rlib" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target" "aarch64-unknown-linux-gnu" "-Cpanic=abort" "--crate-type" "rlib" "-Cpanic=abort"
--- stderr -------------------------------
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:171:1
   |
   |
LL | #[rustc_intrinsic]
   | ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the `#[rustc_intrinsic_must_be_overridden]` attribute is used to declare intrinsics without real bodies
   |
LL | #[rustc_intrinsic_must_be_overridden]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:178:1
   |
LL | #[rustc_intrinsic]
LL | #[rustc_intrinsic]
   | ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the `#[rustc_intrinsic_must_be_overridden]` attribute is used to declare intrinsics without real bodies
   |
LL | #[rustc_intrinsic_must_be_overridden]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0658`.
------------------------------------------
------------------------------------------


---- [ui] tests/ui/abi/compatibility.rs#arm stdout ----

error in revision `arm`: auxiliary build of "/checkout/tests/auxiliary/minicore.rs" failed to compile: 
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/auxiliary/minicore.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--cfg" "arm" "--check-cfg" "cfg(test,FALSE,host,i686,x86_64,x86_64_win,arm,aarch64,s390x,mips,mips64,sparc,sparc64,powerpc64,riscv,loongarch64,wasip1,bpf,m68k,csky,nvptx64)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/abi/compatibility.arm/libminicore.rlib" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target" "arm-unknown-linux-gnueabi" "-Cpanic=abort" "--crate-type" "rlib" "-Cpanic=abort"
--- stderr -------------------------------
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:171:1
   |
   |
LL | #[rustc_intrinsic]
   | ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the `#[rustc_intrinsic_must_be_overridden]` attribute is used to declare intrinsics without real bodies
   |
LL | #[rustc_intrinsic_must_be_overridden]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:178:1
   |
LL | #[rustc_intrinsic]
LL | #[rustc_intrinsic]
   | ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the `#[rustc_intrinsic_must_be_overridden]` attribute is used to declare intrinsics without real bodies
   |
LL | #[rustc_intrinsic_must_be_overridden]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0658`.
------------------------------------------
------------------------------------------


---- [ui] tests/ui/abi/compatibility.rs#host stdout ----

error in revision `host`: auxiliary build of "/checkout/tests/auxiliary/minicore.rs" failed to compile: 
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/auxiliary/minicore.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--cfg" "host" "--check-cfg" "cfg(test,FALSE,host,i686,x86_64,x86_64_win,arm,aarch64,s390x,mips,mips64,sparc,sparc64,powerpc64,riscv,loongarch64,wasip1,bpf,m68k,csky,nvptx64)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/abi/compatibility.host/libminicore.rlib" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Cpanic=abort" "--crate-type" "rlib" "-Cpanic=abort"
--- stderr -------------------------------
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:171:1
   |
   |
LL | #[rustc_intrinsic]
   | ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the `#[rustc_intrinsic_must_be_overridden]` attribute is used to declare intrinsics without real bodies
   |
LL | #[rustc_intrinsic_must_be_overridden]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:178:1
   |
LL | #[rustc_intrinsic]
LL | #[rustc_intrinsic]
   | ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the `#[rustc_intrinsic_must_be_overridden]` attribute is used to declare intrinsics without real bodies
   |
LL | #[rustc_intrinsic_must_be_overridden]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0658`.
------------------------------------------
------------------------------------------


---- [ui] tests/ui/abi/compatibility.rs#loongarch64 stdout ----

error in revision `loongarch64`: auxiliary build of "/checkout/tests/auxiliary/minicore.rs" failed to compile: 
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/auxiliary/minicore.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--cfg" "loongarch64" "--check-cfg" "cfg(test,FALSE,host,i686,x86_64,x86_64_win,arm,aarch64,s390x,mips,mips64,sparc,sparc64,powerpc64,riscv,loongarch64,wasip1,bpf,m68k,csky,nvptx64)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/abi/compatibility.loongarch64/libminicore.rlib" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target" "loongarch64-unknown-linux-gnu" "-Cpanic=abort" "--crate-type" "rlib" "-Cpanic=abort"
--- stderr -------------------------------
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:171:1
   |
   |
LL | #[rustc_intrinsic]
   | ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the `#[rustc_intrinsic_must_be_overridden]` attribute is used to declare intrinsics without real bodies
   |
LL | #[rustc_intrinsic_must_be_overridden]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:178:1
   |
LL | #[rustc_intrinsic]
LL | #[rustc_intrinsic]
   | ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the `#[rustc_intrinsic_must_be_overridden]` attribute is used to declare intrinsics without real bodies
   |
LL | #[rustc_intrinsic_must_be_overridden]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0658`.
------------------------------------------
------------------------------------------


---- [ui] tests/ui/abi/compatibility.rs#bpf stdout ----

error in revision `bpf`: auxiliary build of "/checkout/tests/auxiliary/minicore.rs" failed to compile: 
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/auxiliary/minicore.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--cfg" "bpf" "--check-cfg" "cfg(test,FALSE,host,i686,x86_64,x86_64_win,arm,aarch64,s390x,mips,mips64,sparc,sparc64,powerpc64,riscv,loongarch64,wasip1,bpf,m68k,csky,nvptx64)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/abi/compatibility.bpf/libminicore.rlib" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target" "bpfeb-unknown-none" "-Cpanic=abort" "--crate-type" "rlib" "-Cpanic=abort"
--- stderr -------------------------------
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:171:1
   |
   |
LL | #[rustc_intrinsic]
   | ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the `#[rustc_intrinsic_must_be_overridden]` attribute is used to declare intrinsics without real bodies
   |
LL | #[rustc_intrinsic_must_be_overridden]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:178:1
   |
LL | #[rustc_intrinsic]
LL | #[rustc_intrinsic]
   | ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the `#[rustc_intrinsic_must_be_overridden]` attribute is used to declare intrinsics without real bodies
   |
LL | #[rustc_intrinsic_must_be_overridden]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0658`.
------------------------------------------
------------------------------------------


---- [ui] tests/ui/abi/compatibility.rs#m68k stdout ----

error in revision `m68k`: auxiliary build of "/checkout/tests/auxiliary/minicore.rs" failed to compile: 
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/auxiliary/minicore.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--cfg" "m68k" "--check-cfg" "cfg(test,FALSE,host,i686,x86_64,x86_64_win,arm,aarch64,s390x,mips,mips64,sparc,sparc64,powerpc64,riscv,loongarch64,wasip1,bpf,m68k,csky,nvptx64)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/abi/compatibility.m68k/libminicore.rlib" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target" "m68k-unknown-linux-gnu" "-Cpanic=abort" "--crate-type" "rlib" "-Cpanic=abort"
--- stderr -------------------------------
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:171:1
   |
   |
LL | #[rustc_intrinsic]
   | ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the `#[rustc_intrinsic_must_be_overridden]` attribute is used to declare intrinsics without real bodies
   |
LL | #[rustc_intrinsic_must_be_overridden]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:178:1
   |
LL | #[rustc_intrinsic]
LL | #[rustc_intrinsic]
   | ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the `#[rustc_intrinsic_must_be_overridden]` attribute is used to declare intrinsics without real bodies
   |
LL | #[rustc_intrinsic_must_be_overridden]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0658`.
------------------------------------------
------------------------------------------


---- [ui] tests/ui/abi/compatibility.rs#i686 stdout ----

error in revision `i686`: auxiliary build of "/checkout/tests/auxiliary/minicore.rs" failed to compile: 
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/auxiliary/minicore.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--cfg" "i686" "--check-cfg" "cfg(test,FALSE,host,i686,x86_64,x86_64_win,arm,aarch64,s390x,mips,mips64,sparc,sparc64,powerpc64,riscv,loongarch64,wasip1,bpf,m68k,csky,nvptx64)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/abi/compatibility.i686/libminicore.rlib" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target" "i686-unknown-linux-gnu" "-Cpanic=abort" "--crate-type" "rlib" "-Cpanic=abort"
--- stderr -------------------------------
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:171:1
   |
   |
LL | #[rustc_intrinsic]
   | ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the `#[rustc_intrinsic_must_be_overridden]` attribute is used to declare intrinsics without real bodies
   |
LL | #[rustc_intrinsic_must_be_overridden]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:178:1
   |
LL | #[rustc_intrinsic]
LL | #[rustc_intrinsic]
   | ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the `#[rustc_intrinsic_must_be_overridden]` attribute is used to declare intrinsics without real bodies
   |
LL | #[rustc_intrinsic_must_be_overridden]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0658`.
------------------------------------------
------------------------------------------


---- [ui] tests/ui/abi/compatibility.rs#mips stdout ----

error in revision `mips`: auxiliary build of "/checkout/tests/auxiliary/minicore.rs" failed to compile: 
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/auxiliary/minicore.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--cfg" "mips" "--check-cfg" "cfg(test,FALSE,host,i686,x86_64,x86_64_win,arm,aarch64,s390x,mips,mips64,sparc,sparc64,powerpc64,riscv,loongarch64,wasip1,bpf,m68k,csky,nvptx64)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/abi/compatibility.mips/libminicore.rlib" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target" "mips-unknown-linux-gnu" "-Cpanic=abort" "--crate-type" "rlib" "-Cpanic=abort"
--- stderr -------------------------------
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:171:1
   |
   |
LL | #[rustc_intrinsic]
   | ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the `#[rustc_intrinsic_must_be_overridden]` attribute is used to declare intrinsics without real bodies
   |
LL | #[rustc_intrinsic_must_be_overridden]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:178:1
   |
LL | #[rustc_intrinsic]
LL | #[rustc_intrinsic]
   | ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the `#[rustc_intrinsic_must_be_overridden]` attribute is used to declare intrinsics without real bodies
   |
LL | #[rustc_intrinsic_must_be_overridden]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0658`.
------------------------------------------
------------------------------------------


---- [ui] tests/ui/abi/compatibility.rs#mips64 stdout ----

error in revision `mips64`: auxiliary build of "/checkout/tests/auxiliary/minicore.rs" failed to compile: 
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/auxiliary/minicore.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--cfg" "mips64" "--check-cfg" "cfg(test,FALSE,host,i686,x86_64,x86_64_win,arm,aarch64,s390x,mips,mips64,sparc,sparc64,powerpc64,riscv,loongarch64,wasip1,bpf,m68k,csky,nvptx64)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/abi/compatibility.mips64/libminicore.rlib" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target" "mips64-unknown-linux-gnuabi64" "-Cpanic=abort" "--crate-type" "rlib" "-Cpanic=abort"
--- stderr -------------------------------
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:171:1
   |
   |
LL | #[rustc_intrinsic]
   | ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the `#[rustc_intrinsic_must_be_overridden]` attribute is used to declare intrinsics without real bodies
   |
LL | #[rustc_intrinsic_must_be_overridden]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:178:1
   |
LL | #[rustc_intrinsic]
LL | #[rustc_intrinsic]
   | ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the `#[rustc_intrinsic_must_be_overridden]` attribute is used to declare intrinsics without real bodies
   |
LL | #[rustc_intrinsic_must_be_overridden]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0658`.
------------------------------------------
------------------------------------------


---- [ui] tests/ui/abi/compatibility.rs#riscv stdout ----

error in revision `riscv`: auxiliary build of "/checkout/tests/auxiliary/minicore.rs" failed to compile: 
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/auxiliary/minicore.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--cfg" "riscv" "--check-cfg" "cfg(test,FALSE,host,i686,x86_64,x86_64_win,arm,aarch64,s390x,mips,mips64,sparc,sparc64,powerpc64,riscv,loongarch64,wasip1,bpf,m68k,csky,nvptx64)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/abi/compatibility.riscv/libminicore.rlib" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target" "riscv64gc-unknown-linux-gnu" "-Cpanic=abort" "--crate-type" "rlib" "-Cpanic=abort"
--- stderr -------------------------------
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:171:1
   |
   |
LL | #[rustc_intrinsic]
   | ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the `#[rustc_intrinsic_must_be_overridden]` attribute is used to declare intrinsics without real bodies
   |
LL | #[rustc_intrinsic_must_be_overridden]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:178:1
   |
LL | #[rustc_intrinsic]
LL | #[rustc_intrinsic]
   | ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: the `#[rustc_intrinsic_must_be_overridden]` attribute is used to declare intrinsics without real bodies
   |
LL | #[rustc_intrinsic_must_be_overridden]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   |
   = help: add `#![feature(intrinsics)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0658`.
------------------------------------------
------------------------------------------


---- [ui] tests/ui/abi/compatibility.rs#powerpc64 stdout ----

error in revision `powerpc64`: auxiliary build of "/checkout/tests/auxiliary/minicore.rs" failed to compile: 
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/auxiliary/minicore.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--cfg" "powerpc64" "--check-cfg" "cfg(test,FALSE,host,i686,x86_64,x86_64_win,arm,aarch64,s390x,mips,mips64,sparc,sparc64,powerpc64,riscv,loongarch64,wasip1,bpf,m68k,csky,nvptx64)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/abi/compatibility.powerpc64/libminicore.rlib" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target" "powerpc64-unknown-linux-gnu" "-Cpanic=abort" "--crate-type" "rlib" "-Cpanic=abort"
--- stderr -------------------------------
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
##[error]  --> /checkout/tests/auxiliary/minicore.rs:171:1
   |
   |

@tgross35
Copy link
Contributor

@tgross35 I noticed that the most recent mod.rs does not handle different sizes for doubles (ex: avr having a size of 4 bytes for a double leading to a mismatch in sizes). Would it be a good idea to add this to the ffi/mod.rs? Otherwise it just always panics at the misalignment because size_of::<ffi::c_double> is always 8 bytes while in the target avr the size is 4 bytes.

Don't change the definitions in ffi now, just add it as an xfail and, after this merges, we will go through and fix everything relevant. Nice catch though, exactly what this test is supposed to do 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants