From df25df1af84487b9ce9e793834e91bbf1485cecf Mon Sep 17 00:00:00 2001 From: EFanZh Date: Sat, 27 Dec 2025 12:29:19 +0800 Subject: [PATCH 1/7] Constify `fmt::from_fn` --- library/core/src/fmt/builders.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/core/src/fmt/builders.rs b/library/core/src/fmt/builders.rs index 197cddd3fa9d..7550dac45cd0 100644 --- a/library/core/src/fmt/builders.rs +++ b/library/core/src/fmt/builders.rs @@ -1227,8 +1227,9 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { /// assert_eq!(format!("{:?}", wrapped), "'a'"); /// ``` #[stable(feature = "fmt_from_fn", since = "1.93.0")] +#[rustc_const_stable(feature = "const_fmt_from_fn", since = "CURRENT_RUSTC_VERSION")] #[must_use = "returns a type implementing Debug and Display, which do not have any effects unless they are used"] -pub fn from_fn) -> fmt::Result>(f: F) -> FromFn { +pub const fn from_fn) -> fmt::Result>(f: F) -> FromFn { FromFn(f) } From cd6c41283838023ee3b22709106d666869ec9a6f Mon Sep 17 00:00:00 2001 From: Zachary S Date: Tue, 13 Jan 2026 22:40:12 -0600 Subject: [PATCH 2/7] Add test for feature-gating `mut ref` patterns in struct field shorthand. --- tests/ui/feature-gates/feature-gate-mut-ref.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/ui/feature-gates/feature-gate-mut-ref.rs b/tests/ui/feature-gates/feature-gate-mut-ref.rs index 752ae35d8a9a..eac2a59002e2 100644 --- a/tests/ui/feature-gates/feature-gate-mut-ref.rs +++ b/tests/ui/feature-gates/feature-gate-mut-ref.rs @@ -10,4 +10,7 @@ fn main() { let mut ref x = 10; //~ ERROR [E0658] #[cfg(false)] let mut ref mut y = 10; //~ ERROR [E0658] + + struct Foo { x: i32 } + let Foo { mut ref x } = Foo { x: 10 }; } From f809e332d895bc80d28d8d2cb10297a3fe9ca4f2 Mon Sep 17 00:00:00 2001 From: Zachary S Date: Tue, 13 Jan 2026 12:57:04 -0600 Subject: [PATCH 3/7] Feature-gate `mut ref` patterns in struct field shorthand. --- compiler/rustc_parse/src/parser/pat.rs | 6 ++++++ tests/ui/feature-gates/feature-gate-mut-ref.rs | 2 +- tests/ui/feature-gates/feature-gate-mut-ref.stderr | 12 +++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index d7f3a36122e5..f3e12d48a6a5 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -1750,6 +1750,12 @@ impl<'a> Parser<'a> { hi = self.prev_token.span; let ann = BindingMode(by_ref, mutability); let fieldpat = self.mk_pat_ident(boxed_span.to(hi), ann, fieldname); + if matches!( + fieldpat.kind, + PatKind::Ident(BindingMode(ByRef::Yes(..), Mutability::Mut), ..) + ) { + self.psess.gated_spans.gate(sym::mut_ref, fieldpat.span); + } let subpat = if is_box { self.mk_pat(lo.to(hi), PatKind::Box(Box::new(fieldpat))) } else { diff --git a/tests/ui/feature-gates/feature-gate-mut-ref.rs b/tests/ui/feature-gates/feature-gate-mut-ref.rs index eac2a59002e2..74b1fba5dfea 100644 --- a/tests/ui/feature-gates/feature-gate-mut-ref.rs +++ b/tests/ui/feature-gates/feature-gate-mut-ref.rs @@ -12,5 +12,5 @@ fn main() { let mut ref mut y = 10; //~ ERROR [E0658] struct Foo { x: i32 } - let Foo { mut ref x } = Foo { x: 10 }; + let Foo { mut ref x } = Foo { x: 10 }; //~ ERROR [E0658] } diff --git a/tests/ui/feature-gates/feature-gate-mut-ref.stderr b/tests/ui/feature-gates/feature-gate-mut-ref.stderr index d3eb674e92de..921ff878bf4d 100644 --- a/tests/ui/feature-gates/feature-gate-mut-ref.stderr +++ b/tests/ui/feature-gates/feature-gate-mut-ref.stderr @@ -38,6 +38,16 @@ LL | let mut ref mut y = 10; = help: add `#![feature(mut_ref)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: aborting due to 4 previous errors +error[E0658]: mutable by-reference bindings are experimental + --> $DIR/feature-gate-mut-ref.rs:15:15 + | +LL | let Foo { mut ref x } = Foo { x: 10 }; + | ^^^^^^^^^ + | + = note: see issue #123076 for more information + = help: add `#![feature(mut_ref)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0658`. From 91feb76d941592145238eda59e73be25fd191af3 Mon Sep 17 00:00:00 2001 From: yukang Date: Fri, 30 Jan 2026 08:56:56 +0000 Subject: [PATCH 4/7] Skip unused_allocation lint when method takes &Box --- compiler/rustc_lint/src/unused.rs | 8 ++- .../unused-allocation-box-ref-issue-151846.rs | 54 +++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 tests/ui/lint/unused/unused-allocation-box-ref-issue-151846.rs diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs index 5516298c5e85..8b630d0d7385 100644 --- a/compiler/rustc_lint/src/unused.rs +++ b/compiler/rustc_lint/src/unused.rs @@ -1782,7 +1782,7 @@ declare_lint! { declare_lint_pass!(UnusedAllocation => [UNUSED_ALLOCATION]); impl<'tcx> LateLintPass<'tcx> for UnusedAllocation { - fn check_expr(&mut self, cx: &LateContext<'_>, e: &hir::Expr<'_>) { + fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &hir::Expr<'_>) { match e.kind { hir::ExprKind::Call(path_expr, [_]) if let hir::ExprKind::Path(qpath) = &path_expr.kind @@ -1793,6 +1793,12 @@ impl<'tcx> LateLintPass<'tcx> for UnusedAllocation { for adj in cx.typeck_results().expr_adjustments(e) { if let adjustment::Adjust::Borrow(adjustment::AutoBorrow::Ref(m)) = adj.kind { + if let ty::Ref(_, inner_ty, _) = adj.target.kind() + && inner_ty.is_box() + { + // If the target type is `&Box` or `&mut Box`, the allocation is necessary + continue; + } match m { adjustment::AutoBorrowMutability::Not => { cx.emit_span_lint(UNUSED_ALLOCATION, e.span, UnusedAllocationDiag); diff --git a/tests/ui/lint/unused/unused-allocation-box-ref-issue-151846.rs b/tests/ui/lint/unused/unused-allocation-box-ref-issue-151846.rs new file mode 100644 index 000000000000..57eefc3891fa --- /dev/null +++ b/tests/ui/lint/unused/unused-allocation-box-ref-issue-151846.rs @@ -0,0 +1,54 @@ +//@ check-pass +// Test for issue #151846: unused_allocation warning should ignore +// allocations to pass Box to things taking self: &Box + +#![deny(unused_allocation)] + +struct MyStruct; + +trait TraitTakesBoxRef { + fn trait_takes_box_ref(&self); +} + +impl TraitTakesBoxRef for Box { + fn trait_takes_box_ref(&self) {} +} + +impl MyStruct { + fn inherent_takes_box_ref(self: &Box) {} +} + +fn takes_box_ref(_: &Box) {} + +trait TraitTakesBoxVal { + fn trait_takes_box_val(self); +} + +impl TraitTakesBoxVal for Box { + fn trait_takes_box_val(self) {} +} + +impl MyStruct { + fn inherent_takes_box_val(self: Box) {} +} + +fn takes_box_val(_: Box) {} + +pub fn foo() { + // These should NOT warn - the allocation is necessary because + // the method takes &Box + Box::new(MyStruct).trait_takes_box_ref(); + Box::new(MyStruct).inherent_takes_box_ref(); + takes_box_ref(&Box::new(MyStruct)); + + // These already don't warn - the allocation is necessary + Box::new(MyStruct).trait_takes_box_val(); + Box::new(MyStruct).inherent_takes_box_val(); + takes_box_val(Box::new(MyStruct)); + + // Fully-qualified syntax also does not warn: + as TraitTakesBoxRef>::trait_takes_box_ref(&Box::new(MyStruct)); + MyStruct::inherent_takes_box_ref(&Box::new(MyStruct)); +} + +fn main() {} From 04e6afe20a6b5ea3b1a0e17a25df486c43a66df4 Mon Sep 17 00:00:00 2001 From: Zalathar Date: Mon, 26 Jan 2026 14:15:15 +1100 Subject: [PATCH 5/7] Re-export `hashbrown::hash_table` from `rustc_data_structures` --- Cargo.lock | 2 -- compiler/rustc_data_structures/src/lib.rs | 4 ++++ compiler/rustc_data_structures/src/sharded.rs | 4 ++-- compiler/rustc_mir_transform/Cargo.toml | 1 - compiler/rustc_mir_transform/src/gvn.rs | 2 +- compiler/rustc_query_system/Cargo.toml | 5 ----- compiler/rustc_query_system/src/query/plumbing.rs | 5 ++--- 7 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6be4565374af..b63bb619b64e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4354,7 +4354,6 @@ name = "rustc_mir_transform" version = "0.0.0" dependencies = [ "either", - "hashbrown 0.16.1", "itertools", "rustc_abi", "rustc_arena", @@ -4565,7 +4564,6 @@ dependencies = [ name = "rustc_query_system" version = "0.0.0" dependencies = [ - "hashbrown 0.16.1", "parking_lot", "rustc_abi", "rustc_ast", diff --git a/compiler/rustc_data_structures/src/lib.rs b/compiler/rustc_data_structures/src/lib.rs index 85877d73519a..4467a2811181 100644 --- a/compiler/rustc_data_structures/src/lib.rs +++ b/compiler/rustc_data_structures/src/lib.rs @@ -49,6 +49,10 @@ pub use std::{assert_matches, debug_assert_matches}; pub use atomic_ref::AtomicRef; pub use ena::{snapshot_vec, undo_log, unify}; +// Re-export `hashbrown::hash_table`, because it's part of our API +// (via `ShardedHashMap`), and because it lets other compiler crates use the +// lower-level `HashTable` API without a tricky `hashbrown` dependency. +pub use hashbrown::hash_table; pub use rustc_index::static_assert_size; // Re-export some data-structure crates which are part of our public API. pub use {either, indexmap, smallvec, thin_vec}; diff --git a/compiler/rustc_data_structures/src/sharded.rs b/compiler/rustc_data_structures/src/sharded.rs index 5de9413cf15d..e10ccccad5bb 100644 --- a/compiler/rustc_data_structures/src/sharded.rs +++ b/compiler/rustc_data_structures/src/sharded.rs @@ -3,7 +3,7 @@ use std::hash::{Hash, Hasher}; use std::{iter, mem}; use either::Either; -use hashbrown::hash_table::{Entry, HashTable}; +use hashbrown::hash_table::{self, Entry, HashTable}; use crate::fx::FxHasher; use crate::sync::{CacheAligned, Lock, LockGuard, Mode, is_dyn_thread_safe}; @@ -140,7 +140,7 @@ pub fn shards() -> usize { 1 } -pub type ShardedHashMap = Sharded>; +pub type ShardedHashMap = Sharded>; impl ShardedHashMap { pub fn with_capacity(cap: usize) -> Self { diff --git a/compiler/rustc_mir_transform/Cargo.toml b/compiler/rustc_mir_transform/Cargo.toml index 22de197d374a..404531eb3c91 100644 --- a/compiler/rustc_mir_transform/Cargo.toml +++ b/compiler/rustc_mir_transform/Cargo.toml @@ -6,7 +6,6 @@ edition = "2024" [dependencies] # tidy-alphabetical-start either = "1" -hashbrown = { version = "0.16.1", default-features = false } itertools = "0.12" rustc_abi = { path = "../rustc_abi" } rustc_arena = { path = "../rustc_arena" } diff --git a/compiler/rustc_mir_transform/src/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs index 820998eed100..e06b3625aa7b 100644 --- a/compiler/rustc_mir_transform/src/gvn.rs +++ b/compiler/rustc_mir_transform/src/gvn.rs @@ -88,7 +88,6 @@ use std::borrow::Cow; use std::hash::{Hash, Hasher}; use either::Either; -use hashbrown::hash_table::{Entry, HashTable}; use itertools::Itertools as _; use rustc_abi::{self as abi, BackendRepr, FIRST_VARIANT, FieldIdx, Primitive, Size, VariantIdx}; use rustc_arena::DroplessArena; @@ -99,6 +98,7 @@ use rustc_const_eval::interpret::{ }; use rustc_data_structures::fx::FxHasher; use rustc_data_structures::graph::dominators::Dominators; +use rustc_data_structures::hash_table::{Entry, HashTable}; use rustc_hir::def::DefKind; use rustc_index::bit_set::DenseBitSet; use rustc_index::{IndexVec, newtype_index}; diff --git a/compiler/rustc_query_system/Cargo.toml b/compiler/rustc_query_system/Cargo.toml index 73ab03576dec..0ad8143c5a4f 100644 --- a/compiler/rustc_query_system/Cargo.toml +++ b/compiler/rustc_query_system/Cargo.toml @@ -23,8 +23,3 @@ rustc_thread_pool = { path = "../rustc_thread_pool" } smallvec = { version = "1.8.1", features = ["union", "may_dangle"] } tracing = "0.1" # tidy-alphabetical-end - -[dependencies.hashbrown] -version = "0.16.1" -default-features = false -features = ["nightly"] # for may_dangle diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs index 04902d0ab10c..7e34957364e4 100644 --- a/compiler/rustc_query_system/src/query/plumbing.rs +++ b/compiler/rustc_query_system/src/query/plumbing.rs @@ -7,9 +7,8 @@ use std::fmt::Debug; use std::hash::Hash; use std::mem; -use hashbrown::HashTable; -use hashbrown::hash_table::Entry; use rustc_data_structures::fingerprint::Fingerprint; +use rustc_data_structures::hash_table::{self, Entry, HashTable}; use rustc_data_structures::sharded::{self, Sharded}; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_data_structures::sync::LockGuard; @@ -35,7 +34,7 @@ fn equivalent_key(k: &K) -> impl Fn(&(K, V)) -> bool + '_ { } pub struct QueryState<'tcx, K> { - active: Sharded)>>, + active: Sharded)>>, } /// Indicates the state of a query for a given key in a query map. From 4df307acc1ff152518eab3cc142fbd0a394143e4 Mon Sep 17 00:00:00 2001 From: zedddie Date: Fri, 30 Jan 2026 16:27:13 +0100 Subject: [PATCH 6/7] move some tests --- .../associated-const-access.rs} | 0 .../issue-49824.rs => closures/nested-closure-escape-borrow.rs} | 0 .../nested-closure-escape-borrow.stderr} | 0 .../ui/{issues/issue-17651.rs => closures/unsized_value_move.rs} | 0 .../issue-17651.stderr => closures/unsized_value_move.stderr} | 0 tests/ui/{issues/issue-18767.rs => deref/deref-in-for-loop.rs} | 0 .../ui/{issues/issue-34569.rs => match/closure-in-match-guard.rs} | 0 tests/ui/{issues/issue-29740.rs => match/large-match-mir-gen.rs} | 0 .../issue-32004.rs => pattern/constructor-type-mismatch.rs} | 0 .../constructor-type-mismatch.stderr} | 0 .../{issues/issue-3038.rs => pattern/multiple-bindings-on-var.rs} | 0 .../issue-3038.stderr => pattern/multiple-bindings-on-var.stderr} | 0 .../issue-2849.rs => pattern/or-pattern-binding-mismatch.rs} | 0 .../or-pattern-binding-mismatch.stderr} | 0 .../or-pattern-mismatched-variable-and-variant.rs} | 0 .../or-pattern-mismatched-variable-and-variant.stderr} | 0 16 files changed, 0 insertions(+), 0 deletions(-) rename tests/ui/{issues/issue-31267.rs => associated-consts/associated-const-access.rs} (100%) rename tests/ui/{issues/issue-49824.rs => closures/nested-closure-escape-borrow.rs} (100%) rename tests/ui/{issues/issue-49824.stderr => closures/nested-closure-escape-borrow.stderr} (100%) rename tests/ui/{issues/issue-17651.rs => closures/unsized_value_move.rs} (100%) rename tests/ui/{issues/issue-17651.stderr => closures/unsized_value_move.stderr} (100%) rename tests/ui/{issues/issue-18767.rs => deref/deref-in-for-loop.rs} (100%) rename tests/ui/{issues/issue-34569.rs => match/closure-in-match-guard.rs} (100%) rename tests/ui/{issues/issue-29740.rs => match/large-match-mir-gen.rs} (100%) rename tests/ui/{issues/issue-32004.rs => pattern/constructor-type-mismatch.rs} (100%) rename tests/ui/{issues/issue-32004.stderr => pattern/constructor-type-mismatch.stderr} (100%) rename tests/ui/{issues/issue-3038.rs => pattern/multiple-bindings-on-var.rs} (100%) rename tests/ui/{issues/issue-3038.stderr => pattern/multiple-bindings-on-var.stderr} (100%) rename tests/ui/{issues/issue-2849.rs => pattern/or-pattern-binding-mismatch.rs} (100%) rename tests/ui/{issues/issue-2849.stderr => pattern/or-pattern-binding-mismatch.stderr} (100%) rename tests/ui/{issues/issue-2848.rs => pattern/or-pattern-mismatched-variable-and-variant.rs} (100%) rename tests/ui/{issues/issue-2848.stderr => pattern/or-pattern-mismatched-variable-and-variant.stderr} (100%) diff --git a/tests/ui/issues/issue-31267.rs b/tests/ui/associated-consts/associated-const-access.rs similarity index 100% rename from tests/ui/issues/issue-31267.rs rename to tests/ui/associated-consts/associated-const-access.rs diff --git a/tests/ui/issues/issue-49824.rs b/tests/ui/closures/nested-closure-escape-borrow.rs similarity index 100% rename from tests/ui/issues/issue-49824.rs rename to tests/ui/closures/nested-closure-escape-borrow.rs diff --git a/tests/ui/issues/issue-49824.stderr b/tests/ui/closures/nested-closure-escape-borrow.stderr similarity index 100% rename from tests/ui/issues/issue-49824.stderr rename to tests/ui/closures/nested-closure-escape-borrow.stderr diff --git a/tests/ui/issues/issue-17651.rs b/tests/ui/closures/unsized_value_move.rs similarity index 100% rename from tests/ui/issues/issue-17651.rs rename to tests/ui/closures/unsized_value_move.rs diff --git a/tests/ui/issues/issue-17651.stderr b/tests/ui/closures/unsized_value_move.stderr similarity index 100% rename from tests/ui/issues/issue-17651.stderr rename to tests/ui/closures/unsized_value_move.stderr diff --git a/tests/ui/issues/issue-18767.rs b/tests/ui/deref/deref-in-for-loop.rs similarity index 100% rename from tests/ui/issues/issue-18767.rs rename to tests/ui/deref/deref-in-for-loop.rs diff --git a/tests/ui/issues/issue-34569.rs b/tests/ui/match/closure-in-match-guard.rs similarity index 100% rename from tests/ui/issues/issue-34569.rs rename to tests/ui/match/closure-in-match-guard.rs diff --git a/tests/ui/issues/issue-29740.rs b/tests/ui/match/large-match-mir-gen.rs similarity index 100% rename from tests/ui/issues/issue-29740.rs rename to tests/ui/match/large-match-mir-gen.rs diff --git a/tests/ui/issues/issue-32004.rs b/tests/ui/pattern/constructor-type-mismatch.rs similarity index 100% rename from tests/ui/issues/issue-32004.rs rename to tests/ui/pattern/constructor-type-mismatch.rs diff --git a/tests/ui/issues/issue-32004.stderr b/tests/ui/pattern/constructor-type-mismatch.stderr similarity index 100% rename from tests/ui/issues/issue-32004.stderr rename to tests/ui/pattern/constructor-type-mismatch.stderr diff --git a/tests/ui/issues/issue-3038.rs b/tests/ui/pattern/multiple-bindings-on-var.rs similarity index 100% rename from tests/ui/issues/issue-3038.rs rename to tests/ui/pattern/multiple-bindings-on-var.rs diff --git a/tests/ui/issues/issue-3038.stderr b/tests/ui/pattern/multiple-bindings-on-var.stderr similarity index 100% rename from tests/ui/issues/issue-3038.stderr rename to tests/ui/pattern/multiple-bindings-on-var.stderr diff --git a/tests/ui/issues/issue-2849.rs b/tests/ui/pattern/or-pattern-binding-mismatch.rs similarity index 100% rename from tests/ui/issues/issue-2849.rs rename to tests/ui/pattern/or-pattern-binding-mismatch.rs diff --git a/tests/ui/issues/issue-2849.stderr b/tests/ui/pattern/or-pattern-binding-mismatch.stderr similarity index 100% rename from tests/ui/issues/issue-2849.stderr rename to tests/ui/pattern/or-pattern-binding-mismatch.stderr diff --git a/tests/ui/issues/issue-2848.rs b/tests/ui/pattern/or-pattern-mismatched-variable-and-variant.rs similarity index 100% rename from tests/ui/issues/issue-2848.rs rename to tests/ui/pattern/or-pattern-mismatched-variable-and-variant.rs diff --git a/tests/ui/issues/issue-2848.stderr b/tests/ui/pattern/or-pattern-mismatched-variable-and-variant.stderr similarity index 100% rename from tests/ui/issues/issue-2848.stderr rename to tests/ui/pattern/or-pattern-mismatched-variable-and-variant.stderr From 086dc0258bd5d12570a79f23b73ea030c0acbd00 Mon Sep 17 00:00:00 2001 From: zedddie Date: Fri, 30 Jan 2026 16:27:49 +0100 Subject: [PATCH 7/7] clean up some tests --- tests/ui/associated-consts/associated-const-access.rs | 2 +- tests/ui/closures/nested-closure-escape-borrow.rs | 1 + tests/ui/closures/nested-closure-escape-borrow.stderr | 2 +- tests/ui/closures/unsized_value_move.rs | 1 + tests/ui/closures/unsized_value_move.stderr | 2 +- tests/ui/deref/deref-in-for-loop.rs | 1 + tests/ui/match/closure-in-match-guard.rs | 1 + tests/ui/match/large-match-mir-gen.rs | 5 +++-- tests/ui/pattern/constructor-type-mismatch.rs | 1 + tests/ui/pattern/constructor-type-mismatch.stderr | 4 ++-- tests/ui/pattern/multiple-bindings-on-var.rs | 1 + tests/ui/pattern/multiple-bindings-on-var.stderr | 6 +++--- tests/ui/pattern/or-pattern-binding-mismatch.rs | 1 + tests/ui/pattern/or-pattern-binding-mismatch.stderr | 2 +- .../pattern/or-pattern-mismatched-variable-and-variant.rs | 1 + .../or-pattern-mismatched-variable-and-variant.stderr | 4 ++-- 16 files changed, 22 insertions(+), 13 deletions(-) diff --git a/tests/ui/associated-consts/associated-const-access.rs b/tests/ui/associated-consts/associated-const-access.rs index d6081bb87439..d6508d4922ae 100644 --- a/tests/ui/associated-consts/associated-const-access.rs +++ b/tests/ui/associated-consts/associated-const-access.rs @@ -1,5 +1,5 @@ +//! regression test for //@ run-pass -// Regression test for issue #31267 struct Foo; diff --git a/tests/ui/closures/nested-closure-escape-borrow.rs b/tests/ui/closures/nested-closure-escape-borrow.rs index bc1cd6856bc9..afd440ba4250 100644 --- a/tests/ui/closures/nested-closure-escape-borrow.rs +++ b/tests/ui/closures/nested-closure-escape-borrow.rs @@ -1,3 +1,4 @@ +//! regression test for fn main() { let mut x = 0; || { diff --git a/tests/ui/closures/nested-closure-escape-borrow.stderr b/tests/ui/closures/nested-closure-escape-borrow.stderr index 1c77090de27b..5a77652fa376 100644 --- a/tests/ui/closures/nested-closure-escape-borrow.stderr +++ b/tests/ui/closures/nested-closure-escape-borrow.stderr @@ -1,5 +1,5 @@ error: captured variable cannot escape `FnMut` closure body - --> $DIR/issue-49824.rs:4:9 + --> $DIR/nested-closure-escape-borrow.rs:5:9 | LL | let mut x = 0; | ----- variable defined here diff --git a/tests/ui/closures/unsized_value_move.rs b/tests/ui/closures/unsized_value_move.rs index 7629a5a3be1e..da39cc0f35f4 100644 --- a/tests/ui/closures/unsized_value_move.rs +++ b/tests/ui/closures/unsized_value_move.rs @@ -1,3 +1,4 @@ +//! regression test for // Test that moves of unsized values within closures are caught // and rejected. diff --git a/tests/ui/closures/unsized_value_move.stderr b/tests/ui/closures/unsized_value_move.stderr index 9519507320d8..a9a26a42d167 100644 --- a/tests/ui/closures/unsized_value_move.stderr +++ b/tests/ui/closures/unsized_value_move.stderr @@ -1,5 +1,5 @@ error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time - --> $DIR/issue-17651.rs:5:18 + --> $DIR/unsized_value_move.rs:6:18 | LL | (|| Box::new(*(&[0][..])))(); | -------- ^^^^^^^^^^^ doesn't have a size known at compile-time diff --git a/tests/ui/deref/deref-in-for-loop.rs b/tests/ui/deref/deref-in-for-loop.rs index 87762406da60..26921c3f1dda 100644 --- a/tests/ui/deref/deref-in-for-loop.rs +++ b/tests/ui/deref/deref-in-for-loop.rs @@ -1,3 +1,4 @@ +//! regression test for //@ run-pass // Test that regionck uses the right memcat for patterns in for loops // and doesn't ICE. diff --git a/tests/ui/match/closure-in-match-guard.rs b/tests/ui/match/closure-in-match-guard.rs index 25b2e7fbe160..c3f16dad4bfb 100644 --- a/tests/ui/match/closure-in-match-guard.rs +++ b/tests/ui/match/closure-in-match-guard.rs @@ -1,3 +1,4 @@ +//! regression test for //@ run-pass //@ compile-flags:-g diff --git a/tests/ui/match/large-match-mir-gen.rs b/tests/ui/match/large-match-mir-gen.rs index e26e2c882dc3..bb084a9ef0d0 100644 --- a/tests/ui/match/large-match-mir-gen.rs +++ b/tests/ui/match/large-match-mir-gen.rs @@ -1,7 +1,8 @@ +//! regression test for //@ check-pass #![allow(dead_code)] -// Regression test for #29740. Inefficient MIR matching algorithms -// generated way too much code for this sort of case, leading to OOM. +// Inefficient MIR matching algorithms generated way +// too much code for this sort of case, leading to OOM. #![allow(non_snake_case)] pub mod KeyboardEventConstants { diff --git a/tests/ui/pattern/constructor-type-mismatch.rs b/tests/ui/pattern/constructor-type-mismatch.rs index b3493508c5a9..77b8e5312dca 100644 --- a/tests/ui/pattern/constructor-type-mismatch.rs +++ b/tests/ui/pattern/constructor-type-mismatch.rs @@ -1,3 +1,4 @@ +//! regression test for enum Foo { Bar(i32), Baz diff --git a/tests/ui/pattern/constructor-type-mismatch.stderr b/tests/ui/pattern/constructor-type-mismatch.stderr index fcbec97661b4..6610e12cdc75 100644 --- a/tests/ui/pattern/constructor-type-mismatch.stderr +++ b/tests/ui/pattern/constructor-type-mismatch.stderr @@ -1,5 +1,5 @@ error[E0532]: expected unit struct, unit variant or constant, found tuple variant `Foo::Bar` - --> $DIR/issue-32004.rs:10:9 + --> $DIR/constructor-type-mismatch.rs:11:9 | LL | Bar(i32), | -------- `Foo::Bar` defined here @@ -20,7 +20,7 @@ LL + Foo::Baz => {} | error[E0532]: expected tuple struct or tuple variant, found unit struct `S` - --> $DIR/issue-32004.rs:16:9 + --> $DIR/constructor-type-mismatch.rs:17:9 | LL | struct S; | --------- `S` defined here diff --git a/tests/ui/pattern/multiple-bindings-on-var.rs b/tests/ui/pattern/multiple-bindings-on-var.rs index cf3ba009f00c..f84276257b67 100644 --- a/tests/ui/pattern/multiple-bindings-on-var.rs +++ b/tests/ui/pattern/multiple-bindings-on-var.rs @@ -1,3 +1,4 @@ +//! regression test for enum F { G(isize, isize) } enum H { I(J, K) } diff --git a/tests/ui/pattern/multiple-bindings-on-var.stderr b/tests/ui/pattern/multiple-bindings-on-var.stderr index 210da2ceff9b..c2ec11c43465 100644 --- a/tests/ui/pattern/multiple-bindings-on-var.stderr +++ b/tests/ui/pattern/multiple-bindings-on-var.stderr @@ -1,17 +1,17 @@ error[E0416]: identifier `x` is bound more than once in the same pattern - --> $DIR/issue-3038.rs:12:15 + --> $DIR/multiple-bindings-on-var.rs:13:15 | LL | F::G(x, x) => { println!("{}", x + x); } | ^ used in a pattern more than once error[E0416]: identifier `x` is bound more than once in the same pattern - --> $DIR/issue-3038.rs:17:32 + --> $DIR/multiple-bindings-on-var.rs:18:32 | LL | H::I(J::L(x, _), K::M(_, x)) | ^ used in a pattern more than once error[E0416]: identifier `x` is bound more than once in the same pattern - --> $DIR/issue-3038.rs:23:13 + --> $DIR/multiple-bindings-on-var.rs:24:13 | LL | (x, x) => { x } | ^ used in a pattern more than once diff --git a/tests/ui/pattern/or-pattern-binding-mismatch.rs b/tests/ui/pattern/or-pattern-binding-mismatch.rs index 787ab0e28960..a207c3f81899 100644 --- a/tests/ui/pattern/or-pattern-binding-mismatch.rs +++ b/tests/ui/pattern/or-pattern-binding-mismatch.rs @@ -1,3 +1,4 @@ +//! regression test for enum Foo { Alpha, Beta(isize) } fn main() { diff --git a/tests/ui/pattern/or-pattern-binding-mismatch.stderr b/tests/ui/pattern/or-pattern-binding-mismatch.stderr index ef5cdb42e610..46984fac03ce 100644 --- a/tests/ui/pattern/or-pattern-binding-mismatch.stderr +++ b/tests/ui/pattern/or-pattern-binding-mismatch.stderr @@ -1,5 +1,5 @@ error[E0408]: variable `i` is not bound in all patterns - --> $DIR/issue-2849.rs:5:7 + --> $DIR/or-pattern-binding-mismatch.rs:6:7 | LL | Foo::Alpha | Foo::Beta(i) => {} | ^^^^^^^^^^ - variable not in all patterns diff --git a/tests/ui/pattern/or-pattern-mismatched-variable-and-variant.rs b/tests/ui/pattern/or-pattern-mismatched-variable-and-variant.rs index 8499459cec26..0447fd2ad589 100644 --- a/tests/ui/pattern/or-pattern-mismatched-variable-and-variant.rs +++ b/tests/ui/pattern/or-pattern-mismatched-variable-and-variant.rs @@ -1,3 +1,4 @@ +//! regression test for #[allow(non_camel_case_types)] mod bar { diff --git a/tests/ui/pattern/or-pattern-mismatched-variable-and-variant.stderr b/tests/ui/pattern/or-pattern-mismatched-variable-and-variant.stderr index 1cef27c34635..66c7d7d348c9 100644 --- a/tests/ui/pattern/or-pattern-mismatched-variable-and-variant.stderr +++ b/tests/ui/pattern/or-pattern-mismatched-variable-and-variant.stderr @@ -1,5 +1,5 @@ error[E0408]: variable `beta` is not bound in all patterns - --> $DIR/issue-2848.rs:14:7 + --> $DIR/or-pattern-mismatched-variable-and-variant.rs:15:7 | LL | alpha | beta => {} | ^^^^^ ---- variable not in all patterns @@ -7,7 +7,7 @@ LL | alpha | beta => {} | pattern doesn't bind `beta` error[E0170]: pattern binding `beta` is named the same as one of the variants of the type `bar::foo` - --> $DIR/issue-2848.rs:14:15 + --> $DIR/or-pattern-mismatched-variable-and-variant.rs:15:15 | LL | alpha | beta => {} | ^^^^ help: to match on the variant, qualify the path: `bar::foo::beta`