From 85254c9dd8266f24658071b773fbc3ba2da7b35c Mon Sep 17 00:00:00 2001
From: Michael Goulet
Date: Wed, 16 Aug 2023 16:40:12 +0000
Subject: bugfix: reflect how rustfmt formats type aliases
---
src/doc/style-guide/src/items.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'src')
diff --git a/src/doc/style-guide/src/items.md b/src/doc/style-guide/src/items.md
index a6d941f6d04..b93f2fbde4d 100644
--- a/src/doc/style-guide/src/items.md
+++ b/src/doc/style-guide/src/items.md
@@ -367,14 +367,14 @@ 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;
// If multi-line is required
-type VeryLongType =
- AnEvenLongerType>;
+type VeryLongType
+ = AnEvenLongerType>;
```
Where possible avoid `where` clauses and keep type constraints inline. Where
--
cgit 1.4.1-3-g733a5
From f707b9cd707d84768687caa025d483cef61ed440 Mon Sep 17 00:00:00 2001
From: Michael Goulet
Date: Wed, 16 Aug 2023 16:41:49 +0000
Subject: Describe how to format trailing where clauses
---
src/doc/style-guide/src/items.md | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
(limited to 'src')
diff --git a/src/doc/style-guide/src/items.md b/src/doc/style-guide/src/items.md
index b93f2fbde4d..dc10f4ff15d 100644
--- a/src/doc/style-guide/src/items.md
+++ b/src/doc/style-guide/src/items.md
@@ -378,15 +378,38 @@ type VeryLongType
```
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.,
+that is not possible, prefer a trailing `where` clause over one that precedes
+the type. Split the line before and after a trailing `where` clause (and split
+the `where` clause as normal) and indent before the `=` and type, e.g.,
```rust
type VeryLongType
+ = AnEvenLongerType>
+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.
+
+```
+type WithPrecedingWC
where
T: U::AnAssociatedType,
U: SomeBound,
= AnEvenLongerType>;
+
+// Or with both a preceding and trailing where clause.
+type WithPrecedingWC
+where
+ T: U::AnAssociatedType,
+ U: SomeBound,
+= AnEvenLongerType>
+where
+ T: U::AnAssociatedType2,
+ U: SomeBound2;
```
## Associated types
--
cgit 1.4.1-3-g733a5
From 2ff14b0050145b79769bf207b7d0bee5c98292b8 Mon Sep 17 00:00:00 2001
From: Michael Goulet
Date: Wed, 23 Aug 2023 18:25:09 +0000
Subject: Remove opinions from style guide about where clauses in type alias
items
---
src/doc/style-guide/src/items.md | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
(limited to 'src')
diff --git a/src/doc/style-guide/src/items.md b/src/doc/style-guide/src/items.md
index dc10f4ff15d..b215de6ad28 100644
--- a/src/doc/style-guide/src/items.md
+++ b/src/doc/style-guide/src/items.md
@@ -377,12 +377,12 @@ type VeryLongType
= AnEvenLongerType>;
```
-Where possible avoid `where` clauses and keep type constraints inline. Where
-that is not possible, prefer a trailing `where` clause over one that precedes
-the type. Split the line before and after a trailing `where` clause (and split
-the `where` clause as normal) and indent before the `=` and type, 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
= AnEvenLongerType>
where
@@ -392,9 +392,12 @@ where
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.
+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
where
T: U::AnAssociatedType,
--
cgit 1.4.1-3-g733a5
From 644e40f536840d3bab28cab985a034eabbf707d4 Mon Sep 17 00:00:00 2001
From: Camille GILLOT
Date: Sun, 14 May 2023 13:27:07 +0000
Subject: Do not assume anything about repeated reification of generic
functions.
---
src/tools/miri/tests/pass/function_pointers.rs | 1 -
1 file changed, 1 deletion(-)
(limited to 'src')
diff --git a/src/tools/miri/tests/pass/function_pointers.rs b/src/tools/miri/tests/pass/function_pointers.rs
index b66826e3fcd..593012ca45b 100644
--- a/src/tools/miri/tests/pass/function_pointers.rs
+++ b/src/tools/miri/tests/pass/function_pointers.rs
@@ -75,7 +75,6 @@ fn main() {
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);
// Any non-null value is okay for function pointers.
unsafe {
--
cgit 1.4.1-3-g733a5
From 6dfa05369767d7c079618d93d8bab53415721f65 Mon Sep 17 00:00:00 2001
From: Camille GILLOT
Date: Sun, 14 May 2023 20:31:02 +0000
Subject: Complete miri test.
---
src/tools/miri/tests/pass/function_pointers.rs | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
(limited to 'src')
diff --git a/src/tools/miri/tests/pass/function_pointers.rs b/src/tools/miri/tests/pass/function_pointers.rs
index 593012ca45b..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,9 +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);
+ // 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 {
--
cgit 1.4.1-3-g733a5
From 2eb17581ac05b3cab24fa2f96d9bf6f3ae17ad9b Mon Sep 17 00:00:00 2001
From: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
Date: Mon, 25 Sep 2023 17:04:51 +0200
Subject: Fix whitespace in rustdoc type_layout.html
---
src/librustdoc/html/templates/type_layout.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'src')
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 @@
Note: Most layout information is completely {#+ #}
unstable and may even differ between compilations. {#+ #}
The only exception is types with certain repr(...) {#+ #}
- attributes. Please see the Rust Reference’s {#+ #}
+ attributes. Please see the Rust Reference's {#+ #}
“Type Layout” {#+ #}
chapter for details on type layout guarantees. {# #}
{# #}
{# #}
- Size: {{ type_layout_size|safe }}
{# #}
+ Size: {{+ type_layout_size|safe }}
{# #}
{% if !variants.is_empty() %}
{# #}
Size for each variant: {# #}
--
cgit 1.4.1-3-g733a5
From 08c4963a32a4a9e9d9ce4d76e53a7d4bb85b1711 Mon Sep 17 00:00:00 2001
From: Emmanuel Ferdman
Date: Wed, 27 Sep 2023 18:30:33 +0300
Subject: Update location of personality
---
src/doc/unstable-book/src/language-features/lang-items.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'src')
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`
--
cgit 1.4.1-3-g733a5
From 809ab64e97fc7d7f0f74d2ba13811ce657a740e3 Mon Sep 17 00:00:00 2001
From: Matthias Krüger
Date: Wed, 27 Sep 2023 22:07:33 +0200
Subject: rustdoc: while -> if
we will always return once we step inside the while-loop thus `if` is sufficient here
---
src/librustdoc/html/markdown.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'src')
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> {
- 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();
--
cgit 1.4.1-3-g733a5
From 3b091cb5044ecc956a87993870276311a0e15340 Mon Sep 17 00:00:00 2001
From: The Miri Conjob Bot
Date: Thu, 28 Sep 2023 05:11:51 +0000
Subject: Preparing for merge from rustc
---
src/tools/miri/rust-version | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'src')
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
--
cgit 1.4.1-3-g733a5