Skip to content

Conversation

weihanglo
Copy link
Member

What does this PR try to resolve?

test_std_on_unsupported_target never really succeed to build those targets, due to

  • local rustup may not have {aarch64,x86_64}-unknown-none installed.
  • core and compiler-builtins mock crate are not no_std nor no_core
  • the dummy main.rs uses println! and is not no_std.

This commit make it compile, if you have those targets installed.

How should we test and review this PR?

Change this line to .build_std_arg(&setup, "core").

.build_std(&setup)

And delete these liens:

// check that targets support building std
if crates.contains(&"std".to_string()) {
let unsupported_targets = target_data.get_unsupported_std_targets();
if !unsupported_targets.is_empty() {
anyhow::bail!(
"building std is not supported on the following targets: {}",
unsupported_targets.join(", ")
)
}
}

Then the test project should compile.

`test_std_on_unsupported_target` never really succeed to build those targets, due to

* local rustup may not have `{aarch64,x86_64}-unknown-none` installed.
* `core` and `compiler-builtins` mock crate are not `no_std` nor `no_core`
* the dummy `main.rs` uses `println!` and is not `no_std`.

This commit make it compile, if you have those targets installed.
@weihanglo weihanglo added the Z-build-std Nightly: build-std label Dec 5, 2024
@rustbot
Copy link
Collaborator

rustbot commented Dec 5, 2024

r? @epage

rustbot has assigned @epage.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 5, 2024
Copy link
Member Author

Choose a reason for hiding this comment

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

We still need {aarch64,x86_64}-unknown-none targets installed to make test_std_on_unsupported_target compile. We need to tweak cargo CI and cargo-test-macro to support this use case. That is out of scope of this PR.

@epage epage enabled auto-merge December 5, 2024 16:27
@epage epage added this pull request to the merge queue Dec 5, 2024
Merged via the queue into rust-lang:master with commit 519f069 Dec 5, 2024
20 checks passed
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 7, 2024
Update cargo

6 commits in 05f54fdc34310f458033af8a63ce1d699fae8bf6..20a443231846b81c7b909691ec3f15eb173f2b18
2024-12-03 03:14:12 +0000 to 2024-12-06 21:56:56 +0000
- fix(fingerprint): Don't throwaway the cache on RUSTFLAGS changes  (rust-lang/cargo#14830)
- fix(build-rs)!: Remove meaningless 'cargo_cfg_debug_assertions' (rust-lang/cargo#14901)
- docs(fingerprint): cargo-rustc extra flags do not affect the metadata  (rust-lang/cargo#14898)
- fix(add): Don't select yanked versions when normalizing names (rust-lang/cargo#14895)
- fix(fix): Migrate workspace dependencies (rust-lang/cargo#14890)
- test(build-std): make mock-std closer to real world (rust-lang/cargo#14896)
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 8, 2024
Update cargo

6 commits in 05f54fdc34310f458033af8a63ce1d699fae8bf6..20a443231846b81c7b909691ec3f15eb173f2b18
2024-12-03 03:14:12 +0000 to 2024-12-06 21:56:56 +0000
- fix(fingerprint): Don't throwaway the cache on RUSTFLAGS changes  (rust-lang/cargo#14830)
- fix(build-rs)!: Remove meaningless 'cargo_cfg_debug_assertions' (rust-lang/cargo#14901)
- docs(fingerprint): cargo-rustc extra flags do not affect the metadata  (rust-lang/cargo#14898)
- fix(add): Don't select yanked versions when normalizing names (rust-lang/cargo#14895)
- fix(fix): Migrate workspace dependencies (rust-lang/cargo#14890)
- test(build-std): make mock-std closer to real world (rust-lang/cargo#14896)
@rustbot rustbot added this to the 1.85.0 milestone Dec 8, 2024
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Dec 8, 2024
Update cargo

6 commits in 05f54fdc34310f458033af8a63ce1d699fae8bf6..20a443231846b81c7b909691ec3f15eb173f2b18
2024-12-03 03:14:12 +0000 to 2024-12-06 21:56:56 +0000
- fix(fingerprint): Don't throwaway the cache on RUSTFLAGS changes  (rust-lang/cargo#14830)
- fix(build-rs)!: Remove meaningless 'cargo_cfg_debug_assertions' (rust-lang/cargo#14901)
- docs(fingerprint): cargo-rustc extra flags do not affect the metadata  (rust-lang/cargo#14898)
- fix(add): Don't select yanked versions when normalizing names (rust-lang/cargo#14895)
- fix(fix): Migrate workspace dependencies (rust-lang/cargo#14890)
- test(build-std): make mock-std closer to real world (rust-lang/cargo#14896)
@weihanglo weihanglo deleted the no_std branch December 10, 2024 16:27
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Dec 11, 2024
Update cargo

6 commits in 05f54fdc34310f458033af8a63ce1d699fae8bf6..20a443231846b81c7b909691ec3f15eb173f2b18
2024-12-03 03:14:12 +0000 to 2024-12-06 21:56:56 +0000
- fix(fingerprint): Don't throwaway the cache on RUSTFLAGS changes  (rust-lang/cargo#14830)
- fix(build-rs)!: Remove meaningless 'cargo_cfg_debug_assertions' (rust-lang/cargo#14901)
- docs(fingerprint): cargo-rustc extra flags do not affect the metadata  (rust-lang/cargo#14898)
- fix(add): Don't select yanked versions when normalizing names (rust-lang/cargo#14895)
- fix(fix): Migrate workspace dependencies (rust-lang/cargo#14890)
- test(build-std): make mock-std closer to real world (rust-lang/cargo#14896)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. Z-build-std Nightly: build-std
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants