Skip to content

Commit 04817ff

Browse files
committed
Auto merge of rust-lang#117608 - matthiaskrgr:rollup-g9fagmv, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - rust-lang#116017 (Don't pass `-stdlib=libc++` when building C files on macOS) - rust-lang#117524 (bootstrap/setup: create hooks directory if non-existing) - rust-lang#117588 (Remove unused LoadResult::DecodeIncrCache variant) - rust-lang#117596 (Add diagnostic items for a few of core's builtin macros) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 513a485 + a660516 commit 04817ff

File tree

6 files changed

+13
-23
lines changed

6 files changed

+13
-23
lines changed

compiler/rustc_incremental/messages.ftl

-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ incremental_create_lock =
3030
incremental compilation: could not create session directory lock file: {$lock_err}
3131
incremental_create_new = failed to create {$name} at `{$path}`: {$err}
3232
33-
incremental_decode_incr_cache = could not decode incremental cache: {$err}
34-
3533
incremental_delete_full = error deleting incremental compilation session directory `{$path}`: {$err}
3634
3735
incremental_delete_incompatible =

compiler/rustc_incremental/src/errors.rs

-6
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,6 @@ pub struct LoadDepGraph {
270270
pub err: std::io::Error,
271271
}
272272

273-
#[derive(Diagnostic)]
274-
#[diag(incremental_decode_incr_cache)]
275-
pub struct DecodeIncrCache {
276-
pub err: String,
277-
}
278-
279273
#[derive(Diagnostic)]
280274
#[diag(incremental_write_dep_graph)]
281275
pub struct WriteDepGraph<'a> {

compiler/rustc_incremental/src/persist/load.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ pub enum LoadResult<T> {
3030
DataOutOfDate,
3131
/// Loading the dep graph failed.
3232
LoadDepGraph(PathBuf, std::io::Error),
33-
/// Decoding loaded incremental cache failed.
34-
DecodeIncrCache(Box<dyn std::any::Any + Send>),
3533
}
3634

3735
impl<T: Default> LoadResult<T> {
@@ -44,9 +42,7 @@ impl<T: Default> LoadResult<T> {
4442
}
4543
(
4644
Some(IncrementalStateAssertion::Loaded),
47-
LoadResult::LoadDepGraph(..)
48-
| LoadResult::DecodeIncrCache(..)
49-
| LoadResult::DataOutOfDate,
45+
LoadResult::LoadDepGraph(..) | LoadResult::DataOutOfDate,
5046
) => {
5147
sess.emit_fatal(errors::AssertLoaded);
5248
}
@@ -58,10 +54,6 @@ impl<T: Default> LoadResult<T> {
5854
sess.emit_warning(errors::LoadDepGraph { path, err });
5955
Default::default()
6056
}
61-
LoadResult::DecodeIncrCache(err) => {
62-
sess.emit_warning(errors::DecodeIncrCache { err: format!("{err:?}") });
63-
Default::default()
64-
}
6557
LoadResult::DataOutOfDate => {
6658
if let Err(err) = delete_all_session_dir_contents(sess) {
6759
sess.emit_err(errors::DeleteIncompatible { path: dep_graph_path(sess), err });
@@ -150,7 +142,6 @@ fn load_dep_graph(sess: &Session) -> LoadResult<(SerializedDepGraph, WorkProduct
150142
match load_data(&path, sess) {
151143
LoadResult::DataOutOfDate => LoadResult::DataOutOfDate,
152144
LoadResult::LoadDepGraph(path, err) => LoadResult::LoadDepGraph(path, err),
153-
LoadResult::DecodeIncrCache(err) => LoadResult::DecodeIncrCache(err),
154145
LoadResult::Ok { data: (bytes, start_pos) } => {
155146
let mut decoder = MemDecoder::new(&bytes, start_pos);
156147
let prev_commandline_args_hash = u64::decode(&mut decoder);

library/core/src/macros/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,7 @@ pub(crate) mod builtin {
10441044
#[stable(feature = "rust1", since = "1.0.0")]
10451045
#[rustc_builtin_macro]
10461046
#[macro_export]
1047+
#[rustc_diagnostic_item = "env_macro"] // useful for external lints
10471048
macro_rules! env {
10481049
($name:expr $(,)?) => {{ /* compiler built-in */ }};
10491050
($name:expr, $error_msg:expr $(,)?) => {{ /* compiler built-in */ }};
@@ -1074,6 +1075,7 @@ pub(crate) mod builtin {
10741075
#[stable(feature = "rust1", since = "1.0.0")]
10751076
#[rustc_builtin_macro]
10761077
#[macro_export]
1078+
#[rustc_diagnostic_item = "option_env_macro"] // useful for external lints
10771079
macro_rules! option_env {
10781080
($name:expr $(,)?) => {{ /* compiler built-in */ }};
10791081
}
@@ -1479,6 +1481,7 @@ pub(crate) mod builtin {
14791481
#[stable(feature = "rust1", since = "1.0.0")]
14801482
#[rustc_builtin_macro]
14811483
#[macro_export]
1484+
#[rustc_diagnostic_item = "include_macro"] // useful for external lints
14821485
macro_rules! include {
14831486
($file:expr $(,)?) => {{ /* compiler built-in */ }};
14841487
}

src/bootstrap/src/core/build_steps/setup.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,8 @@ fn install_git_hook_maybe(config: &Config) -> io::Result<()> {
469469
assert!(output.status.success(), "failed to run `git`");
470470
PathBuf::from(t!(String::from_utf8(output.stdout)).trim())
471471
}));
472-
let dst = git.join("hooks").join("pre-push");
472+
let hooks_dir = git.join("hooks");
473+
let dst = hooks_dir.join("pre-push");
473474
if dst.exists() {
474475
// The git hook has already been set up, or the user already has a custom hook.
475476
return Ok(());
@@ -486,6 +487,10 @@ undesirable, simply delete the `pre-push` file from .git/hooks."
486487
println!("Ok, skipping installation!");
487488
return Ok(());
488489
}
490+
if !hooks_dir.exists() {
491+
// We need to (try to) create the hooks directory first.
492+
let _ = fs::create_dir(hooks_dir);
493+
}
489494
let src = config.src.join("src").join("etc").join("pre-push.sh");
490495
match fs::hard_link(src, &dst) {
491496
Err(e) => {

src/bootstrap/src/lib.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1197,11 +1197,10 @@ impl Build {
11971197
.filter(|s| !s.starts_with("-O") && !s.starts_with("/O"))
11981198
.collect::<Vec<String>>();
11991199

1200-
// If we're compiling on macOS then we add a few unconditional flags
1201-
// indicating that we want libc++ (more filled out than libstdc++) and
1202-
// we want to compile for 10.7. This way we can ensure that
1200+
// If we're compiling C++ on macOS then we add a flag indicating that
1201+
// we want libc++ (more filled out than libstdc++), ensuring that
12031202
// LLVM/etc are all properly compiled.
1204-
if target.contains("apple-darwin") {
1203+
if matches!(c, CLang::Cxx) && target.contains("apple-darwin") {
12051204
base.push("-stdlib=libc++".into());
12061205
}
12071206

0 commit comments

Comments
 (0)