Skip to content

Commit

Permalink
Auto merge of #117608 - matthiaskrgr:rollup-g9fagmv, r=matthiaskrgr
Browse files Browse the repository at this point in the history
Rollup of 4 pull requests

Successful merges:

 - #116017 (Don't pass `-stdlib=libc++` when building C files on macOS)
 - #117524 (bootstrap/setup: create hooks directory if non-existing)
 - #117588 (Remove unused LoadResult::DecodeIncrCache variant)
 - #117596 (Add diagnostic items for a few of core's builtin macros)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Nov 5, 2023
2 parents 513a485 + a660516 commit 04817ff
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 23 deletions.
2 changes: 0 additions & 2 deletions compiler/rustc_incremental/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ incremental_create_lock =
incremental compilation: could not create session directory lock file: {$lock_err}
incremental_create_new = failed to create {$name} at `{$path}`: {$err}
incremental_decode_incr_cache = could not decode incremental cache: {$err}
incremental_delete_full = error deleting incremental compilation session directory `{$path}`: {$err}
incremental_delete_incompatible =
Expand Down
6 changes: 0 additions & 6 deletions compiler/rustc_incremental/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,6 @@ pub struct LoadDepGraph {
pub err: std::io::Error,
}

#[derive(Diagnostic)]
#[diag(incremental_decode_incr_cache)]
pub struct DecodeIncrCache {
pub err: String,
}

#[derive(Diagnostic)]
#[diag(incremental_write_dep_graph)]
pub struct WriteDepGraph<'a> {
Expand Down
11 changes: 1 addition & 10 deletions compiler/rustc_incremental/src/persist/load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ pub enum LoadResult<T> {
DataOutOfDate,
/// Loading the dep graph failed.
LoadDepGraph(PathBuf, std::io::Error),
/// Decoding loaded incremental cache failed.
DecodeIncrCache(Box<dyn std::any::Any + Send>),
}

impl<T: Default> LoadResult<T> {
Expand All @@ -44,9 +42,7 @@ impl<T: Default> LoadResult<T> {
}
(
Some(IncrementalStateAssertion::Loaded),
LoadResult::LoadDepGraph(..)
| LoadResult::DecodeIncrCache(..)
| LoadResult::DataOutOfDate,
LoadResult::LoadDepGraph(..) | LoadResult::DataOutOfDate,
) => {
sess.emit_fatal(errors::AssertLoaded);
}
Expand All @@ -58,10 +54,6 @@ impl<T: Default> LoadResult<T> {
sess.emit_warning(errors::LoadDepGraph { path, err });
Default::default()
}
LoadResult::DecodeIncrCache(err) => {
sess.emit_warning(errors::DecodeIncrCache { err: format!("{err:?}") });
Default::default()
}
LoadResult::DataOutOfDate => {
if let Err(err) = delete_all_session_dir_contents(sess) {
sess.emit_err(errors::DeleteIncompatible { path: dep_graph_path(sess), err });
Expand Down Expand Up @@ -150,7 +142,6 @@ fn load_dep_graph(sess: &Session) -> LoadResult<(SerializedDepGraph, WorkProduct
match load_data(&path, sess) {
LoadResult::DataOutOfDate => LoadResult::DataOutOfDate,
LoadResult::LoadDepGraph(path, err) => LoadResult::LoadDepGraph(path, err),
LoadResult::DecodeIncrCache(err) => LoadResult::DecodeIncrCache(err),
LoadResult::Ok { data: (bytes, start_pos) } => {
let mut decoder = MemDecoder::new(&bytes, start_pos);
let prev_commandline_args_hash = u64::decode(&mut decoder);
Expand Down
3 changes: 3 additions & 0 deletions library/core/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,7 @@ pub(crate) mod builtin {
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_builtin_macro]
#[macro_export]
#[rustc_diagnostic_item = "env_macro"] // useful for external lints
macro_rules! env {
($name:expr $(,)?) => {{ /* compiler built-in */ }};
($name:expr, $error_msg:expr $(,)?) => {{ /* compiler built-in */ }};
Expand Down Expand Up @@ -1074,6 +1075,7 @@ pub(crate) mod builtin {
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_builtin_macro]
#[macro_export]
#[rustc_diagnostic_item = "option_env_macro"] // useful for external lints
macro_rules! option_env {
($name:expr $(,)?) => {{ /* compiler built-in */ }};
}
Expand Down Expand Up @@ -1479,6 +1481,7 @@ pub(crate) mod builtin {
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_builtin_macro]
#[macro_export]
#[rustc_diagnostic_item = "include_macro"] // useful for external lints
macro_rules! include {
($file:expr $(,)?) => {{ /* compiler built-in */ }};
}
Expand Down
7 changes: 6 additions & 1 deletion src/bootstrap/src/core/build_steps/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,8 @@ fn install_git_hook_maybe(config: &Config) -> io::Result<()> {
assert!(output.status.success(), "failed to run `git`");
PathBuf::from(t!(String::from_utf8(output.stdout)).trim())
}));
let dst = git.join("hooks").join("pre-push");
let hooks_dir = git.join("hooks");
let dst = hooks_dir.join("pre-push");
if dst.exists() {
// The git hook has already been set up, or the user already has a custom hook.
return Ok(());
Expand All @@ -486,6 +487,10 @@ undesirable, simply delete the `pre-push` file from .git/hooks."
println!("Ok, skipping installation!");
return Ok(());
}
if !hooks_dir.exists() {
// We need to (try to) create the hooks directory first.
let _ = fs::create_dir(hooks_dir);
}
let src = config.src.join("src").join("etc").join("pre-push.sh");
match fs::hard_link(src, &dst) {
Err(e) => {
Expand Down
7 changes: 3 additions & 4 deletions src/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1197,11 +1197,10 @@ impl Build {
.filter(|s| !s.starts_with("-O") && !s.starts_with("/O"))
.collect::<Vec<String>>();

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

Expand Down

0 comments on commit 04817ff

Please sign in to comment.