Skip to content

Commit e76bb13

Browse files
committed
Auto merge of #147284 - cuviper:beta-next, r=cuviper
[beta] backports - remove incorrect fast path #146919 - Update LLVM to 21.1.2 #146953 - Fix infinite recursion in Path::eq with String #146958 r? cuviper
2 parents aa7859c + 14243a9 commit e76bb13

File tree

8 files changed

+62
-51
lines changed

8 files changed

+62
-51
lines changed

compiler/rustc_trait_selection/src/infer.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_middle::infer::canonical::{
99
Canonical, CanonicalQueryInput, CanonicalQueryResponse, QueryResponse,
1010
};
1111
use rustc_middle::traits::query::NoSolution;
12-
use rustc_middle::ty::{self, GenericArg, Ty, TyCtxt, TypeFoldable, TypeVisitableExt, Upcast};
12+
use rustc_middle::ty::{self, GenericArg, Ty, TyCtxt, TypeFoldable, Upcast};
1313
use rustc_span::DUMMY_SP;
1414
use tracing::instrument;
1515

@@ -31,19 +31,7 @@ impl<'tcx> InferCtxt<'tcx> {
3131

3232
fn type_is_copy_modulo_regions(&self, param_env: ty::ParamEnv<'tcx>, ty: Ty<'tcx>) -> bool {
3333
let ty = self.resolve_vars_if_possible(ty);
34-
35-
// FIXME(#132279): This should be removed as it causes us to incorrectly
36-
// handle opaques in their defining scope, and stalled coroutines.
37-
if !self.next_trait_solver() && !(param_env, ty).has_infer() && !ty.has_coroutines() {
38-
return self.tcx.type_is_copy_modulo_regions(self.typing_env(param_env), ty);
39-
}
40-
4134
let copy_def_id = self.tcx.require_lang_item(LangItem::Copy, DUMMY_SP);
42-
43-
// This can get called from typeck (by euv), and `moves_by_default`
44-
// rightly refuses to work with inference variables, but
45-
// moves_by_default has a cache, which we want to use in other
46-
// cases.
4735
traits::type_known_to_meet_bound_modulo_regions(self, param_env, ty, copy_def_id)
4836
}
4937

library/std/src/path.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,31 +2107,31 @@ impl PartialEq for PathBuf {
21072107
impl cmp::PartialEq<str> for PathBuf {
21082108
#[inline]
21092109
fn eq(&self, other: &str) -> bool {
2110-
Path::eq(self, other)
2110+
self.as_path() == other
21112111
}
21122112
}
21132113

21142114
#[stable(feature = "eq_str_for_path", since = "1.91.0")]
21152115
impl cmp::PartialEq<PathBuf> for str {
21162116
#[inline]
21172117
fn eq(&self, other: &PathBuf) -> bool {
2118-
other == self
2118+
self == other.as_path()
21192119
}
21202120
}
21212121

21222122
#[stable(feature = "eq_str_for_path", since = "1.91.0")]
21232123
impl cmp::PartialEq<String> for PathBuf {
21242124
#[inline]
21252125
fn eq(&self, other: &String) -> bool {
2126-
**self == **other
2126+
self.as_path() == other.as_str()
21272127
}
21282128
}
21292129

21302130
#[stable(feature = "eq_str_for_path", since = "1.91.0")]
21312131
impl cmp::PartialEq<PathBuf> for String {
21322132
#[inline]
21332133
fn eq(&self, other: &PathBuf) -> bool {
2134-
other == self
2134+
self.as_str() == other.as_path()
21352135
}
21362136
}
21372137

@@ -3426,15 +3426,15 @@ impl cmp::PartialEq<Path> for str {
34263426
impl cmp::PartialEq<String> for Path {
34273427
#[inline]
34283428
fn eq(&self, other: &String) -> bool {
3429-
self == &*other
3429+
self == other.as_str()
34303430
}
34313431
}
34323432

34333433
#[stable(feature = "eq_str_for_path", since = "1.91.0")]
34343434
impl cmp::PartialEq<Path> for String {
34353435
#[inline]
34363436
fn eq(&self, other: &Path) -> bool {
3437-
other == self
3437+
self.as_str() == other
34383438
}
34393439
}
34403440

library/std/tests/path.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2528,7 +2528,17 @@ fn normalize_lexically() {
25282528
}
25292529

25302530
#[test]
2531-
/// See issue#146183
2532-
fn compare_path_to_str() {
2533-
assert!(&PathBuf::from("x") == "x");
2531+
/// See issue#146183 and issue#146940
2532+
fn compare_path_like_to_str_like() {
2533+
let path_buf = PathBuf::from("x");
2534+
let path = Path::new("x");
2535+
let s = String::from("x");
2536+
assert!(path == "x");
2537+
assert!("x" == path);
2538+
assert!(path == &s);
2539+
assert!(&s == path);
2540+
assert!(&path_buf == "x");
2541+
assert!("x" == &path_buf);
2542+
assert!(path_buf == s);
2543+
assert!(s == path_buf);
25342544
}

src/llvm-project

Submodule llvm-project updated 68 files
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//@ edition: 2024
2+
//@ revisions: current next
3+
//@[next] compile-flags: -Znext-solver
4+
//@ check-pass
5+
6+
// Regression test for #146813. We previously used a pseudo-canonical
7+
// query during HIR typeck which caused a query cycle when looking at the
8+
// witness of a coroutine.
9+
10+
use std::future::Future;
11+
12+
trait ConnectMiddleware {}
13+
14+
trait ConnectHandler: Sized {
15+
fn with<M>(self, _: M) -> impl ConnectHandler
16+
where
17+
M: ConnectMiddleware,
18+
{
19+
LayeredConnectHandler
20+
}
21+
}
22+
23+
struct LayeredConnectHandler;
24+
impl ConnectHandler for LayeredConnectHandler {}
25+
impl<F> ConnectHandler for F where F: FnOnce() {}
26+
27+
impl<F, Fut> ConnectMiddleware for F
28+
where
29+
F: FnOnce() -> Fut,
30+
Fut: Future<Output = ()> + Send,
31+
{
32+
}
33+
34+
pub async fn fails() {
35+
{ || {} }
36+
.with(async || ())
37+
.with(async || ())
38+
.with(async || ());
39+
}
40+
fn main() {}

tests/ui/lang-items/missing-copy-lang-item-issue-19660.rs

Lines changed: 0 additions & 19 deletions
This file was deleted.

tests/ui/lang-items/missing-copy-lang-item-issue-19660.stderr

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)