about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-07-06 02:34:11 +0000
committerbors <bors@rust-lang.org>2023-07-06 02:34:11 +0000
commit0d50ab77397d7278500abd22d34de0e10940b2ee (patch)
tree02a35487baaef052fd3f02c7b935276f4df24468 /src
parentbd8aabef316bf8779193798eaf35b8749221a9b4 (diff)
parentc668eb086e27985043b060b82d913520fd24612b (diff)
downloadrust-0d50ab77397d7278500abd22d34de0e10940b2ee.tar.gz
rust-0d50ab77397d7278500abd22d34de0e10940b2ee.zip
Auto merge of #113391 - fee1-dead-contrib:rollup-9bqlw9z, r=fee1-dead
Rollup of 9 pull requests

Successful merges:

 - #111119 (style-guide: Add chapter about formatting for nightly-only syntax)
 - #112791 (llvm ffi: Expose `CallInst->setTailCallKind`)
 - #113145 (style-guide: Document newline rules for assignment operators)
 - #113163 (Add a regression test for #112895)
 - #113332 (resolve: Use `Interned` for some interned structures)
 - #113334 (Revert the lexing of `c"…"` string literals)
 - #113350 (Fix the issue of wrong diagnosis for extern pub fn)
 - #113371 (Fix submodule handling when the current branch is named after a tag)
 - #113384 (style-guide: Clarify grammar for small patterns (not a semantic change))

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/lib.rs3
-rw-r--r--src/doc/style-guide/src/SUMMARY.md1
-rw-r--r--src/doc/style-guide/src/expressions.md28
-rw-r--r--src/doc/style-guide/src/nightly.md5
-rw-r--r--src/tools/tidy/src/deps.rs1
5 files changed, 25 insertions, 13 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 6a51450a777..0a7aff62257 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -599,6 +599,9 @@ impl Build {
 
             let mut git = self.config.git();
             if let Some(branch) = current_branch {
+                // If there is a tag named after the current branch, git will try to disambiguate by prepending `heads/` to the branch name.
+                // This syntax isn't accepted by `branch.{branch}`. Strip it.
+                let branch = branch.strip_prefix("heads/").unwrap_or(&branch);
                 git.arg("-c").arg(format!("branch.{branch}.remote=origin"));
             }
             git.args(&["submodule", "update", "--init", "--recursive", "--depth=1"]);
diff --git a/src/doc/style-guide/src/SUMMARY.md b/src/doc/style-guide/src/SUMMARY.md
index 59fe9fdc669..606485bfb6c 100644
--- a/src/doc/style-guide/src/SUMMARY.md
+++ b/src/doc/style-guide/src/SUMMARY.md
@@ -9,3 +9,4 @@
 - [Other style advice](advice.md)
 - [`Cargo.toml` conventions](cargo.md)
 - [Guiding principles and rationale](principles.md)
+- [Nightly-only syntax](nightly.md)
diff --git a/src/doc/style-guide/src/expressions.md b/src/doc/style-guide/src/expressions.md
index f5e37b6c46f..143161da6cf 100644
--- a/src/doc/style-guide/src/expressions.md
+++ b/src/doc/style-guide/src/expressions.md
@@ -295,8 +295,9 @@ Use parentheses liberally, do not necessarily elide them due to precedence.
 Tools should not automatically insert or remove parentheses. Do not use spaces
 to indicate precedence.
 
-If line-breaking, put the operator on a new line and block indent. Put each
-sub-expression on its own line. E.g.,
+If line-breaking, block-indent each subsequent line. For assignment operators,
+break after the operator; for all other operators, put the operator on the
+subsequent line. Put each sub-expression on its own line:
 
 ```rust
 foo_bar
@@ -752,9 +753,9 @@ not put the `if` clause on a newline. E.g.,
     }
 ```
 
-If every clause in a pattern is *small*, but does not fit on one line, then the
-pattern may be formatted across multiple lines with as many clauses per line as
-possible. Again break before a `|`:
+If every clause in a pattern is *small*, but the whole pattern does not fit on
+one line, then the pattern may be formatted across multiple lines with as many
+clauses per line as possible. Again break before a `|`:
 
 ```rust
     foo | bar | baz
@@ -763,17 +764,18 @@ possible. Again break before a `|`:
     }
 ```
 
-We define a pattern clause to be *small* if it matches the following grammar:
+We define a pattern clause to be *small* if it fits on a single line and
+matches "small" in the following grammar:
 
 ```
-[small, ntp]:
-    - single token
-    - `&[single-line, ntp]`
+small:
+    - small_no_tuple
+    - unary tuple constructor: `(` small_no_tuple `,` `)`
+    - `&` small
 
-[small]:
-    - `[small, ntp]`
-    - unary tuple constructor `([small, ntp])`
-    - `&[small]`
+small_no_tuple:
+    - single token
+    - `&` small_no_tuple
 ```
 
 E.g., `&&Some(foo)` matches, `Foo(4, Bar)` does not.
diff --git a/src/doc/style-guide/src/nightly.md b/src/doc/style-guide/src/nightly.md
new file mode 100644
index 00000000000..031811b0e6f
--- /dev/null
+++ b/src/doc/style-guide/src/nightly.md
@@ -0,0 +1,5 @@
+This chapter documents style and formatting for nightly-only syntax. The rest of the style guide documents style for stable Rust syntax; nightly syntax only appears in this chapter. Each section here includes the name of the feature gate, so that searches (e.g. `git grep`) for a nightly feature in the Rust repository also turn up the style guide section.
+
+Style and formatting for nightly-only syntax should be removed from this chapter and integrated into the appropriate sections of the style guide at the time of stabilization.
+
+There is no guarantee of the stability of this chapter in contrast to the rest of the style guide. Refer to the style team policy for nightly formatting procedure regarding breaking changes to this chapter.
diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs
index 1f6c0b75a09..ecc84c1618c 100644
--- a/src/tools/tidy/src/deps.rs
+++ b/src/tools/tidy/src/deps.rs
@@ -131,6 +131,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
     "crossbeam-epoch",
     "crossbeam-utils",
     "crypto-common",
+    "cstr",
     "datafrog",
     "derive_more",
     "digest",