about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-09-28 05:42:54 +0000
committerbors <bors@rust-lang.org>2023-09-28 05:42:54 +0000
commit024279a2e931c0bc68b235fd683ebcefc3fc718b (patch)
treea32699a88769d84881ac8a01de578a66f10f52d3 /src
parent1a3dd7ea7d929db798b7095d3c25f50b49a52fb4 (diff)
parentf2623ac49b3dbcee5a0828c035157ca92bd0db2c (diff)
downloadrust-024279a2e931c0bc68b235fd683ebcefc3fc718b.tar.gz
rust-024279a2e931c0bc68b235fd683ebcefc3fc718b.zip
Auto merge of #3089 - rust-lang:rustup-2023-09-28, r=RalfJung
Automatic sync from rustc
Diffstat (limited to 'src')
-rw-r--r--src/doc/style-guide/src/items.md38
-rw-r--r--src/doc/unstable-book/src/language-features/lang-items.md2
-rw-r--r--src/librustdoc/html/markdown.rs2
-rw-r--r--src/librustdoc/html/templates/type_layout.html4
-rw-r--r--src/tools/miri/rust-version2
-rw-r--r--src/tools/miri/tests/pass/function_pointers.rs20
6 files changed, 53 insertions, 15 deletions
diff --git a/src/doc/style-guide/src/items.md b/src/doc/style-guide/src/items.md
index a6d941f6d04..b215de6ad28 100644
--- a/src/doc/style-guide/src/items.md
+++ b/src/doc/style-guide/src/items.md
@@ -367,26 +367,52 @@ where
 ## Type aliases
 
 Keep type aliases on one line when they fit. If necessary to break the line, do
-so after the `=`, and block-indent the right-hand side:
+so before the `=`, and block-indent the right-hand side:
 
 ```rust
 pub type Foo = Bar<T>;
 
 // If multi-line is required
-type VeryLongType<T, U: SomeBound> =
-    AnEvenLongerType<T, U, Foo<T>>;
+type VeryLongType<T, U: SomeBound>
+    = AnEvenLongerType<T, U, Foo<T>>;
 ```
 
-Where possible avoid `where` clauses and keep type constraints inline. Where
-that is not possible split the line before and after the `where` clause (and
-split the `where` clause as normal), e.g.,
+When there is a trailing `where` clause after the type, and no `where` clause
+present before the type, break before the `=` and indent. Then break before the
+`where` keyword and format the clauses normally, e.g.,
 
 ```rust
+// With only a trailing where clause
 type VeryLongType<T, U>
+    = AnEvenLongerType<T, U, Foo<T>>
+where
+    T: U::AnAssociatedType,
+    U: SomeBound;
+```
+
+When there is a `where` clause before the type, format it normally, and break
+after the last clause. Do not indent before the `=` to leave it visually
+distinct from the indented clauses that precede it. If there is additionally a
+`where` clause after the type, break before the `where` keyword and format the
+clauses normally.
+
+```rust
+// With only a preceding where clause.
+type WithPrecedingWC<T, U>
 where
     T: U::AnAssociatedType,
     U: SomeBound,
 = AnEvenLongerType<T, U, Foo<T>>;
+
+// Or with both a preceding and trailing where clause.
+type WithPrecedingWC<T, U>
+where
+    T: U::AnAssociatedType,
+    U: SomeBound,
+= AnEvenLongerType<T, U, Foo<T>>
+where
+    T: U::AnAssociatedType2,
+    U: SomeBound2;
 ```
 
 ## Associated types
diff --git a/src/doc/unstable-book/src/language-features/lang-items.md b/src/doc/unstable-book/src/language-features/lang-items.md
index 9e20662fff3..32b882e763d 100644
--- a/src/doc/unstable-book/src/language-features/lang-items.md
+++ b/src/doc/unstable-book/src/language-features/lang-items.md
@@ -37,7 +37,7 @@ Most lang items are defined by `core`, but if you're trying to build
 an executable without the `std` crate, you might run into the need
 for lang item definitions.
 
-[personality]: https://github.com/rust-lang/rust/blob/master/library/std/src/personality/gcc.rs
+[personality]: https://github.com/rust-lang/rust/blob/master/library/std/src/sys/personality/gcc.rs
 
 ## Example: Implementing a `Box`
 
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index 6dbf2185e3d..d24e6e5faf5 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -1083,7 +1083,7 @@ impl<'a, 'tcx> TagIterator<'a, 'tcx> {
     }
 
     fn parse_in_attribute_block(&mut self) -> Option<LangStringToken<'a>> {
-        while let Some((pos, c)) = self.inner.next() {
+        if let Some((pos, c)) = self.inner.next() {
             if c == '}' {
                 self.is_in_attribute_block = false;
                 return self.next();
diff --git a/src/librustdoc/html/templates/type_layout.html b/src/librustdoc/html/templates/type_layout.html
index 287cbab07d2..b8b7785a2a1 100644
--- a/src/librustdoc/html/templates/type_layout.html
+++ b/src/librustdoc/html/templates/type_layout.html
@@ -9,12 +9,12 @@
             <strong>Note:</strong> Most layout information is <strong>completely {#+ #}
                 unstable</strong> and may even differ between compilations. {#+ #}
             The only exception is types with certain <code>repr(...)</code> {#+ #}
-            attributes. Please see the Rust Reference’s {#+ #}
+            attributes. Please see the Rust Reference's {#+ #}
             <a href="https://doc.rust-lang.org/reference/type-layout.html">“Type Layout”</a> {#+ #}
             chapter for details on type layout guarantees. {# #}
         </p> {# #}
     </div> {# #}
-    <p><strong>Size:</strong> {{ type_layout_size|safe }}</p> {# #}
+    <p><strong>Size:</strong> {{+ type_layout_size|safe }}</p> {# #}
     {% if !variants.is_empty() %}
     <p> {# #}
         <strong>Size for each variant:</strong> {# #}
diff --git a/src/tools/miri/rust-version b/src/tools/miri/rust-version
index 3f1babf5323..07dd52ce941 100644
--- a/src/tools/miri/rust-version
+++ b/src/tools/miri/rust-version
@@ -1 +1 @@
-d206f2c0857eb879877f27508139dd62a40294c3
+2ba4eb2d49e774b5fbc2a06258ac7b0f60b92b7e
diff --git a/src/tools/miri/tests/pass/function_pointers.rs b/src/tools/miri/tests/pass/function_pointers.rs
index b66826e3fcd..1c99a96feda 100644
--- a/src/tools/miri/tests/pass/function_pointers.rs
+++ b/src/tools/miri/tests/pass/function_pointers.rs
@@ -23,6 +23,10 @@ fn h(i: i32, j: i32) -> i32 {
     j * i * 7
 }
 
+fn i() -> i32 {
+    73
+}
+
 fn return_fn_ptr(f: fn() -> i32) -> fn() -> i32 {
     f
 }
@@ -72,10 +76,18 @@ fn main() {
     assert_eq!(indirect3(h), 210);
     assert_eq!(indirect_mut3(h), 210);
     assert_eq!(indirect_once3(h), 210);
-    let g = f as fn() -> i32;
-    assert!(return_fn_ptr(g) == g);
-    assert!(return_fn_ptr(g) as unsafe fn() -> i32 == g as fn() -> i32 as unsafe fn() -> i32);
-    assert!(return_fn_ptr(f) != f);
+    // Check that `i` always has the same address. This is not guaranteed
+    // but Miri currently uses a fixed address for monomorphic functions.
+    assert!(return_fn_ptr(i) == i);
+    assert!(return_fn_ptr(i) as unsafe fn() -> i32 == i as fn() -> i32 as unsafe fn() -> i32);
+    // We don't check anything for `f`. Miri gives it many different addresses
+    // but mir-opts can turn them into the same address.
+    let _val = return_fn_ptr(f) != f;
+    // However, if we only turn `f` into a function pointer and use that pointer,
+    // it is equal to itself.
+    let f2 = f as fn() -> i32;
+    assert!(return_fn_ptr(f2) == f2);
+    assert!(return_fn_ptr(f2) as unsafe fn() -> i32 == f2 as fn() -> i32 as unsafe fn() -> i32);
 
     // Any non-null value is okay for function pointers.
     unsafe {