From db6c4b24bcd1fc27ace60e47a30a903bbeb5921c Mon Sep 17 00:00:00 2001 From: Walnut <39544927+Walnut356@users.noreply.github.com> Date: Sun, 6 Sep 2026 02:38:00 -0500 Subject: [PATCH 1/5] add several new LLDB flags --- src/etc/lldb_providers.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/etc/lldb_providers.py b/src/etc/lldb_providers.py index 4fdc9e28363b6..a0a539b6d101d 100644 --- a/src/etc/lldb_providers.py +++ b/src/etc/lldb_providers.py @@ -79,6 +79,29 @@ class LLDBFeature(Flag): Float128 = auto() """Added in LLDB 22.1. Adds builtin support for Float 128's, including an `eBasicTypeFloat128`, a formatter, and handlers in `TypeSystemClang`""" + GetParent = auto() + """Added in LLDB 23.1. Adds `SBValue.GetParent`, which retrieves the `SBValue` that the caller + originates from. Useful when a child object must be modified/styled based on information only + available to is parent e.g. unsized array types that must determine their length via the parent + wide pointer value.""" + ProviderDecorator = auto() + """Added in LLDB 23.1. Adds `@lldb.summary` and `@lldb.synthetic`, which can automatically + register decorated providers. At time of writing, we do not use this feature for the following + reasons: + + 1. backwards compatibility + 2. to maintain more strict control over the order in which providers are loaded""" + PerObjectSynthetics = auto() + """Currently only available in prerelease. Adds: + + * `SBValue.SetTypeSynthetic` - allows synthetic providers to override their children's synthetic + provider without overriding the synthetic provider of all objects with that share a type name. + * `SBValue.GetTypeSyntheticImplementation` - retrieves the *instance* of the synthetic provider + associated with that variable. This allows us to easily inspect the state of a parent/child + and use it to make decisions about the current object without needing to redo work. It is worth + noting that this can be achieved backwards-compatibly (though less elegantly) by using a global + `weakref.WeakValueDictionary`, with the keys being `SBValue.GetID()` (which are unique per + session) and the values being the provider instance.""" def detect_features() -> LLDBFeature: @@ -93,6 +116,12 @@ def detect_features() -> LLDBFeature: features |= LLDBFeature.TypeRecognizers if getattr(lldb, "eBasicTypeFloat128", None) is not None: features |= LLDBFeature.Float128 + if getattr(lldb.SBValue, "GetParent", None) is not None: + features |= LLDBFeature.GetParent + if getattr(lldb, "summary", None) is not None: + features |= LLDBFeature.ProviderDecorator + if getattr(lldb.SBValue, "SetTypeSynthetic", None) is not None: + features |= LLDBFeature.PerObjectSynthetics return features From cc3786db90dd3fa47b2eb396427b13ad869e767b Mon Sep 17 00:00:00 2001 From: Walnut <39544927+Walnut356@users.noreply.github.com> Date: Sun, 6 Sep 2026 03:09:37 -0500 Subject: [PATCH 2/5] force u8/i8 numeric formatting for lldb --- src/etc/lldb_lookup.py | 32 +++++++++++++++++++ src/etc/lldb_providers.py | 26 ++++++++++++++- .../basic-types/lldb_input/non_windows.json | 24 +++++++++++--- .../basic-types/lldb_input/windows_gnu.json | 24 +++++++++++--- .../basic-types/lldb_input/windows_msvc.json | 24 +++++++++++--- tests/debuginfo/borrowed-basic.rs | 6 ++-- tests/debuginfo/reference-debuginfo.rs | 6 ++-- tests/debuginfo/strings-and-strs.rs | 11 +++++-- tests/debuginfo/union-smoke.rs | 4 +-- 9 files changed, 133 insertions(+), 24 deletions(-) diff --git a/src/etc/lldb_lookup.py b/src/etc/lldb_lookup.py index f45506e0c53a7..ed43b434e2de8 100644 --- a/src/etc/lldb_lookup.py +++ b/src/etc/lldb_lookup.py @@ -126,6 +126,38 @@ def register_providers_compatibility(): global RUST_CATEGORY + # Don't format 8-bit builtins as chars + unsigned_format = lldb.SBTypeFormat( + lldb.eFormatUnsigned, + lldb.eTypeOptionCascade + | lldb.eTypeOptionSkipPointers + | lldb.eTypeOptionSkipReferences, + ) + + RUST_CATEGORY.AddTypeFormat(lldb.SBTypeNameSpecifier("u8", False), unsigned_format) + RUST_CATEGORY.AddTypeFormat( + lldb.SBTypeNameSpecifier("unsigned char", False), + unsigned_format, + ) + + signed_format = lldb.SBTypeFormat( + lldb.eFormatDecimal, + lldb.eTypeOptionCascade + | lldb.eTypeOptionSkipPointers + | lldb.eTypeOptionSkipReferences, + ) + RUST_CATEGORY.AddTypeFormat( + lldb.SBTypeNameSpecifier("i8", False), lldb.SBTypeFormat(lldb.eFormatDecimal) + ) + + # i8 translates to signed char on msvc + RUST_CATEGORY.AddTypeFormat( + lldb.SBTypeNameSpecifier("signed char", False), + signed_format, + ) + # Does not conflict with rust char, which ends up with the type name `char32_t` + RUST_CATEGORY.AddTypeFormat(lldb.SBTypeNameSpecifier("char", False), signed_format) + if LLDBFeature.TypeRecognizers in FEATURE_FLAGS: # enforce uniform aggregate formatting register_summary( diff --git a/src/etc/lldb_providers.py b/src/etc/lldb_providers.py index 4fdc9e28363b6..16025d9b66c96 100644 --- a/src/etc/lldb_providers.py +++ b/src/etc/lldb_providers.py @@ -680,6 +680,9 @@ def get_child_at_index(self, index: int) -> Optional[SBValue]: element = self.data_ptr.CreateValueFromAddress( f"[{index}]", address, self.data_ptr.GetType().GetPointeeType() ) + + element.SetFormat(eFormatChar) + return element def get_type_name(self): @@ -1154,10 +1157,28 @@ def has_children(self) -> bool: class StdSliceSyntheticProvider: - __slots__ = ["valobj", "length", "data_ptr", "element_type", "element_size"] + __slots__ = [ + "valobj", + "length", + "data_ptr", + "element_type", + "element_size", + "is_str", + ] def __init__(self, valobj: SBValue, _dict: LLDBOpaque): self.valobj = valobj + type_name = self.valobj.GetTypeName() + self.is_str = type_name.startswith("alloc::boxed::Box", + "ref_mut$", + "ptr_const$", + "ptr_mut$", + } self.update() def num_children(self) -> int: @@ -1176,6 +1197,9 @@ def get_child_at_index(self, index: int) -> Optional[SBValue]: element = self.data_ptr.CreateValueFromAddress( "[%s]" % index, address, self.element_type ) + + if self.is_str: + element.SetFormat(eFormatChar) return element def update(self): diff --git a/tests/debuginfo/basic-types/lldb_input/non_windows.json b/tests/debuginfo/basic-types/lldb_input/non_windows.json index e1cfbe77d0c5c..af225246e6109 100644 --- a/tests/debuginfo/basic-types/lldb_input/non_windows.json +++ b/tests/debuginfo/basic-types/lldb_input/non_windows.json @@ -23,8 +23,9 @@ }, "i8": { "type": "char", - "pretty_print": "'D'", - "value": 68 + "pretty_print": "68", + "value": 68, + "format": 9 }, "i16": { "type": "short", @@ -48,8 +49,9 @@ }, "u8": { "type": "unsigned char", - "pretty_print": "'d'", - "value": 100 + "pretty_print": "100", + "value": 100, + "format": 18 }, "u16": { "type": "unsigned short", @@ -77,5 +79,17 @@ "value": 3.5 } } - ] + ], + "types": { + "char": { + "size": 1, + "type_class": 4, + "basic_type": 3 + }, + "unsigned char": { + "size": 1, + "type_class": 4, + "basic_type": 4 + } + } } diff --git a/tests/debuginfo/basic-types/lldb_input/windows_gnu.json b/tests/debuginfo/basic-types/lldb_input/windows_gnu.json index bcbcaa6ddf4e4..80c35ffcbea60 100644 --- a/tests/debuginfo/basic-types/lldb_input/windows_gnu.json +++ b/tests/debuginfo/basic-types/lldb_input/windows_gnu.json @@ -23,8 +23,9 @@ }, "i8": { "type": "char", - "pretty_print": "'D'", - "value": 68 + "pretty_print": "68", + "value": 68, + "format": 9 }, "i16": { "type": "short", @@ -48,8 +49,9 @@ }, "u8": { "type": "unsigned char", - "pretty_print": "'d'", - "value": 100 + "pretty_print": "100", + "value": 100, + "format": 18 }, "u16": { "type": "unsigned short", @@ -77,5 +79,17 @@ "value": 3.5 } } - ] + ], + "types": { + "char": { + "size": 1, + "type_class": 4, + "basic_type": 3 + }, + "unsigned char": { + "size": 1, + "type_class": 4, + "basic_type": 4 + } + } } diff --git a/tests/debuginfo/basic-types/lldb_input/windows_msvc.json b/tests/debuginfo/basic-types/lldb_input/windows_msvc.json index 047d6d6e08768..0a7b134b4f683 100644 --- a/tests/debuginfo/basic-types/lldb_input/windows_msvc.json +++ b/tests/debuginfo/basic-types/lldb_input/windows_msvc.json @@ -23,8 +23,9 @@ }, "i8": { "type": "signed char", - "pretty_print": "'D'", - "value": 68 + "pretty_print": "68", + "value": 68, + "format": 9 }, "i16": { "type": "short", @@ -48,8 +49,9 @@ }, "u8": { "type": "unsigned char", - "pretty_print": "'d'", - "value": 100 + "pretty_print": "100", + "value": 100, + "format": 18 }, "u16": { "type": "unsigned short", @@ -77,5 +79,17 @@ "value": 3.5 } } - ] + ], + "types": { + "signed char": { + "size": 1, + "type_class": 4, + "basic_type": 3 + }, + "unsigned char": { + "size": 1, + "type_class": 4, + "basic_type": 4 + } + } } diff --git a/tests/debuginfo/borrowed-basic.rs b/tests/debuginfo/borrowed-basic.rs index a3cffe3c65202..28dd86a796cec 100644 --- a/tests/debuginfo/borrowed-basic.rs +++ b/tests/debuginfo/borrowed-basic.rs @@ -60,9 +60,11 @@ //@ lldb-command:v *int_ref //@ lldb-check:[...] -1 +//@ lldb-command:v *char_ref +//@ lldb-check: [...] U+0x00000061 U'a' //@ lldb-command:v *i8_ref -//@ lldb-check:[...] 'D' +//@ lldb-check:[...] 68 //@ lldb-command:v *i16_ref //@ lldb-check:[...] -16 @@ -77,7 +79,7 @@ //@ lldb-check:[...] 1 //@ lldb-command:v *u8_ref -//@ lldb-check:[...] 'd' +//@ lldb-check:[...] 100 //@ lldb-command:v *u16_ref //@ lldb-check:[...] 16 diff --git a/tests/debuginfo/reference-debuginfo.rs b/tests/debuginfo/reference-debuginfo.rs index 14e5d798195ba..11a8fcc8f1e9d 100644 --- a/tests/debuginfo/reference-debuginfo.rs +++ b/tests/debuginfo/reference-debuginfo.rs @@ -67,9 +67,11 @@ //@ lldb-command:v *int_ref //@ lldb-check:[...] -1 +//@ lldb-command:v *char_ref +//@ lldb-check: [...] U+0x00000061 U'a' //@ lldb-command:v *i8_ref -//@ lldb-check:[...] 'D' +//@ lldb-check:[...] 68 //@ lldb-command:v *i16_ref //@ lldb-check:[...] -16 @@ -84,7 +86,7 @@ //@ lldb-check:[...] 1 //@ lldb-command:v *u8_ref -//@ lldb-check:[...] 'd' +//@ lldb-check:[...] 100 //@ lldb-command:v *u16_ref //@ lldb-check:[...] 16 diff --git a/tests/debuginfo/strings-and-strs.rs b/tests/debuginfo/strings-and-strs.rs index a860aa6106d07..0a7f4b13c4e56 100644 --- a/tests/debuginfo/strings-and-strs.rs +++ b/tests/debuginfo/strings-and-strs.rs @@ -48,8 +48,15 @@ //@ lldb-command:v box_str //@ lldb-check:(alloc::boxed::Box) box_str = "World" { [0] = 'W' [1] = 'o' [2] = 'r' [3] = 'l' [4] = 'd' } -//@ lldb-command:v rc_str -//@ lldb-check:(alloc::rc::Rc) rc_str = strong=1, weak=0 { value = "World" } +// Disabled temporarily since it only "works" by accident +// `value` is a wide pointer, whose `data_ptr` type, according to LLDB, is `unsigned char[]`. LLDB +// reads this as a c-string by default. On Linux this fairly consistenly results in the expected +// output below. On Windows, the string data is often not followed by a null byte and attempts to +// read OOB memory. This will be fixed as part of #161657 +// lldb-command:v rc_str + +// ignore-tidy-linelength +// lldb-check:(alloc::rc::Rc) rc_str = strong=1, weak=0 { value = "World" } #![allow(unused_variables)] diff --git a/tests/debuginfo/union-smoke.rs b/tests/debuginfo/union-smoke.rs index bced679086144..c4c31704f4e71 100644 --- a/tests/debuginfo/union-smoke.rs +++ b/tests/debuginfo/union-smoke.rs @@ -14,10 +14,10 @@ //@ lldb-command:run //@ lldb-command:v u -//@ lldb-check:[...] {a:('\x02', '\x02'), b:514} +//@ lldb-check:[...] {a:(2, 2), b:514} //@ lldb-command:print union_smoke::SU -//@ lldb-check:[...] {a:('\x01', '\x01'), b:257} +//@ lldb-check:[...] {a:(1, 1), b:257} #![allow(unused)] From 41318e09c590df57b99ab9d0fa7ee0bf4bb6191e Mon Sep 17 00:00:00 2001 From: Walnut <39544927+Walnut356@users.noreply.github.com> Date: Sun, 6 Sep 2026 03:25:45 -0500 Subject: [PATCH 3/5] use `lldb.eTypeOptionHideChildren` for msvc tuples --- src/etc/lldb_lookup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/etc/lldb_lookup.py b/src/etc/lldb_lookup.py index f45506e0c53a7..6af7ab58ae58a 100644 --- a/src/etc/lldb_lookup.py +++ b/src/etc/lldb_lookup.py @@ -357,6 +357,7 @@ def register_providers_compatibility(): MSVCTupleSyntheticProvider, TupleSummaryProvider, r"^tuple\$<.+>$", + type_options=DEFAULT_TYPE_OPTIONS | lldb.eTypeOptionHideChildren, ) From f63cf219cf0a0d94a0133bc625dc678e46f467db Mon Sep 17 00:00:00 2001 From: malezjaa Date: Thu, 3 Sep 2026 09:45:28 +0200 Subject: [PATCH 4/5] remove stale/duplicate tests --- src/tools/tidy/src/issues.txt | 5 - .../drop-track-field-assign-nonsend.rs | 44 ------ .../drop-track-field-assign-nonsend.stderr | 23 ---- .../ui/async-await/drop-track-field-assign.rs | 43 ------ .../borrowck/suggest-local-var-for-vector.rs | 4 - .../suggest-local-var-for-vector.stderr | 24 ---- .../recursion-issue-105275.rs | 28 ---- .../recursion-issue-105275.stderr | 14 -- tests/ui/consts/const-blocks/migrate-fail.rs | 22 --- .../consts/const-blocks/migrate-fail.stderr | 35 ----- tests/ui/consts/const-blocks/migrate-pass.rs | 125 ----------------- tests/ui/consts/issue-29914-2.rs | 3 +- tests/ui/consts/issue-29914-3.rs | 7 - .../ui/coroutine/derived-drop-parent-expr.rs | 2 +- .../drop-tracking-parent-expression.rs | 70 ---------- .../drop-tracking-parent-expression.stderr | 128 ------------------ .../tuple-like-structs-cross-crate-7899.rs | 10 -- tests/ui/error-codes/E0508-fail.rs | 6 - tests/ui/error-codes/E0508-fail.stderr | 25 ---- .../ex3-both-anon-regions-one-is-struct-4.rs | 15 +- ...3-both-anon-regions-one-is-struct-4.stderr | 19 +-- .../ex3-both-anon-regions-one-is-struct-5.rs | 13 -- ...3-both-anon-regions-one-is-struct-5.stderr | 20 --- tests/ui/lint/auxiliary/stability_cfg2.rs | 5 - tests/ui/parser/issues/issue-1802-2.rs | 7 - tests/ui/parser/issues/issue-1802-2.stderr | 9 -- .../tool_lints_2018_preview.rs | 6 - .../ui/type-alias-impl-trait/issue-58951-2.rs | 16 --- .../ui/type-alias-impl-trait/issue-74761-2.rs | 16 --- .../issue-74761-2.stderr | 25 ---- .../issue-30276-feature-flagged.rs | 6 - .../issue-30276-feature-flagged.stderr | 13 -- 32 files changed, 24 insertions(+), 764 deletions(-) delete mode 100644 tests/ui/async-await/drop-track-field-assign-nonsend.rs delete mode 100644 tests/ui/async-await/drop-track-field-assign-nonsend.stderr delete mode 100644 tests/ui/async-await/drop-track-field-assign.rs delete mode 100644 tests/ui/borrowck/suggest-local-var-for-vector.rs delete mode 100644 tests/ui/borrowck/suggest-local-var-for-vector.stderr delete mode 100644 tests/ui/codegen/normalization-overflow/recursion-issue-105275.rs delete mode 100644 tests/ui/codegen/normalization-overflow/recursion-issue-105275.stderr delete mode 100644 tests/ui/consts/const-blocks/migrate-fail.rs delete mode 100644 tests/ui/consts/const-blocks/migrate-fail.stderr delete mode 100644 tests/ui/consts/const-blocks/migrate-pass.rs delete mode 100644 tests/ui/consts/issue-29914-3.rs delete mode 100644 tests/ui/coroutine/drop-tracking-parent-expression.rs delete mode 100644 tests/ui/coroutine/drop-tracking-parent-expression.stderr delete mode 100644 tests/ui/cross-crate/tuple-like-structs-cross-crate-7899.rs delete mode 100644 tests/ui/error-codes/E0508-fail.rs delete mode 100644 tests/ui/error-codes/E0508-fail.stderr delete mode 100644 tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-5.rs delete mode 100644 tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-5.stderr delete mode 100644 tests/ui/lint/auxiliary/stability_cfg2.rs delete mode 100644 tests/ui/parser/issues/issue-1802-2.rs delete mode 100644 tests/ui/parser/issues/issue-1802-2.stderr delete mode 100644 tests/ui/tool-attributes/tool_lints_2018_preview.rs delete mode 100644 tests/ui/type-alias-impl-trait/issue-58951-2.rs delete mode 100644 tests/ui/type-alias-impl-trait/issue-74761-2.rs delete mode 100644 tests/ui/type-alias-impl-trait/issue-74761-2.stderr delete mode 100644 tests/ui/unsized-locals/issue-30276-feature-flagged.rs delete mode 100644 tests/ui/unsized-locals/issue-30276-feature-flagged.stderr diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index c15bc3af026e5..9b878307afc96 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -724,7 +724,6 @@ ui/consts/issue-28113.rs ui/consts/issue-28822.rs ui/consts/issue-29798.rs ui/consts/issue-29914-2.rs -ui/consts/issue-29914-3.rs ui/consts/issue-29914.rs ui/consts/issue-29927-1.rs ui/consts/issue-29927.rs @@ -1915,7 +1914,6 @@ ui/parser/issues/issue-17718-parse-const.rs ui/parser/issues/issue-17904-2.rs ui/parser/issues/issue-17904.rs ui/parser/issues/issue-1802-1.rs -ui/parser/issues/issue-1802-2.rs ui/parser/issues/issue-19096.rs ui/parser/issues/issue-19398.rs ui/parser/issues/issue-20616-1.rs @@ -2764,7 +2762,6 @@ ui/type-alias-impl-trait/issue-57961.rs ui/type-alias-impl-trait/issue-58662-coroutine-with-lifetime.rs ui/type-alias-impl-trait/issue-58662-simplified.rs ui/type-alias-impl-trait/issue-58887.rs -ui/type-alias-impl-trait/issue-58951-2.rs ui/type-alias-impl-trait/issue-58951.rs ui/type-alias-impl-trait/issue-60371.rs ui/type-alias-impl-trait/issue-60407.rs @@ -2790,7 +2787,6 @@ ui/type-alias-impl-trait/issue-70121.rs ui/type-alias-impl-trait/issue-72793.rs ui/type-alias-impl-trait/issue-74244.rs ui/type-alias-impl-trait/issue-74280.rs -ui/type-alias-impl-trait/issue-74761-2.rs ui/type-alias-impl-trait/issue-74761.rs ui/type-alias-impl-trait/issue-76202-trait-impl-for-tait.rs ui/type-alias-impl-trait/issue-77179.rs @@ -2955,7 +2951,6 @@ ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.rs ui/unsafe/issue-47412.rs ui/unsafe/issue-85435-unsafe-op-in-let-under-unsafe-under-closure.rs ui/unsafe/issue-87414-query-cycle.rs -ui/unsized-locals/issue-30276-feature-flagged.rs ui/unsized-locals/issue-30276.rs ui/unsized-locals/issue-50940-with-feature.rs ui/unsized-locals/issue-50940.rs diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.rs b/tests/ui/async-await/drop-track-field-assign-nonsend.rs deleted file mode 100644 index 2b93f90137671..0000000000000 --- a/tests/ui/async-await/drop-track-field-assign-nonsend.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Derived from an ICE found in tokio-xmpp during a crater run. -//@ edition:2021 - -#![allow(dead_code)] - -#[derive(Clone)] -struct InfoResult { - node: Option> -} - -struct Agent { - info_result: InfoResult -} - -impl Agent { - async fn handle(&mut self) { - let mut info = self.info_result.clone(); - info.node = None; - let element = parse_info(info); - let _ = send_element(element).await; - } -} - -struct Element { -} - -async fn send_element(_: Element) {} - -fn parse(_: &[u8]) -> Result<(), ()> { - Ok(()) -} - -fn parse_info(_: InfoResult) -> Element { - Element { } -} - -fn assert_send(_: T) {} - -fn main() { - let agent = Agent { info_result: InfoResult { node: None } }; - // FIXME: It would be nice for this to work. See #94067. - assert_send(agent.handle()); - //~^ ERROR cannot be sent between threads safely -} diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.stderr deleted file mode 100644 index 9fce4d61b3b6f..0000000000000 --- a/tests/ui/async-await/drop-track-field-assign-nonsend.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/drop-track-field-assign-nonsend.rs:42:17 - | -LL | assert_send(agent.handle()); - | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send` - | - = help: within `impl Future`, the trait `Send` is not implemented for `Rc` -note: future is not `Send` as this value is used across an await - --> $DIR/drop-track-field-assign-nonsend.rs:20:39 - | -LL | let mut info = self.info_result.clone(); - | -------- has type `InfoResult` which is not `Send` -... -LL | let _ = send_element(element).await; - | ^^^^^ await occurs here, with `mut info` maybe used later -note: required by a bound in `assert_send` - --> $DIR/drop-track-field-assign-nonsend.rs:37:19 - | -LL | fn assert_send(_: T) {} - | ^^^^ required by this bound in `assert_send` - -error: aborting due to 1 previous error - diff --git a/tests/ui/async-await/drop-track-field-assign.rs b/tests/ui/async-await/drop-track-field-assign.rs deleted file mode 100644 index 491f80d062bbb..0000000000000 --- a/tests/ui/async-await/drop-track-field-assign.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Derived from an ICE found in tokio-xmpp during a crater run. -//@ edition:2021 -//@ build-pass - -#![allow(dead_code)] - -#[derive(Clone)] -struct InfoResult { - node: Option -} - -struct Agent { - info_result: InfoResult -} - -impl Agent { - async fn handle(&mut self) { - let mut info = self.info_result.clone(); - info.node = Some("bar".into()); - let element = parse_info(info); - send_element(element).await; - } -} - -struct Element { -} - -async fn send_element(_: Element) {} - -fn parse(_: &[u8]) -> Result<(), ()> { - Ok(()) -} - -fn parse_info(_: InfoResult) -> Element { - Element { } -} - -fn main() { - let mut agent = Agent { - info_result: InfoResult { node: None } - }; - let _ = agent.handle(); -} diff --git a/tests/ui/borrowck/suggest-local-var-for-vector.rs b/tests/ui/borrowck/suggest-local-var-for-vector.rs deleted file mode 100644 index 40f013f6a78a7..0000000000000 --- a/tests/ui/borrowck/suggest-local-var-for-vector.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - let mut vec = vec![0u32; 420]; - vec[vec.len() - 1] = 123; //~ ERROR cannot borrow `vec` as immutable because it is also borrowed as mutable -} diff --git a/tests/ui/borrowck/suggest-local-var-for-vector.stderr b/tests/ui/borrowck/suggest-local-var-for-vector.stderr deleted file mode 100644 index d88e8b09687db..0000000000000 --- a/tests/ui/borrowck/suggest-local-var-for-vector.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0502]: cannot borrow `vec` as immutable because it is also borrowed as mutable - --> $DIR/suggest-local-var-for-vector.rs:3:9 - | -LL | vec[vec.len() - 1] = 123; - | ----^^^----------- - | | || - | | |immutable borrow occurs here - | | mutable borrow later used here - | mutable borrow occurs here - | -help: try adding a local storing this... - --> $DIR/suggest-local-var-for-vector.rs:3:9 - | -LL | vec[vec.len() - 1] = 123; - | ^^^^^^^^^ -help: ...and then using that local here - --> $DIR/suggest-local-var-for-vector.rs:3:8 - | -LL | vec[vec.len() - 1] = 123; - | ^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/codegen/normalization-overflow/recursion-issue-105275.rs b/tests/ui/codegen/normalization-overflow/recursion-issue-105275.rs deleted file mode 100644 index 98bbfd4420dc6..0000000000000 --- a/tests/ui/codegen/normalization-overflow/recursion-issue-105275.rs +++ /dev/null @@ -1,28 +0,0 @@ -//@ build-fail -//@ compile-flags: -Copt-level=0 - -pub fn encode_num(n: u32, mut writer: Writer) -> Result<(), Writer::Error> { - if n > 15 { - encode_num(n / 16, &mut writer)?; - //~^ ERROR: reached the recursion limit while instantiating - } - Ok(()) -} - -pub trait ExampleWriter { - type Error; -} - -impl<'a, T: ExampleWriter> ExampleWriter for &'a mut T { - type Error = T::Error; -} - -struct Error; - -impl ExampleWriter for Error { - type Error = (); -} - -fn main() { - encode_num(69, &mut Error).unwrap(); -} diff --git a/tests/ui/codegen/normalization-overflow/recursion-issue-105275.stderr b/tests/ui/codegen/normalization-overflow/recursion-issue-105275.stderr deleted file mode 100644 index 94fba4621d0a0..0000000000000 --- a/tests/ui/codegen/normalization-overflow/recursion-issue-105275.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: reached the recursion limit while instantiating `encode_num::<&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut Error>` - --> $DIR/recursion-issue-105275.rs:6:9 - | -LL | encode_num(n / 16, &mut writer)?; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: `encode_num` defined here - --> $DIR/recursion-issue-105275.rs:4:1 - | -LL | pub fn encode_num(n: u32, mut writer: Writer) -> Result<(), Writer::Error> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/consts/const-blocks/migrate-fail.rs b/tests/ui/consts/const-blocks/migrate-fail.rs deleted file mode 100644 index e7dbb68d920e5..0000000000000 --- a/tests/ui/consts/const-blocks/migrate-fail.rs +++ /dev/null @@ -1,22 +0,0 @@ -#![allow(warnings)] - -// Some type that is not copyable. -struct Bar; - -mod non_constants { - use crate::Bar; - - fn no_impl_copy_empty_value_multiple_elements() { - let x = None; - let arr: [Option; 2] = [x; 2]; - //~^ ERROR the trait bound `Bar: Copy` is not satisfied [E0277] - } - - fn no_impl_copy_value_multiple_elements() { - let x = Some(Bar); - let arr: [Option; 2] = [x; 2]; - //~^ ERROR the trait bound `Bar: Copy` is not satisfied [E0277] - } -} - -fn main() {} diff --git a/tests/ui/consts/const-blocks/migrate-fail.stderr b/tests/ui/consts/const-blocks/migrate-fail.stderr deleted file mode 100644 index 3c116026e5804..0000000000000 --- a/tests/ui/consts/const-blocks/migrate-fail.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0277]: the trait bound `Bar: Copy` is not satisfied - --> $DIR/migrate-fail.rs:11:38 - | -LL | let arr: [Option; 2] = [x; 2]; - | ^ the trait `Copy` is not implemented for `Bar` - | - = note: required for `Option` to implement `Copy` - = note: the `Copy` trait is required because this value will be copied for each element of the array - = help: consider using `core::array::from_fn` to initialize the array - = help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information -help: consider annotating `Bar` with `#[derive(Copy)]` - | -LL + #[derive(Copy)] -LL | struct Bar; - | - -error[E0277]: the trait bound `Bar: Copy` is not satisfied - --> $DIR/migrate-fail.rs:17:38 - | -LL | let arr: [Option; 2] = [x; 2]; - | ^ the trait `Copy` is not implemented for `Bar` - | - = note: required for `Option` to implement `Copy` - = note: the `Copy` trait is required because this value will be copied for each element of the array - = help: consider using `core::array::from_fn` to initialize the array - = help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information -help: consider annotating `Bar` with `#[derive(Copy)]` - | -LL + #[derive(Copy)] -LL | struct Bar; - | - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/consts/const-blocks/migrate-pass.rs b/tests/ui/consts/const-blocks/migrate-pass.rs deleted file mode 100644 index 629d4db0dc6f1..0000000000000 --- a/tests/ui/consts/const-blocks/migrate-pass.rs +++ /dev/null @@ -1,125 +0,0 @@ -//@ check-pass -#![allow(warnings)] - -// Some type that is not copyable. -struct Bar; - -mod constants { - use crate::Bar; - - fn no_impl_copy_empty_value_no_elements() { - const FOO: Option = None; - const ARR: [Option; 0] = [FOO; 0]; - } - - fn no_impl_copy_empty_value_single_element() { - const FOO: Option = None; - const ARR: [Option; 1] = [FOO; 1]; - } - - fn no_impl_copy_empty_value_multiple_elements() { - const FOO: Option = None; - const ARR: [Option; 2] = [FOO; 2]; - } - - fn no_impl_copy_value_no_elements() { - const FOO: Option = Some(Bar); - const ARR: [Option; 0] = [FOO; 0]; - } - - fn no_impl_copy_value_single_element() { - const FOO: Option = Some(Bar); - const ARR: [Option; 1] = [FOO; 1]; - } - - fn no_impl_copy_value_multiple_elements() { - const FOO: Option = Some(Bar); - const ARR: [Option; 2] = [FOO; 2]; - } - - fn impl_copy_empty_value_no_elements() { - const FOO: Option = None; - const ARR: [Option; 0] = [FOO; 0]; - } - - fn impl_copy_empty_value_one_element() { - const FOO: Option = None; - const ARR: [Option; 1] = [FOO; 1]; - } - - fn impl_copy_empty_value_multiple_elements() { - const FOO: Option = None; - const ARR: [Option; 2] = [FOO; 2]; - } - - fn impl_copy_value_no_elements() { - const FOO: Option = Some(4); - const ARR: [Option; 0] = [FOO; 0]; - } - - fn impl_copy_value_one_element() { - const FOO: Option = Some(4); - const ARR: [Option; 1] = [FOO; 1]; - } - - fn impl_copy_value_multiple_elements() { - const FOO: Option = Some(4); - const ARR: [Option; 2] = [FOO; 2]; - } -} - -mod non_constants { - use crate::Bar; - - fn no_impl_copy_empty_value_no_elements() { - let x = None; - let arr: [Option; 0] = [x; 0]; - } - - fn no_impl_copy_empty_value_single_element() { - let x = None; - let arr: [Option; 1] = [x; 1]; - } - - fn no_impl_copy_value_no_elements() { - let x = Some(Bar); - let arr: [Option; 0] = [x; 0]; - } - - fn no_impl_copy_value_single_element() { - let x = Some(Bar); - let arr: [Option; 1] = [x; 1]; - } - - fn impl_copy_empty_value_no_elements() { - let x: Option = None; - let arr: [Option; 0] = [x; 0]; - } - - fn impl_copy_empty_value_one_element() { - let x: Option = None; - let arr: [Option; 1] = [x; 1]; - } - - fn impl_copy_empty_value_multiple_elements() { - let x: Option = None; - let arr: [Option; 2] = [x; 2]; - } - - fn impl_copy_value_no_elements() { - let x: Option = Some(4); - let arr: [Option; 0] = [x; 0]; - } - - fn impl_copy_value_one_element() { - let x: Option = Some(4); - let arr: [Option; 1] = [x; 1]; - } - - fn impl_copy_value_multiple_elements() { - let x: Option = Some(4); - let arr: [Option; 2] = [x; 2]; - } -} - -fn main() {} diff --git a/tests/ui/consts/issue-29914-2.rs b/tests/ui/consts/issue-29914-2.rs index 36a82f5b95012..575cd30e229d9 100644 --- a/tests/ui/consts/issue-29914-2.rs +++ b/tests/ui/consts/issue-29914-2.rs @@ -1,6 +1,7 @@ //@ run-pass const ARR: [usize; 5] = [5, 4, 3, 2, 1]; +const BLA: usize = ARR[ARR[3]]; fn main() { - assert_eq!(3, ARR[ARR[3]]); + assert_eq!(3, BLA); } diff --git a/tests/ui/consts/issue-29914-3.rs b/tests/ui/consts/issue-29914-3.rs deleted file mode 100644 index 575cd30e229d9..0000000000000 --- a/tests/ui/consts/issue-29914-3.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ run-pass -const ARR: [usize; 5] = [5, 4, 3, 2, 1]; -const BLA: usize = ARR[ARR[3]]; - -fn main() { - assert_eq!(3, BLA); -} diff --git a/tests/ui/coroutine/derived-drop-parent-expr.rs b/tests/ui/coroutine/derived-drop-parent-expr.rs index cc217e4960e90..96872ab1cf9f7 100644 --- a/tests/ui/coroutine/derived-drop-parent-expr.rs +++ b/tests/ui/coroutine/derived-drop-parent-expr.rs @@ -1,6 +1,6 @@ //@ build-pass -//! Like drop-tracking-parent-expression, but also tests that this doesn't ICE when building MIR +//! Like parent-expression, but also tests that this doesn't ICE when building MIR #![feature(coroutines, stmt_expr_attributes)] fn assert_send(_thing: T) {} diff --git a/tests/ui/coroutine/drop-tracking-parent-expression.rs b/tests/ui/coroutine/drop-tracking-parent-expression.rs deleted file mode 100644 index 702cbc88ae4b0..0000000000000 --- a/tests/ui/coroutine/drop-tracking-parent-expression.rs +++ /dev/null @@ -1,70 +0,0 @@ -//@ dont-require-annotations: NOTE - -#![feature(coroutines, negative_impls, rustc_attrs, stmt_expr_attributes)] - -macro_rules! type_combinations { - ( - $( $name:ident => { $( $tt:tt )* } );* $(;)? - ) => { $( - mod $name { - $( $tt )* - - impl !Sync for Client {} - impl !Send for Client {} - } - - // Struct update syntax. This fails because the Client used in the update is considered - // dropped *after* the yield. - { - let g = #[coroutine] move || match drop($name::Client { ..$name::Client::default() }) { - //~^ NOTE `significant_drop::Client` which is not `Send` - //~| NOTE `insignificant_dtor::Client` which is not `Send` - //~| NOTE `derived_drop::Client` which is not `Send` - _ => yield, - }; - assert_send(g); - //~^ ERROR cannot be sent between threads - //~| ERROR cannot be sent between threads - //~| ERROR cannot be sent between threads - } - - // Simple owned value. This works because the Client is considered moved into `drop`, - // even though the temporary expression doesn't end until after the yield. - { - let g = #[coroutine] move || match drop($name::Client::default()) { - _ => yield, - }; - assert_send(g); - } - )* } -} - -fn assert_send(_thing: T) {} - -fn main() { - type_combinations!( - // OK - copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; - // NOT OK: MIR borrowck thinks that this is used after the yield, even though - // this has no `Drop` impl and only the drops of the fields are observable. - // FIXME: this should compile. - derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; - // NOT OK - significant_drop => { - #[derive(Default)] - pub struct Client; - impl Drop for Client { - fn drop(&mut self) {} - } - }; - // NOT OK (we need to agree with MIR borrowck) - insignificant_dtor => { - #[derive(Default)] - #[rustc_insignificant_dtor] - pub struct Client; - impl Drop for Client { - fn drop(&mut self) {} - } - }; - ); -} diff --git a/tests/ui/coroutine/drop-tracking-parent-expression.stderr b/tests/ui/coroutine/drop-tracking-parent-expression.stderr deleted file mode 100644 index fe8c17c12946d..0000000000000 --- a/tests/ui/coroutine/drop-tracking-parent-expression.stderr +++ /dev/null @@ -1,128 +0,0 @@ -error: coroutine cannot be sent between threads safely - --> $DIR/drop-tracking-parent-expression.rs:25:13 - | -LL | assert_send(g); - | ^^^^^^^^^^^^^^ coroutine is not `Send` -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation - | -help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `derived_drop::Client` - --> $DIR/drop-tracking-parent-expression.rs:51:46 - | -LL | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; - | ^^^^^^^^^^^^^^^^^ -note: coroutine is not `Send` as this value is used across a yield - --> $DIR/drop-tracking-parent-expression.rs:23:22 - | -LL | let g = #[coroutine] move || match drop($name::Client { ..$name::Client::default() }) { - | ------------------------ has type `derived_drop::Client` which is not `Send` -... -LL | _ => yield, - | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation -note: required by a bound in `assert_send` - --> $DIR/drop-tracking-parent-expression.rs:42:19 - | -LL | fn assert_send(_thing: T) {} - | ^^^^ required by this bound in `assert_send` - = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: coroutine cannot be sent between threads safely - --> $DIR/drop-tracking-parent-expression.rs:25:13 - | -LL | assert_send(g); - | ^^^^^^^^^^^^^^ coroutine is not `Send` -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation - | -help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `significant_drop::Client` - --> $DIR/drop-tracking-parent-expression.rs:55:13 - | -LL | pub struct Client; - | ^^^^^^^^^^^^^^^^^ -note: coroutine is not `Send` as this value is used across a yield - --> $DIR/drop-tracking-parent-expression.rs:23:22 - | -LL | let g = #[coroutine] move || match drop($name::Client { ..$name::Client::default() }) { - | ------------------------ has type `significant_drop::Client` which is not `Send` -... -LL | _ => yield, - | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation -note: required by a bound in `assert_send` - --> $DIR/drop-tracking-parent-expression.rs:42:19 - | -LL | fn assert_send(_thing: T) {} - | ^^^^ required by this bound in `assert_send` - = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: coroutine cannot be sent between threads safely - --> $DIR/drop-tracking-parent-expression.rs:25:13 - | -LL | assert_send(g); - | ^^^^^^^^^^^^^^ coroutine is not `Send` -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation - | -help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `insignificant_dtor::Client` - --> $DIR/drop-tracking-parent-expression.rs:64:13 - | -LL | pub struct Client; - | ^^^^^^^^^^^^^^^^^ -note: coroutine is not `Send` as this value is used across a yield - --> $DIR/drop-tracking-parent-expression.rs:23:22 - | -LL | let g = #[coroutine] move || match drop($name::Client { ..$name::Client::default() }) { - | ------------------------ has type `insignificant_dtor::Client` which is not `Send` -... -LL | _ => yield, - | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation -note: required by a bound in `assert_send` - --> $DIR/drop-tracking-parent-expression.rs:42:19 - | -LL | fn assert_send(_thing: T) {} - | ^^^^ required by this bound in `assert_send` - = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 3 previous errors - diff --git a/tests/ui/cross-crate/tuple-like-structs-cross-crate-7899.rs b/tests/ui/cross-crate/tuple-like-structs-cross-crate-7899.rs deleted file mode 100644 index ce3ea7dd5796a..0000000000000 --- a/tests/ui/cross-crate/tuple-like-structs-cross-crate-7899.rs +++ /dev/null @@ -1,10 +0,0 @@ -// https://github.com/rust-lang/rust/issues/7899 -//@ run-pass -#![allow(unused_variables)] -//@ aux-build:aux-7899.rs - -extern crate aux_7899 as testcrate; - -fn main() { - let f = testcrate::V2(1.0f32, 2.0f32); -} diff --git a/tests/ui/error-codes/E0508-fail.rs b/tests/ui/error-codes/E0508-fail.rs deleted file mode 100644 index 072c3d66183e3..0000000000000 --- a/tests/ui/error-codes/E0508-fail.rs +++ /dev/null @@ -1,6 +0,0 @@ -struct NonCopy; - -fn main() { - let array = [NonCopy; 1]; - let _value = array[0]; //~ ERROR [E0508] -} diff --git a/tests/ui/error-codes/E0508-fail.stderr b/tests/ui/error-codes/E0508-fail.stderr deleted file mode 100644 index fcfac399e0df5..0000000000000 --- a/tests/ui/error-codes/E0508-fail.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array - --> $DIR/E0508-fail.rs:5:18 - | -LL | let _value = array[0]; - | ^^^^^^^^ - | | - | cannot move out of here - | move occurs because `array[_]` has type `NonCopy`, which does not implement the `Copy` trait - | -note: if `NonCopy` implemented `Clone`, you could clone the value - --> $DIR/E0508-fail.rs:1:1 - | -LL | struct NonCopy; - | ^^^^^^^^^^^^^^ consider implementing `Clone` for this type -... -LL | let _value = array[0]; - | -------- you could clone this value -help: consider borrowing here - | -LL | let _value = &array[0]; - | + - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0508`. diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs index 00de48278b27c..16039f177b4de 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs +++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs @@ -1,8 +1,13 @@ -struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 } +// Regression test for #91831 -fn foo(mut y: Ref, x: &u32) { - y.b = x; - //~^ ERROR lifetime may not live long enough +struct Foo<'a>(&'a i32); + +impl<'a> Foo<'a> { + fn modify(&'a mut self) {} +} + +fn bar(foo: &mut Foo) { + foo.modify(); //~ ERROR lifetime may not live long enough } -fn main() { } +fn main() {} diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr index d07b821444ccc..02c0658ff1730 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr @@ -1,17 +1,20 @@ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:4:5 + --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:10:5 | -LL | fn foo(mut y: Ref, x: &u32) { - | ----- - let's call the lifetime of this reference `'1` +LL | fn bar(foo: &mut Foo) { + | --- - let's call the lifetime of this reference `'1` | | - | has type `Ref<'_, '2>` -LL | y.b = x; - | ^^^^^^^ assignment requires that `'1` must outlive `'2` + | has type `&mut Foo<'2>` +LL | foo.modify(); + | ^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` | + = note: requirement occurs because of a mutable reference to `Foo<'_>` + = note: mutable references are invariant over their type parameter + = help: see for more information about variance help: consider introducing a named lifetime parameter | -LL | fn foo<'a>(mut y: Ref<'a, 'a>, x: &'a u32) { - | ++++ ++++++++ ++ +LL | fn bar<'a>(foo: &'a mut Foo<'a>) { + | ++++ ++ ++++ error: aborting due to 1 previous error diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-5.rs b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-5.rs deleted file mode 100644 index 16039f177b4de..0000000000000 --- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-5.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Regression test for #91831 - -struct Foo<'a>(&'a i32); - -impl<'a> Foo<'a> { - fn modify(&'a mut self) {} -} - -fn bar(foo: &mut Foo) { - foo.modify(); //~ ERROR lifetime may not live long enough -} - -fn main() {} diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-5.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-5.stderr deleted file mode 100644 index f02b65230b6eb..0000000000000 --- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-5.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-one-is-struct-5.rs:10:5 - | -LL | fn bar(foo: &mut Foo) { - | --- - let's call the lifetime of this reference `'1` - | | - | has type `&mut Foo<'2>` -LL | foo.modify(); - | ^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` - | - = note: requirement occurs because of a mutable reference to `Foo<'_>` - = note: mutable references are invariant over their type parameter - = help: see for more information about variance -help: consider introducing a named lifetime parameter - | -LL | fn bar<'a>(foo: &'a mut Foo<'a>) { - | ++++ ++ ++++ - -error: aborting due to 1 previous error - diff --git a/tests/ui/lint/auxiliary/stability_cfg2.rs b/tests/ui/lint/auxiliary/stability_cfg2.rs deleted file mode 100644 index ed69d26a9cb1e..0000000000000 --- a/tests/ui/lint/auxiliary/stability_cfg2.rs +++ /dev/null @@ -1,5 +0,0 @@ -//@ compile-flags:--cfg foo - -#![cfg_attr(foo, unstable(feature = "unstable_test_feature", issue = "none"))] -#![cfg_attr(not(foo), stable(feature = "test_feature", since = "1.0.0"))] -#![feature(staged_api)] diff --git a/tests/ui/parser/issues/issue-1802-2.rs b/tests/ui/parser/issues/issue-1802-2.rs deleted file mode 100644 index 3c34b0d8febbc..0000000000000 --- a/tests/ui/parser/issues/issue-1802-2.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn log(a: i32, b: i32) {} - -fn main() { - let error = 42; - log(error, 0b); - //~^ ERROR no valid digits found for number -} diff --git a/tests/ui/parser/issues/issue-1802-2.stderr b/tests/ui/parser/issues/issue-1802-2.stderr deleted file mode 100644 index 7c802e4bdf7b6..0000000000000 --- a/tests/ui/parser/issues/issue-1802-2.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0768]: no valid digits found for number - --> $DIR/issue-1802-2.rs:5:16 - | -LL | log(error, 0b); - | ^^ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0768`. diff --git a/tests/ui/tool-attributes/tool_lints_2018_preview.rs b/tests/ui/tool-attributes/tool_lints_2018_preview.rs deleted file mode 100644 index 458eca19ed6c7..0000000000000 --- a/tests/ui/tool-attributes/tool_lints_2018_preview.rs +++ /dev/null @@ -1,6 +0,0 @@ -//@ run-pass - -#![deny(unknown_lints)] - -#[allow(clippy::almost_swapped)] -fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-58951-2.rs b/tests/ui/type-alias-impl-trait/issue-58951-2.rs deleted file mode 100644 index de6b9e741198b..0000000000000 --- a/tests/ui/type-alias-impl-trait/issue-58951-2.rs +++ /dev/null @@ -1,16 +0,0 @@ -//@ check-pass - -#![feature(type_alias_impl_trait)] - -pub type A = impl Iterator; - -#[define_opaque(A)] -pub fn def_a() -> A { - 0..1 -} - -pub fn use_a() { - def_a().map(|x| x); -} - -fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-74761-2.rs b/tests/ui/type-alias-impl-trait/issue-74761-2.rs deleted file mode 100644 index e556025adee6e..0000000000000 --- a/tests/ui/type-alias-impl-trait/issue-74761-2.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![feature(impl_trait_in_assoc_type)] - -pub trait A { - type B; - fn f(&self) -> Self::B; -} -impl<'a, 'b> A for () { - //~^ ERROR the lifetime parameter `'a` is not constrained - //~| ERROR the lifetime parameter `'b` is not constrained - type B = impl core::fmt::Debug; - - fn f(&self) -> Self::B {} - //~^ ERROR expected generic lifetime parameter -} - -fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-74761-2.stderr b/tests/ui/type-alias-impl-trait/issue-74761-2.stderr deleted file mode 100644 index 26babc29000c0..0000000000000 --- a/tests/ui/type-alias-impl-trait/issue-74761-2.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-74761-2.rs:7:6 - | -LL | impl<'a, 'b> A for () { - | ^^ unconstrained lifetime parameter - -error[E0207]: the lifetime parameter `'b` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-74761-2.rs:7:10 - | -LL | impl<'a, 'b> A for () { - | ^^ unconstrained lifetime parameter - -error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/issue-74761-2.rs:12:28 - | -LL | impl<'a, 'b> A for () { - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | fn f(&self) -> Self::B {} - | ^^ - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0207, E0792. -For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/unsized-locals/issue-30276-feature-flagged.rs b/tests/ui/unsized-locals/issue-30276-feature-flagged.rs deleted file mode 100644 index 6b67ebbec1c0c..0000000000000 --- a/tests/ui/unsized-locals/issue-30276-feature-flagged.rs +++ /dev/null @@ -1,6 +0,0 @@ -struct Test([i32]); - -fn main() { - let _x: fn(_) -> Test = Test; - //~^ ERROR the size for values of type `[i32]` cannot be known at compilation time -} diff --git a/tests/ui/unsized-locals/issue-30276-feature-flagged.stderr b/tests/ui/unsized-locals/issue-30276-feature-flagged.stderr deleted file mode 100644 index a7bf27a0c4acc..0000000000000 --- a/tests/ui/unsized-locals/issue-30276-feature-flagged.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0277]: the size for values of type `[i32]` cannot be known at compilation time - --> $DIR/issue-30276-feature-flagged.rs:4:29 - | -LL | let _x: fn(_) -> Test = Test; - | ^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `[i32]` - = note: all function arguments must have a statically known size - = help: unsized fn params are gated as an unstable feature - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. From 81fcec33da58dcc247f35287bf773061e46f1511 Mon Sep 17 00:00:00 2001 From: Walnut <39544927+Walnut356@users.noreply.github.com> Date: Sun, 6 Sep 2026 05:28:04 -0500 Subject: [PATCH 5/5] use `#[repr(C)]` on debuginfo test structs --- tests/debuginfo/associated-types.rs | 1 + tests/debuginfo/boxed-struct.rs | 2 ++ tests/debuginfo/c-style-enum-in-composite.rs | 6 +++++- tests/debuginfo/destructured-for-loop-variable.rs | 3 +++ tests/debuginfo/evec-in-struct.rs | 4 ++++ tests/debuginfo/packed-struct-with-destructor.rs | 14 +++++++++----- tests/debuginfo/packed-struct.rs | 8 +++++--- tests/debuginfo/simple-struct.rs | 6 ++++++ tests/debuginfo/struct-in-struct.rs | 7 +++++++ tests/debuginfo/struct-with-destructor.rs | 4 ++++ tests/debuginfo/vec-slices.rs | 1 + 11 files changed, 47 insertions(+), 9 deletions(-) diff --git a/tests/debuginfo/associated-types.rs b/tests/debuginfo/associated-types.rs index f61e76cbe5997..1f07c0e29dea1 100644 --- a/tests/debuginfo/associated-types.rs +++ b/tests/debuginfo/associated-types.rs @@ -82,6 +82,7 @@ impl TraitWithAssocType for i32 { fn get_value(&self) -> i64 { *self as i64 } } +#[repr(C)] struct Struct { b: T, b1: T::Type, diff --git a/tests/debuginfo/boxed-struct.rs b/tests/debuginfo/boxed-struct.rs index 03897177959eb..9d2460639805f 100644 --- a/tests/debuginfo/boxed-struct.rs +++ b/tests/debuginfo/boxed-struct.rs @@ -25,6 +25,7 @@ #![allow(unused_variables)] +#[repr(C)] struct StructWithSomePadding { x: i16, y: i32, @@ -32,6 +33,7 @@ struct StructWithSomePadding { w: i64 } +#[repr(C)] struct StructWithDestructor { x: i16, y: i32, diff --git a/tests/debuginfo/c-style-enum-in-composite.rs b/tests/debuginfo/c-style-enum-in-composite.rs index 6839c07cd55a5..6ae3c3bcdd572 100644 --- a/tests/debuginfo/c-style-enum-in-composite.rs +++ b/tests/debuginfo/c-style-enum-in-composite.rs @@ -57,18 +57,21 @@ use self::AnEnum::{OneHundred, OneThousand, OneMillion}; use self::AnotherEnum::{MountainView, Toronto, Vienna}; +#[repr(u32)] enum AnEnum { OneHundred = 100, OneThousand = 1000, OneMillion = 1000000 } +#[repr(u8)] enum AnotherEnum { MountainView, Toronto, Vienna } +#[repr(C)] struct PaddedStruct { a: i16, b: AnEnum, @@ -77,7 +80,7 @@ struct PaddedStruct { e: i16 } -#[repr(packed)] +#[repr(C, packed)] struct PackedStruct { a: i16, b: AnEnum, @@ -86,6 +89,7 @@ struct PackedStruct { e: i16 } +#[repr(C)] struct NonPaddedStruct { a: AnEnum, b: AnotherEnum, diff --git a/tests/debuginfo/destructured-for-loop-variable.rs b/tests/debuginfo/destructured-for-loop-variable.rs index b8cde881b9ce6..13395f5e407a4 100644 --- a/tests/debuginfo/destructured-for-loop-variable.rs +++ b/tests/debuginfo/destructured-for-loop-variable.rs @@ -73,6 +73,8 @@ // === LLDB TESTS ================================================================================== //@ lldb-command:type format add --format hex char +// MSVC uses signed char +//@ lldb-command:type format add --format hex 'signed char' //@ lldb-command:type format add --format hex 'unsigned char' //@ lldb-command:run @@ -144,6 +146,7 @@ #![allow(unused_variables)] #![feature(deref_patterns)] +#[repr(C)] struct Struct { x: i16, y: f32, diff --git a/tests/debuginfo/evec-in-struct.rs b/tests/debuginfo/evec-in-struct.rs index 44e7d359d81ec..646091d5f3c1a 100644 --- a/tests/debuginfo/evec-in-struct.rs +++ b/tests/debuginfo/evec-in-struct.rs @@ -41,17 +41,20 @@ #![allow(unused_variables)] +#[repr(C)] struct NoPadding1 { x: [u32; 3], y: i32, z: [f32; 2] } +#[repr(C)] struct NoPadding2 { x: [u32; 3], y: [[u32; 2]; 2] } +#[repr(C)] struct StructInternalPadding { x: [i16; 2], y: [i64; 2] @@ -61,6 +64,7 @@ struct SingleVec { x: [i16; 5] } +#[repr(C)] struct StructPaddedAtEnd { x: [i64; 2], y: [i16; 2] diff --git a/tests/debuginfo/packed-struct-with-destructor.rs b/tests/debuginfo/packed-struct-with-destructor.rs index 59fc3d3ca15c2..9cb4c4ada03da 100644 --- a/tests/debuginfo/packed-struct-with-destructor.rs +++ b/tests/debuginfo/packed-struct-with-destructor.rs @@ -63,7 +63,7 @@ #![allow(unused_variables)] -#[repr(packed)] +#[repr(C, packed)] struct Packed { x: i16, y: i32, @@ -74,7 +74,7 @@ impl Drop for Packed { fn drop(&mut self) {} } -#[repr(packed)] +#[repr(C, packed)] struct PackedInPacked { a: i32, b: Packed, @@ -82,6 +82,7 @@ struct PackedInPacked { d: Packed } +#[repr(C)] struct PackedInUnpacked { a: i32, b: Packed, @@ -89,6 +90,7 @@ struct PackedInUnpacked { d: Packed } +#[repr(C)] struct Unpacked { x: i64, y: i32, @@ -99,7 +101,7 @@ impl Drop for Unpacked { fn drop(&mut self) {} } -#[repr(packed)] +#[repr(C, packed)] struct UnpackedInPacked { a: i16, b: Unpacked, @@ -107,7 +109,7 @@ struct UnpackedInPacked { d: i64 } -#[repr(packed)] +#[repr(C, packed)] struct PackedInPackedWithDrop { a: i32, b: Packed, @@ -119,6 +121,7 @@ impl Drop for PackedInPackedWithDrop { fn drop(&mut self) {} } +#[repr(C)] struct PackedInUnpackedWithDrop { a: i32, b: Packed, @@ -130,7 +133,7 @@ impl Drop for PackedInUnpackedWithDrop { fn drop(&mut self) {} } -#[repr(packed)] +#[repr(C, packed)] struct UnpackedInPackedWithDrop { a: i16, b: Unpacked, @@ -142,6 +145,7 @@ impl Drop for UnpackedInPackedWithDrop { fn drop(&mut self) {} } +#[repr(C)] struct DeeplyNested { a: PackedInPacked, b: UnpackedInPackedWithDrop, diff --git a/tests/debuginfo/packed-struct.rs b/tests/debuginfo/packed-struct.rs index e601ac1ffc6a2..f2e08fac063f6 100644 --- a/tests/debuginfo/packed-struct.rs +++ b/tests/debuginfo/packed-struct.rs @@ -49,14 +49,14 @@ #![allow(unused_variables)] -#[repr(packed)] +#[repr(C, packed)] struct Packed { x: i16, y: i32, z: i64 } -#[repr(packed)] +#[repr(C, packed)] struct PackedInPacked { a: i32, b: Packed, @@ -64,6 +64,7 @@ struct PackedInPacked { d: Packed } +#[repr(C)] // layout (64 bit): aaaa bbbb bbbb bbbb bb.. .... cccc cccc dddd dddd dddd dd.. struct PackedInUnpacked { a: i32, @@ -72,6 +73,7 @@ struct PackedInUnpacked { d: Packed } +#[repr(C)] // layout (64 bit): xx.. yyyy zz.. .... wwww wwww struct Unpacked { x: i16, @@ -81,7 +83,7 @@ struct Unpacked { } // layout (64 bit): aabb bbbb bbbb bbbb bbbb bbbb bbcc cccc cccc cccc cccc cccc ccdd dddd dd -#[repr(packed)] +#[repr(C, packed)] struct UnpackedInPacked { a: i16, b: Unpacked, diff --git a/tests/debuginfo/simple-struct.rs b/tests/debuginfo/simple-struct.rs index fe42e9d1421f1..5b3941452685c 100644 --- a/tests/debuginfo/simple-struct.rs +++ b/tests/debuginfo/simple-struct.rs @@ -87,23 +87,27 @@ #![allow(unused_variables)] #![allow(dead_code)] +#[repr(C)] struct NoPadding16 { x: u16, y: i16 } +#[repr(C)] struct NoPadding32 { x: i32, y: f32, z: u32 } +#[repr(C)] struct NoPadding64 { x: f64, y: i64, z: u64 } +#[repr(C)] struct NoPadding163264 { a: i16, b: u16, @@ -111,11 +115,13 @@ struct NoPadding163264 { d: u64 } +#[repr(C)] struct InternalPadding { x: u16, y: i64 } +#[repr(C)] struct PaddingAtEnd { x: i64, y: u16 diff --git a/tests/debuginfo/struct-in-struct.rs b/tests/debuginfo/struct-in-struct.rs index 8b7ceb0c7aa29..f4357292b6c67 100644 --- a/tests/debuginfo/struct-in-struct.rs +++ b/tests/debuginfo/struct-in-struct.rs @@ -50,34 +50,40 @@ struct Simple { x: i32 } +#[repr(C)] struct InternalPadding { x: i32, y: i64 } +#[repr(C)] struct PaddingAtEnd { x: i64, y: i32 } +#[repr(C)] struct ThreeSimpleStructs { x: Simple, y: Simple, z: Simple } +#[repr(C)] struct InternalPaddingParent { x: InternalPadding, y: InternalPadding, z: InternalPadding } +#[repr(C)] struct PaddingAtEndParent { x: PaddingAtEnd, y: PaddingAtEnd, z: PaddingAtEnd } +#[repr(C)] struct Mixed { x: PaddingAtEnd, y: InternalPadding, @@ -97,6 +103,7 @@ struct ThatsJustOverkill { x: BagInBag } +#[repr(C)] struct Tree { x: Simple, y: InternalPaddingParent, diff --git a/tests/debuginfo/struct-with-destructor.rs b/tests/debuginfo/struct-with-destructor.rs index a0ada74bc2f8f..0872d3501de26 100644 --- a/tests/debuginfo/struct-with-destructor.rs +++ b/tests/debuginfo/struct-with-destructor.rs @@ -35,11 +35,13 @@ #![allow(unused_variables)] +#[repr(C)] struct NoDestructor { x: i32, y: i64 } +#[repr(C)] struct WithDestructor { x: i32, y: i64 @@ -49,11 +51,13 @@ impl Drop for WithDestructor { fn drop(&mut self) {} } +#[repr(C)] struct NoDestructorGuarded { a: NoDestructor, guard: i64 } +#[repr(C)] struct WithDestructorGuarded { a: WithDestructor, guard: i64 diff --git a/tests/debuginfo/vec-slices.rs b/tests/debuginfo/vec-slices.rs index b5e626854ae3c..1657e55c1cfdc 100644 --- a/tests/debuginfo/vec-slices.rs +++ b/tests/debuginfo/vec-slices.rs @@ -74,6 +74,7 @@ #![allow(dead_code, unused_variables)] +#[repr(C)] struct AStruct { x: i16, y: i32,