about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-08-24 22:14:14 +0200
committerGitHub <noreply@github.com>2024-08-24 22:14:14 +0200
commit3f5d6b2e40df7be570e5bddac876300153b220d5 (patch)
tree81f882b27b635c9e003a850b85a001de27aed838
parent2c4338802a9f4f1c5b5abc39d94c146411ded1ed (diff)
parent378902e325e32de43ae0de2383ed458781be14d1 (diff)
downloadrust-3f5d6b2e40df7be570e5bddac876300153b220d5.tar.gz
rust-3f5d6b2e40df7be570e5bddac876300153b220d5.zip
Rollup merge of #129500 - fee1-dead-contrib:fxrel, r=compiler-errors
remove invalid `TyCompat` relation for effects

if the current impl uses `Maybe` (`impl const`), the parent impl must use `Maybe` (`impl const`) as well.

I'd like to rename `TyCompat` to `Sub` which is probably clearer. But it would conflict with my other PR.

r? ``@rust-lang/project-const-traits``
-rw-r--r--library/core/src/marker.rs1
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.rs4
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.stderr11
3 files changed, 13 insertions, 3 deletions
diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs
index 374fa086aec..5654f5aa4b8 100644
--- a/library/core/src/marker.rs
+++ b/library/core/src/marker.rs
@@ -1097,7 +1097,6 @@ pub mod effects {
     pub trait TyCompat<T: ?Sized> {}
 
     impl<T: ?Sized> TyCompat<T> for T {}
-    impl<T: ?Sized> TyCompat<T> for Maybe {}
     impl<T: ?Sized> TyCompat<Maybe> for T {}
 
     #[lang = "EffectsIntersection"]
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.rs
index 637a24f53bc..6c320c0462e 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.rs
@@ -1,4 +1,4 @@
-//@ check-pass
+//~ ERROR the trait bound
 //@ compile-flags: -Znext-solver
 
 #![allow(incomplete_features)]
@@ -17,6 +17,6 @@ impl Foo for S {
 }
 
 impl const Bar for S {}
-//FIXME ~^ ERROR the trait bound
+// FIXME(effects) bad span
 
 fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.stderr
new file mode 100644
index 00000000000..9a907bbee0a
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Maybe: TyCompat<<(Foo::{synthetic#0},) as std::marker::effects::Intersection>::Output>` is not satisfied
+   |
+note: required by a bound in `Bar::{synthetic#0}`
+  --> $DIR/super-traits-fail.rs:11:1
+   |
+LL | #[const_trait]
+   | ^^^^^^^^^^^^^^ required by this bound in `Bar::{synthetic#0}`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.