Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion compiler/rustc_const_eval/src/interpret/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,6 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
// Unlike all the other GC helpers where we check if an `AllocId` is found in the interpreter or
// is live, here all the IDs in the map are for dead allocations so we don't
// need to check for liveness.
#[allow(rustc::potential_query_instability)] // Only used from Miri, not queries.
self.memory.dead_alloc_map.retain(|id, _| reachable_allocs.contains(id));
}
}
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_macros/src/diagnostics/subdiagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ impl SubdiagnosticDerive {

let diag = &self.diag;

// FIXME(edition_2024): Fix the `keyword_idents_2024` lint to not trigger here?
#[allow(keyword_idents_2024)]
let ret = structure.gen_impl(quote! {
gen impl rustc_errors::Subdiagnostic for @Self {
fn add_to_diag<__G>(
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_macros/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// tidy-alphabetical-start
#![allow(rustc::default_hash_types)]
#![feature(never_type)]
#![feature(proc_macro_diagnostic)]
#![feature(proc_macro_tracked_env)]
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_macros/src/print_attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ pub(crate) fn print_attribute(input: Structure<'_>) -> TokenStream {
}
};

#[allow(keyword_idents_2024)]
input.gen_impl(quote! {
#[allow(unused)]
gen impl PrintAttribute for @Self {
Expand Down
19 changes: 9 additions & 10 deletions compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1526,19 +1526,16 @@ where
) -> QueryResultOrRerunNonErased<I> {
self.inspect.make_canonical_response(shallow_certainty);

let goals_certainty = self.try_evaluate_added_goals()?;
let added_goals_certainty = self.try_evaluate_added_goals()?;
assert_eq!(
self.tainted,
Ok(()),
"EvalCtxt is tainted -- nested goals may have been dropped in a \
previous call to `try_evaluate_added_goals!`"
);

let goals_certainty = match self.delegate.cx().assumptions_on_binders() {
true => {
let certainty = self.eagerly_handle_placeholders()?;
certainty.and(goals_certainty)
}
let placeholder_certainty = match self.delegate.cx().assumptions_on_binders() {
true => self.eagerly_handle_placeholders()?,
false => {
// We only check for leaks from universes which were entered inside
// of the query.
Expand All @@ -1547,9 +1544,10 @@ where
NoSolution
})?;

goals_certainty
Certainty::Yes
}
};
let goals_certainty = placeholder_certainty.and(added_goals_certainty);

let (certainty, normalization_nested_goals) =
match (self.current_goal_kind, shallow_certainty) {
Expand All @@ -1563,12 +1561,13 @@ where
(CurrentGoalKind::ProjectionComputeAssocTermCandidate, Certainty::Yes) => {
let goals = std::mem::take(&mut self.nested_goals);
// As we return all ambiguous nested goals, we can ignore the certainty
// returned by `self.try_evaluate_added_goals()`.
// returned by `self.try_evaluate_added_goals()`. However, placeholder
// handling may independently be ambiguous, so preserve its certainty.
if goals.is_empty() {
assert!(matches!(goals_certainty, Certainty::Yes));
assert!(matches!(added_goals_certainty, Certainty::Yes));
}
(
Certainty::Yes,
placeholder_certainty,
NestedNormalizationGoals(
goals.into_iter().map(|(s, g, _)| (s, g)).collect(),
),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_pattern_analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! [`rustc`] module.

// tidy-alphabetical-start
#![allow(unused_crate_dependencies)]
#![cfg_attr(test, allow(unused_crate_dependencies))] // Used for integration tests, not unit tests
// tidy-alphabetical-end

pub(crate) mod checks;
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_session/src/config/sigpipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,17 @@
///
/// Note that `SIG_IGN` has been the Rust default since 2014. See
/// <https://github.com/rust-lang/rust/issues/62569>.
#[allow(dead_code)]
pub const DEFAULT: u8 = 0;

/// Do not touch `SIGPIPE`. Use whatever the parent process uses.
#[allow(dead_code)]
pub const INHERIT: u8 = 1;

/// Change `SIGPIPE` to `SIG_IGN` so that failed writes results in `EPIPE`
/// that are eventually converted to `ErrorKind::BrokenPipe`.
#[allow(dead_code)]
pub const SIG_IGN: u8 = 2;

/// Change `SIGPIPE` to `SIG_DFL` so that the process is killed when trying
/// to write to a closed pipe. This is usually the desired behavior for CLI
/// apps that produce textual output that you want to pipe to other programs
/// such as `head -n 1`.
#[allow(dead_code)]
pub const SIG_DFL: u8 = 3;
89 changes: 89 additions & 0 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ use std::path::{Path, PathBuf};
use std::process::Command;
use std::{env, fs, iter};

use build_helper::git::get_closest_upstream_commit;

use crate::core::build_steps::compile::{ArtifactKeepMode, Std, run_cargo};
use crate::core::build_steps::doc::{DocumentationFormat, prepare_doc_compiler};
use crate::core::build_steps::gcc::{Gcc, GccTargetPair, add_cg_gcc_cargo_flags};
Expand Down Expand Up @@ -4613,3 +4615,90 @@ impl CommandLineStep for RemoteTestClientTests {
);
}
}

fn check_if_cargo_semver_checks_is_installed(builder: &Builder<'_>) -> bool {
command("cargo")
.allow_failure()
.arg("semver-checks")
.arg("--version")
// Cache the output to avoid running this command more than once (per builder).
.cached()
.run_capture_stdout(builder)
.is_success()
}

/// Run cargo-semver-checks on the standard library and compare its API
/// versus a previous baseline, using rustdoc JSON data.
///
/// Fails if a semver-breaking change is detected.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct StdSemverCheck {
build_compiler: Compiler,
target: TargetSelection,
/// The baseline commit that we are comparing the local stdlib API against.
commit: String,
}

impl CommandLineStep for StdSemverCheck {
type Output = ();

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.alias("std-semver-check")
}

fn make_run(run: RunConfig<'_>) {
if !check_if_cargo_semver_checks_is_installed(run.builder) {
panic!("cargo-semver-checks was not found, please install it");
}

let baseline_commit = match get_closest_upstream_commit(
Some(&run.builder.config.src),
&run.builder.config.git_config(),
run.builder.config.ci_env,
) {
Ok(Some(commit)) => commit,
Ok(None) => {
panic!("No baseline parent commit found for std-semver-check");
}
Err(error) => {
panic!("Cannot get baseline parent commit for std-semver-check: {error:?}");
}
};

run.builder.ensure(Self {
build_compiler: run.builder.compiler_for_std(run.builder.top_stage),
target: run.target,
commit: baseline_commit,
});
}

fn run(self, builder: &Builder<'_>) {
let Some(docs_dir) = builder.config.download_std_json_docs(self.target, &self.commit)
else {
return;
};

let directory = builder.ensure(crate::core::build_steps::doc::Std::from_build_compiler(
self.build_compiler,
self.target,
DocumentationFormat::Json,
));
let baseline_dir = docs_dir.join("share").join("doc").join("rust").join("json");

for library in ["core", "alloc", "std"] {
println!("Checking semver compatibility of {library}");
let mut cmd = command("cargo");
cmd.arg("semver-checks")
.arg("-Z")
.arg("unstable-options")
.arg("--stability-aware")
.arg("--release-type")
.arg("minor")
.arg("--current-rustdoc")
.arg(directory.join(format!("{library}.json")))
.arg("--baseline-rustdoc")
.arg(baseline_dir.join(format!("{library}.json")));
cmd.run(builder);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test std-semver-check
---
[Test] test::StdSemverCheck
targets: [aarch64-unknown-linux-gnu]
- Set({test::std-semver-check})
1 change: 1 addition & 0 deletions src/bootstrap/src/core/builder/cli_paths/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ declare_tests!(
(x_test_librustdoc_rustdoc_html, "test librustdoc rustdoc-html"),
(x_test_rustdoc, "test rustdoc"),
(x_test_rustdoc_html, "test rustdoc-html"),
(x_test_semver_check, "test std-semver-check"),
(x_test_skip_coverage, "test --skip=coverage"),
(x_test_skip_coverage_map, "test --skip=coverage-map"),
(x_test_skip_coverage_run, "test --skip=coverage-run"),
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/src/core/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,7 @@ impl<'a> Builder<'a> {
test::RunMake,
test::RunMakeCargo,
test::BuildStd,
test::StdSemverCheck,
test::IntrinsicTest,
),
Kind::Miri => describe!(test::Crate),
Expand Down
39 changes: 31 additions & 8 deletions src/bootstrap/src/core/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,30 @@ impl Config {
);
}

pub(crate) fn download_std_json_docs(
&self,
target: TargetSelection,
commit: &str,
) -> Option<PathBuf> {
if self.dry_run() {
return None;
}

self.do_if_verbose(|| println!("using downloaded std json docs from CI (commit {commit})"));

let version = self.artifact_version_part(commit);
download_component(
DownloadContext::from(self),
&self.out,
DownloadSource::CI,
format!("rust-docs-json-{version}-{target}.tar.xz"),
"rust-docs-json-preview",
// When using DownloadSource::CI, the key is assumed to end with -llvm-assertions
&format!("{commit}-{}", self.llvm_assertions),
"ci-docs-json",
)
}

fn download_toolchain(
&self,
version: &str,
Expand Down Expand Up @@ -785,11 +809,11 @@ fn download_component<'a>(
prefix: &str,
key: &str,
destination: &str,
) {
) -> Option<PathBuf> {
let dwn_ctx = dwn_ctx.as_ref();

if dwn_ctx.exec_ctx.dry_run() {
return;
return None;
}

let cache_dst =
Expand Down Expand Up @@ -834,8 +858,7 @@ fn download_component<'a>(
let sha256 = dwn_ctx.stage0_metadata.checksums_sha256.get(&url).expect(&error);
if tarball.exists() {
if verify(dwn_ctx.exec_ctx, &tarball, sha256) {
unpack(dwn_ctx.exec_ctx, &tarball, &bin_root, prefix);
return;
return Some(unpack(dwn_ctx.exec_ctx, &tarball, &bin_root, prefix));
} else {
dwn_ctx.exec_ctx.do_if_verbose(|| {
println!(
Expand All @@ -848,8 +871,7 @@ fn download_component<'a>(
}
Some(sha256)
} else if tarball.exists() {
unpack(dwn_ctx.exec_ctx, &tarball, &bin_root, prefix);
return;
return Some(unpack(dwn_ctx.exec_ctx, &tarball, &bin_root, prefix));
} else {
None
};
Expand All @@ -872,7 +894,7 @@ download-rustc = false
panic!("failed to verify {}", tarball.display());
}

unpack(dwn_ctx.exec_ctx, &tarball, &bin_root, prefix);
Some(unpack(dwn_ctx.exec_ctx, &tarball, &bin_root, prefix))
}

pub(crate) fn verify(exec_ctx: &ExecutionContext, path: &Path, expected: &str) -> bool {
Expand Down Expand Up @@ -916,7 +938,7 @@ pub(crate) fn verify(exec_ctx: &ExecutionContext, path: &Path, expected: &str) -
verified
}

fn unpack(exec_ctx: &ExecutionContext, tarball: &Path, dst: &Path, pattern: &str) {
fn unpack(exec_ctx: &ExecutionContext, tarball: &Path, dst: &Path, pattern: &str) -> PathBuf {
eprintln!("extracting {} to {}", tarball.display(), dst.display());
if !dst.exists() {
t!(fs::create_dir_all(dst));
Expand Down Expand Up @@ -979,6 +1001,7 @@ fn unpack(exec_ctx: &ExecutionContext, tarball: &Path, dst: &Path, pattern: &str
if dst_dir.exists() {
t!(fs::remove_dir_all(&dst_dir), format!("failed to remove {}", dst_dir.display()));
}
dst.to_path_buf()
}

fn download_file<'a>(
Expand Down
Loading
Loading