From b6643862e8227fcf07416989945e283b141ec165 Mon Sep 17 00:00:00 2001 From: lcnr Date: Tue, 23 Sep 2025 08:25:07 +0200 Subject: [PATCH 1/8] yeet fastpath (cherry picked from commit 4fcafc9daad24e5811546896b80e4e18578bf9f3) --- compiler/rustc_trait_selection/src/infer.rs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/compiler/rustc_trait_selection/src/infer.rs b/compiler/rustc_trait_selection/src/infer.rs index 4c50c44b84182..cd076d1cb692a 100644 --- a/compiler/rustc_trait_selection/src/infer.rs +++ b/compiler/rustc_trait_selection/src/infer.rs @@ -9,7 +9,7 @@ use rustc_middle::infer::canonical::{ Canonical, CanonicalQueryInput, CanonicalQueryResponse, QueryResponse, }; use rustc_middle::traits::query::NoSolution; -use rustc_middle::ty::{self, GenericArg, Ty, TyCtxt, TypeFoldable, TypeVisitableExt, Upcast}; +use rustc_middle::ty::{self, GenericArg, Ty, TyCtxt, TypeFoldable, Upcast}; use rustc_span::DUMMY_SP; use tracing::instrument; @@ -31,19 +31,7 @@ impl<'tcx> InferCtxt<'tcx> { fn type_is_copy_modulo_regions(&self, param_env: ty::ParamEnv<'tcx>, ty: Ty<'tcx>) -> bool { let ty = self.resolve_vars_if_possible(ty); - - // FIXME(#132279): This should be removed as it causes us to incorrectly - // handle opaques in their defining scope, and stalled coroutines. - if !self.next_trait_solver() && !(param_env, ty).has_infer() && !ty.has_coroutines() { - return self.tcx.type_is_copy_modulo_regions(self.typing_env(param_env), ty); - } - let copy_def_id = self.tcx.require_lang_item(LangItem::Copy, DUMMY_SP); - - // This can get called from typeck (by euv), and `moves_by_default` - // rightly refuses to work with inference variables, but - // moves_by_default has a cache, which we want to use in other - // cases. traits::type_known_to_meet_bound_modulo_regions(self, param_env, ty, copy_def_id) } From dad01bc9a8f205b9f18de05c886dacdf2a97fc1c Mon Sep 17 00:00:00 2001 From: lcnr Date: Tue, 23 Sep 2025 17:08:29 +0200 Subject: [PATCH 2/8] remove test for no_core (cherry picked from commit 83532f8544e18dfc2025ab33e7c01fb27865667f) --- .../missing-copy-lang-item-issue-19660.rs | 19 ------------------- .../missing-copy-lang-item-issue-19660.stderr | 8 -------- 2 files changed, 27 deletions(-) delete mode 100644 tests/ui/lang-items/missing-copy-lang-item-issue-19660.rs delete mode 100644 tests/ui/lang-items/missing-copy-lang-item-issue-19660.stderr diff --git a/tests/ui/lang-items/missing-copy-lang-item-issue-19660.rs b/tests/ui/lang-items/missing-copy-lang-item-issue-19660.rs deleted file mode 100644 index 35d5d079c6894..0000000000000 --- a/tests/ui/lang-items/missing-copy-lang-item-issue-19660.rs +++ /dev/null @@ -1,19 +0,0 @@ -#![feature(lang_items, no_core)] -#![no_core] -#![no_main] - -#[lang = "pointee_sized"] -pub trait PointeeSized {} - -#[lang = "meta_sized"] -pub trait MetaSized: PointeeSized {} - -#[lang = "sized"] -trait Sized: MetaSized { } - -struct S; - -#[no_mangle] -extern "C" fn main(argc: i32, _argv: *const *const u8) -> i32 { - argc //~ ERROR requires `copy` lang_item -} diff --git a/tests/ui/lang-items/missing-copy-lang-item-issue-19660.stderr b/tests/ui/lang-items/missing-copy-lang-item-issue-19660.stderr deleted file mode 100644 index 7b9541f734fa8..0000000000000 --- a/tests/ui/lang-items/missing-copy-lang-item-issue-19660.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: requires `copy` lang_item - --> $DIR/missing-copy-lang-item-issue-19660.rs:18:5 - | -LL | argc - | ^^^^ - -error: aborting due to 1 previous error - From 34182f6e7da548606231dd6a81cb4b36c6da5fe6 Mon Sep 17 00:00:00 2001 From: lcnr Date: Wed, 24 Sep 2025 15:02:41 +0200 Subject: [PATCH 3/8] add test (cherry picked from commit 7a0adc08786df857e810c9f6a5a0cb6cae32659b) --- .../coroutine/copy-fast-path-query-cycle.rs | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/ui/coroutine/copy-fast-path-query-cycle.rs diff --git a/tests/ui/coroutine/copy-fast-path-query-cycle.rs b/tests/ui/coroutine/copy-fast-path-query-cycle.rs new file mode 100644 index 0000000000000..644cba0d47af2 --- /dev/null +++ b/tests/ui/coroutine/copy-fast-path-query-cycle.rs @@ -0,0 +1,40 @@ +//@ edition: 2024 +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ check-pass + +// Regression test for #146813. We previously used a pseudo-canonical +// query during HIR typeck which caused a query cycle when looking at the +// witness of a coroutine. + +use std::future::Future; + +trait ConnectMiddleware {} + +trait ConnectHandler: Sized { + fn with(self, _: M) -> impl ConnectHandler + where + M: ConnectMiddleware, + { + LayeredConnectHandler + } +} + +struct LayeredConnectHandler; +impl ConnectHandler for LayeredConnectHandler {} +impl ConnectHandler for F where F: FnOnce() {} + +impl ConnectMiddleware for F +where + F: FnOnce() -> Fut, + Fut: Future + Send, +{ +} + +pub async fn fails() { + { || {} } + .with(async || ()) + .with(async || ()) + .with(async || ()); +} +fn main() {} From 913b7e590a88fae986a21d985bf978ed5b341925 Mon Sep 17 00:00:00 2001 From: dianqk Date: Wed, 24 Sep 2025 07:34:22 +0800 Subject: [PATCH 4/8] Update LLVM to 21.1.2 (cherry picked from commit 95ddfa102af7f841c36ab8b207eb42571716b1cd) --- src/llvm-project | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/llvm-project b/src/llvm-project index 333793696b0a0..8c30b9c5098bd 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 333793696b0a08002acac6af983adc7a5233fc56 +Subproject commit 8c30b9c5098bdff1d3d9a2d460ee091cd1171e60 From 98e2fd36d8385b4642c51fc5a34a972c312a8aee Mon Sep 17 00:00:00 2001 From: Iris Shi <0.0@owo.li> Date: Wed, 24 Sep 2025 12:55:38 +0800 Subject: [PATCH 5/8] Fix infinite recursion in Path::eq with String (cherry picked from commit 5a4e53603631475335bab3e1416f4aca61172094) --- library/std/src/path.rs | 12 ++++++------ library/std/tests/path.rs | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/library/std/src/path.rs b/library/std/src/path.rs index b3f992a402955..718c7c2e3b1a6 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -2107,7 +2107,7 @@ impl PartialEq for PathBuf { impl cmp::PartialEq for PathBuf { #[inline] fn eq(&self, other: &str) -> bool { - Path::eq(self, other) + self.as_path() == other } } @@ -2115,7 +2115,7 @@ impl cmp::PartialEq for PathBuf { impl cmp::PartialEq for str { #[inline] fn eq(&self, other: &PathBuf) -> bool { - other == self + self == other.as_path() } } @@ -2123,7 +2123,7 @@ impl cmp::PartialEq for str { impl cmp::PartialEq for PathBuf { #[inline] fn eq(&self, other: &String) -> bool { - **self == **other + self.as_path() == other.as_str() } } @@ -2131,7 +2131,7 @@ impl cmp::PartialEq for PathBuf { impl cmp::PartialEq for String { #[inline] fn eq(&self, other: &PathBuf) -> bool { - other == self + self.as_str() == other.as_path() } } @@ -3426,7 +3426,7 @@ impl cmp::PartialEq for str { impl cmp::PartialEq for Path { #[inline] fn eq(&self, other: &String) -> bool { - self == &*other + self == other.as_str() } } @@ -3434,7 +3434,7 @@ impl cmp::PartialEq for Path { impl cmp::PartialEq for String { #[inline] fn eq(&self, other: &Path) -> bool { - other == self + self.as_str() == other } } diff --git a/library/std/tests/path.rs b/library/std/tests/path.rs index fa76c50597b05..837a14b808ff8 100644 --- a/library/std/tests/path.rs +++ b/library/std/tests/path.rs @@ -2528,7 +2528,17 @@ fn normalize_lexically() { } #[test] -/// See issue#146183 -fn compare_path_to_str() { - assert!(&PathBuf::from("x") == "x"); +/// See issue#146183 and issue#146940 +fn compare_path_like_to_str_like() { + let path_buf = PathBuf::from("x"); + let path = Path::new("x"); + let s = String::from("x"); + assert!(path == "x"); + assert!("x" == path); + assert!(path == &s); + assert!(&s == path); + assert!(&path_buf == "x"); + assert!("x" == &path_buf); + assert!(path_buf == s); + assert!(s == path_buf); } From 14243a9e2f620af44a48626bbd2a3623c379b6d5 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Sat, 4 Oct 2025 17:55:54 -0700 Subject: [PATCH 6/8] Update cargo submodule from branch `rust-1.91.0` --- src/tools/cargo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/cargo b/src/tools/cargo index 24bb93c388fb8..785a383cf7154 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit 24bb93c388fb8c211a37986539f24a819dc669d3 +Subproject commit 785a383cf715417fcd68c4a98a4523c2d082bb0f From f46439a7cef30fb0dfc74133a19e7c76128f8196 Mon Sep 17 00:00:00 2001 From: Jonathan Brouwer Date: Thu, 2 Oct 2025 10:15:00 +0200 Subject: [PATCH 7/8] Add failing regression test for #[link="dl"] (cherry picked from commit 5c95f8bea6ea37d750910e5b0ac7ae049579e437) --- .../ui/attributes/link-dl.default_fcw.stderr | 26 +++++++++++++++++++ tests/ui/attributes/link-dl.rs | 19 ++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 tests/ui/attributes/link-dl.default_fcw.stderr create mode 100644 tests/ui/attributes/link-dl.rs diff --git a/tests/ui/attributes/link-dl.default_fcw.stderr b/tests/ui/attributes/link-dl.default_fcw.stderr new file mode 100644 index 0000000000000..6bff216ad03f4 --- /dev/null +++ b/tests/ui/attributes/link-dl.default_fcw.stderr @@ -0,0 +1,26 @@ +error[E0539]: malformed `link` attribute input + --> $DIR/link-dl.rs:14:1 + | +LL | #[link="dl"] + | ^^^^^^^^^^^^ expected this to be a list + | + = note: for more information, visit +help: try changing it to one of the following valid forms of the attribute + | +LL - #[link="dl"] +LL + #[link(name = "...")] + | +LL - #[link="dl"] +LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] + | +LL - #[link="dl"] +LL + #[link(name = "...", kind = "dylib|static|...")] + | +LL - #[link="dl"] +LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] + | + = and 1 other candidate + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0539`. diff --git a/tests/ui/attributes/link-dl.rs b/tests/ui/attributes/link-dl.rs new file mode 100644 index 0000000000000..0785c83cb442f --- /dev/null +++ b/tests/ui/attributes/link-dl.rs @@ -0,0 +1,19 @@ +// Regression test for an issue discovered in https://github.com/rust-lang/rust/pull/143193/files and rediscovered in https://github.com/rust-lang/rust/issues/147254#event-20049906781 +// Malformed #[link] attribute was supposed to be deny-by-default report-in-deps FCW, +// but accidentally was landed as a hard error. +// +// revision `default_fcw` tests that with `ill_formed_attribute_input` (the default) denied, +// the attribute produces an FCW +// revision `allowed` tests that with `ill_formed_attribute_input` allowed the test passes + +//@ revisions: default_fcw allowed +//@[allowed] check-pass + +#[cfg_attr(allowed, allow(ill_formed_attribute_input))] + +#[link="dl"] +//[default_fcw]~^ ERROR valid forms for the attribute are +//[default_fcw]~| WARN previously accepted +extern "C" { } + +fn main() {} From d21542913b9321d72b1f461d5c5aa292a56dc248 Mon Sep 17 00:00:00 2001 From: Jonathan Brouwer Date: Thu, 2 Oct 2025 10:20:08 +0200 Subject: [PATCH 8/8] Make `#[link="dl"]` a warning rather than an error (cherry picked from commit 1c85a1dc2eaa2cbc55b5d0a6bbde1ca73706385d) --- .../src/attributes/link_attrs.rs | 29 ++++++++++----- compiler/rustc_span/src/symbol.rs | 1 + tests/ui/attributes/link-dl.allowed.stderr | 10 ++++++ .../ui/attributes/link-dl.default_fcw.stderr | 35 +++++++++---------- 4 files changed, 47 insertions(+), 28 deletions(-) create mode 100644 tests/ui/attributes/link-dl.allowed.stderr diff --git a/compiler/rustc_attr_parsing/src/attributes/link_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/link_attrs.rs index d4942e56f429d..04eaa485f736c 100644 --- a/compiler/rustc_attr_parsing/src/attributes/link_attrs.rs +++ b/compiler/rustc_attr_parsing/src/attributes/link_attrs.rs @@ -65,10 +65,22 @@ impl CombineAttributeParser for LinkParser { cx: &'c mut AcceptContext<'_, '_, S>, args: &'c ArgParser<'_>, ) -> impl IntoIterator + 'c { - let mut result = None; - let Some(items) = args.list() else { - cx.expected_list(cx.attr_span); - return result; + let items = match args { + ArgParser::List(list) => list, + // This is an edgecase added because making this a hard error would break too many crates + // Specifically `#[link = "dl"]` is accepted with a FCW + // For more information, see https://github.com/rust-lang/rust/pull/143193 + ArgParser::NameValue(nv) if nv.value_as_str().is_some_and(|v| v == sym::dl) => { + let suggestions = >::TEMPLATE + .suggestions(cx.attr_style, "link"); + let span = cx.attr_span; + cx.emit_lint(AttributeLintKind::IllFormedAttributeInput { suggestions }, span); + return None; + } + _ => { + cx.expected_list(cx.attr_span); + return None; + } }; let sess = cx.sess(); @@ -113,7 +125,7 @@ impl CombineAttributeParser for LinkParser { } }; if !cont { - return result; + return None; } } @@ -202,7 +214,7 @@ impl CombineAttributeParser for LinkParser { } let Some((name, name_span)) = name else { cx.emit_err(LinkRequiresName { span: cx.attr_span }); - return result; + return None; }; // Do this outside of the loop so that `import_name_type` can be specified before `kind`. @@ -218,15 +230,14 @@ impl CombineAttributeParser for LinkParser { cx.emit_err(RawDylibNoNul { span: name_span }); } - result = Some(LinkEntry { + Some(LinkEntry { span: cx.attr_span, kind: kind.unwrap_or(NativeLibKind::Unspecified), name, cfg, verbatim, import_name_type, - }); - result + }) } } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index f1de56c3f75d5..bc2c687035e36 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -871,6 +871,7 @@ symbols! { div, div_assign, diverging_block_default, + dl, do_not_recommend, doc, doc_alias, diff --git a/tests/ui/attributes/link-dl.allowed.stderr b/tests/ui/attributes/link-dl.allowed.stderr new file mode 100644 index 0000000000000..e0070d970595f --- /dev/null +++ b/tests/ui/attributes/link-dl.allowed.stderr @@ -0,0 +1,10 @@ +Future incompatibility report: Future breakage diagnostic: +warning: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", wasm_import_module = "...")]` + --> $DIR/link-dl.rs:14:1 + | +LL | #[link="dl"] + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #57571 + diff --git a/tests/ui/attributes/link-dl.default_fcw.stderr b/tests/ui/attributes/link-dl.default_fcw.stderr index 6bff216ad03f4..249895fd17d00 100644 --- a/tests/ui/attributes/link-dl.default_fcw.stderr +++ b/tests/ui/attributes/link-dl.default_fcw.stderr @@ -1,26 +1,23 @@ -error[E0539]: malformed `link` attribute input +error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", wasm_import_module = "...")]` --> $DIR/link-dl.rs:14:1 | LL | #[link="dl"] - | ^^^^^^^^^^^^ expected this to be a list + | ^^^^^^^^^^^^ | - = note: for more information, visit -help: try changing it to one of the following valid forms of the attribute - | -LL - #[link="dl"] -LL + #[link(name = "...")] - | -LL - #[link="dl"] -LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")] - | -LL - #[link="dl"] -LL + #[link(name = "...", kind = "dylib|static|...")] - | -LL - #[link="dl"] -LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")] - | - = and 1 other candidate + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #57571 + = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0539`. +Future incompatibility report: Future breakage diagnostic: +error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", wasm_import_module = "...")]` + --> $DIR/link-dl.rs:14:1 + | +LL | #[link="dl"] + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #57571 + = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default +