summaryrefslogtreecommitdiffstats
path: root/tests/ui/rfcs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/rfcs')
-rw-r--r--tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.rs30
-rw-r--r--tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.stderr93
-rw-r--r--tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.rs9
-rw-r--r--tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr15
-rw-r--r--tests/ui/rfcs/rfc-1623-static/rfc1623-2.stderr1
-rw-r--r--tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs1
-rw-r--r--tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr20
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.lint.stderr75
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.normal.stderr31
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.rs53
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs85
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.stderr125
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.rs8
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.stderr12
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2091-track-caller/tracked-closure.rs40
-rw-r--r--tests/ui/rfcs/rfc-2093-infer-outlives/dont-infer-static.stderr7
-rw-r--r--tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.stderr13
-rw-r--r--tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr14
-rw-r--r--tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr5
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs12
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr21
-rw-r--r--tests/ui/rfcs/rfc-2457-non-ascii-idents/mod_file_nonascii_forbidden.stderr1
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr14
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.rs1
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.stderr10
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/auxiliary/cross-crate.rs12
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.rs28
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.stderr26
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.rs15
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.stderr11
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-113375-index-out-of-bounds-generics.rs18
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs504
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr32
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.rs18
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr59
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.rs27
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr69
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/project.rs11
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr1
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.rs9
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr20
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr34
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr32
54 files changed, 1440 insertions, 230 deletions
diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.rs b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.rs
index 2b3fbd2a4..e591b2a93 100644
--- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.rs
+++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.rs
@@ -40,7 +40,8 @@ fn main() {
const CFN1: Wrap<fn()> = Wrap(trivial);
let input: Wrap<fn()> = Wrap(trivial);
match Wrap(input) {
- Wrap(CFN1) => count += 1,
+ Wrap(CFN1) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -48,7 +49,8 @@ fn main() {
const CFN2: Wrap<fn(SM)> = Wrap(sm_to);
let input: Wrap<fn(SM)> = Wrap(sm_to);
match Wrap(input) {
- Wrap(CFN2) => count += 1,
+ Wrap(CFN2) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -56,7 +58,8 @@ fn main() {
const CFN3: Wrap<fn() -> SM> = Wrap(to_sm);
let input: Wrap<fn() -> SM> = Wrap(to_sm);
match Wrap(input) {
- Wrap(CFN3) => count += 1,
+ Wrap(CFN3) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -64,7 +67,8 @@ fn main() {
const CFN4: Wrap<fn(NotSM)> = Wrap(not_sm_to);
let input: Wrap<fn(NotSM)> = Wrap(not_sm_to);
match Wrap(input) {
- Wrap(CFN4) => count += 1,
+ Wrap(CFN4) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -72,7 +76,8 @@ fn main() {
const CFN5: Wrap<fn() -> NotSM> = Wrap(to_not_sm);
let input: Wrap<fn() -> NotSM> = Wrap(to_not_sm);
match Wrap(input) {
- Wrap(CFN5) => count += 1,
+ Wrap(CFN5) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -80,7 +85,8 @@ fn main() {
const CFN6: Wrap<fn(&SM)> = Wrap(r_sm_to);
let input: Wrap<fn(&SM)> = Wrap(r_sm_to);
match Wrap(input) {
- Wrap(CFN6) => count += 1,
+ Wrap(CFN6) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -88,7 +94,8 @@ fn main() {
const CFN7: Wrap<fn(&()) -> &SM> = Wrap(r_to_r_sm);
let input: Wrap<fn(&()) -> &SM> = Wrap(r_to_r_sm);
match Wrap(input) {
- Wrap(CFN7) => count += 1,
+ Wrap(CFN7) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -96,7 +103,8 @@ fn main() {
const CFN8: Wrap<fn(&NotSM)> = Wrap(r_not_sm_to);
let input: Wrap<fn(&NotSM)> = Wrap(r_not_sm_to);
match Wrap(input) {
- Wrap(CFN8) => count += 1,
+ Wrap(CFN8) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -104,7 +112,8 @@ fn main() {
const CFN9: Wrap<fn(&()) -> &NotSM> = Wrap(r_to_r_not_sm);
let input: Wrap<fn(&()) -> &NotSM> = Wrap(r_to_r_not_sm);
match Wrap(input) {
- Wrap(CFN9) => count += 1,
+ Wrap(CFN9) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -126,7 +135,8 @@ fn main() {
let input = Foo { alpha: not_sm_to, beta: to_not_sm, gamma: sm_to, delta: to_sm };
match input {
- CFOO => count += 1,
+ CFOO => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Foo { .. } => {}
};
diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.stderr b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.stderr
new file mode 100644
index 000000000..080bf5885
--- /dev/null
+++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.stderr
@@ -0,0 +1,93 @@
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:43:14
+ |
+LL | Wrap(CFN1) => count += 1,
+ | ^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+ = note: `#[warn(pointer_structural_match)]` on by default
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:52:14
+ |
+LL | Wrap(CFN2) => count += 1,
+ | ^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:61:14
+ |
+LL | Wrap(CFN3) => count += 1,
+ | ^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:70:14
+ |
+LL | Wrap(CFN4) => count += 1,
+ | ^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:79:14
+ |
+LL | Wrap(CFN5) => count += 1,
+ | ^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:88:14
+ |
+LL | Wrap(CFN6) => count += 1,
+ | ^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:97:14
+ |
+LL | Wrap(CFN7) => count += 1,
+ | ^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:106:14
+ |
+LL | Wrap(CFN8) => count += 1,
+ | ^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:115:14
+ |
+LL | Wrap(CFN9) => count += 1,
+ | ^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:138:9
+ |
+LL | CFOO => count += 1,
+ | ^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: 10 warnings emitted
+
diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.rs b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.rs
index 567685950..b05b8c8da 100644
--- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.rs
+++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.rs
@@ -26,6 +26,7 @@ fn my_fn(_args: &[A]) {
}
const TEST: Fn = my_fn;
+const TEST2: (Fn, u8) = (TEST, 0);
struct B(Fn);
@@ -33,8 +34,14 @@ fn main() {
let s = B(my_fn);
match s {
B(TEST) => println!("matched"),
- //~^ WARN pointers in patterns behave unpredictably
+ //~^ WARN behave unpredictably
//~| WARN this was previously accepted by the compiler but is being phased out
_ => panic!("didn't match")
};
+ match (s.0, 0) {
+ TEST2 => println!("matched"),
+ //~^ WARN behave unpredictably
+ //~| WARN this was previously accepted by the compiler but is being phased out
+ _ => panic!("didn't match")
+ }
}
diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr
index d6afc0255..4fdfce60b 100644
--- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr
+++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr
@@ -1,5 +1,5 @@
-warning: function pointers and unsized pointers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
- --> $DIR/issue-63479-match-fnptr.rs:35:7
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/issue-63479-match-fnptr.rs:36:7
|
LL | B(TEST) => println!("matched"),
| ^^^^
@@ -12,5 +12,14 @@ note: the lint level is defined here
LL | #![warn(pointer_structural_match)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
-warning: 1 warning emitted
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/issue-63479-match-fnptr.rs:42:5
+ |
+LL | TEST2 => println!("matched"),
+ | ^^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: 2 warnings emitted
diff --git a/tests/ui/rfcs/rfc-1623-static/rfc1623-2.stderr b/tests/ui/rfcs/rfc-1623-static/rfc1623-2.stderr
index d183eaaa6..5f8c5dbe6 100644
--- a/tests/ui/rfcs/rfc-1623-static/rfc1623-2.stderr
+++ b/tests/ui/rfcs/rfc-1623-static/rfc1623-2.stderr
@@ -15,6 +15,7 @@ LL | f: &id,
|
= note: expected trait `for<'a, 'b> Fn<(&'a Foo<'b>,)>`
found trait `Fn<(&Foo<'_>,)>`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: implementation of `FnOnce` is not general enough
--> $DIR/rfc1623-2.rs:28:8
diff --git a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs
index 77227ebd8..1933a68c2 100644
--- a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs
+++ b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs
@@ -1,4 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
mod child {
diff --git a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr
index c4371a002..40f736c21 100644
--- a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr
+++ b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr
@@ -1,11 +1,11 @@
error[E0277]: the trait bound `Something: Termination` is not satisfied
- --> $DIR/issue-103052-2.rs:12:22
+ --> $DIR/issue-103052-2.rs:11:22
|
LL | fn main() -> Something {
| ^^^^^^^^^ the trait `Termination` is not implemented for `Something`
|
note: required by a bound in `Main::{opaque#0}`
- --> $DIR/issue-103052-2.rs:6:27
+ --> $DIR/issue-103052-2.rs:5:27
|
LL | fn main() -> impl std::process::Termination;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Main::{opaque#0}`
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr
index de1bf8be8..7386f10a6 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr
@@ -17,18 +17,18 @@ LL | match NonExhaustiveEnum::Unit {}
| ^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonExhaustiveEnum::Unit`, `NonExhaustiveEnum::Tuple(_)` and `NonExhaustiveEnum::Struct { .. }` not covered
|
note: `NonExhaustiveEnum` defined here
- --> $DIR/enum_same_crate_empty_match.rs:5:5
+ --> $DIR/enum_same_crate_empty_match.rs:4:10
|
LL | pub enum NonExhaustiveEnum {
- | -----------------
+ | ^^^^^^^^^^^^^^^^^
LL | Unit,
- | ^^^^ not covered
+ | ---- not covered
LL |
LL | Tuple(u32),
- | ^^^^^ not covered
+ | ----- not covered
LL |
LL | Struct { field: u32 }
- | ^^^^^^ not covered
+ | ------ not covered
= note: the matched value is of type `NonExhaustiveEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
@@ -44,18 +44,18 @@ LL | match NormalEnum::Unit {}
| ^^^^^^^^^^^^^^^^ patterns `NormalEnum::Unit`, `NormalEnum::Tuple(_)` and `NormalEnum::Struct { .. }` not covered
|
note: `NormalEnum` defined here
- --> $DIR/enum_same_crate_empty_match.rs:14:5
+ --> $DIR/enum_same_crate_empty_match.rs:13:10
|
LL | pub enum NormalEnum {
- | ----------
+ | ^^^^^^^^^^
LL | Unit,
- | ^^^^ not covered
+ | ---- not covered
LL |
LL | Tuple(u32),
- | ^^^^^ not covered
+ | ----- not covered
LL |
LL | Struct { field: u32 }
- | ^^^^^^ not covered
+ | ------ not covered
= note: the matched value is of type `NormalEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.lint.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.lint.stderr
new file mode 100644
index 000000000..9192c6614
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.lint.stderr
@@ -0,0 +1,75 @@
+error: some variants are not matched explicitly
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:15:11
+ |
+LL | match val {
+ | ^^^ pattern `NonExhaustiveEnum::Struct { .. }` not covered
+ |
+ = help: ensure that all variants are matched explicitly by adding the suggested match arms
+ = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
+note: the lint level is defined here
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:14:12
+ |
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: some variants are not matched explicitly
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:23:11
+ |
+LL | match val {
+ | ^^^ pattern `NonExhaustiveEnum::Struct { .. }` not covered
+ |
+ = help: ensure that all variants are matched explicitly by adding the suggested match arms
+ = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
+note: the lint level is defined here
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:22:27
+ |
+LL | #[cfg_attr(lint, deny(non_exhaustive_omitted_patterns))]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: the lint level must be set on the whole match
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:34:9
+ |
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ------------------------------- remove this attribute
+LL | _ => {}
+ | ^
+ |
+ = help: it no longer has any effect to set the lint level on an individual match arm
+help: set the lint level on the whole match
+ |
+LL + #[deny(non_exhaustive_omitted_patterns)]
+LL | match val {
+ |
+
+warning: the lint level must be set on the whole match
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:42:9
+ |
+LL | #[cfg_attr(lint, deny(non_exhaustive_omitted_patterns))]
+ | ------------------------------- remove this attribute
+LL | _ => {}
+ | ^
+ |
+ = help: it no longer has any effect to set the lint level on an individual match arm
+help: set the lint level on the whole match
+ |
+LL + #[deny(non_exhaustive_omitted_patterns)]
+LL | match val {
+ |
+
+warning: the lint level must be set on the whole match
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:50:9
+ |
+LL | #[cfg_attr(lint, warn(non_exhaustive_omitted_patterns))]
+ | ------------------------------- remove this attribute
+LL | _ => {}
+ | ^
+ |
+ = help: it no longer has any effect to set the lint level on an individual match arm
+help: set the lint level on the whole match
+ |
+LL + #[warn(non_exhaustive_omitted_patterns)]
+LL | match val {
+ |
+
+error: aborting due to 2 previous errors; 3 warnings emitted
+
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.normal.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.normal.stderr
new file mode 100644
index 000000000..46093eb9f
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.normal.stderr
@@ -0,0 +1,31 @@
+error: some variants are not matched explicitly
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:15:11
+ |
+LL | match val {
+ | ^^^ pattern `NonExhaustiveEnum::Struct { .. }` not covered
+ |
+ = help: ensure that all variants are matched explicitly by adding the suggested match arms
+ = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
+note: the lint level is defined here
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:14:12
+ |
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: the lint level must be set on the whole match
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:34:9
+ |
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ------------------------------- remove this attribute
+LL | _ => {}
+ | ^
+ |
+ = help: it no longer has any effect to set the lint level on an individual match arm
+help: set the lint level on the whole match
+ |
+LL + #[deny(non_exhaustive_omitted_patterns)]
+LL | match val {
+ |
+
+error: aborting due to previous error; 1 warning emitted
+
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.rs
new file mode 100644
index 000000000..33f9f56a5
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.rs
@@ -0,0 +1,53 @@
+// revisions: normal lint
+// Test that putting the lint level on a match arm emits a warning, as this was previously
+// meaningful and is no longer.
+#![feature(non_exhaustive_omitted_patterns_lint)]
+
+// aux-build:enums.rs
+extern crate enums;
+
+use enums::NonExhaustiveEnum;
+
+fn main() {
+ let val = NonExhaustiveEnum::Unit;
+
+ #[deny(non_exhaustive_omitted_patterns)]
+ match val {
+ //~^ ERROR some variants are not matched explicitly
+ NonExhaustiveEnum::Unit => {}
+ NonExhaustiveEnum::Tuple(_) => {}
+ _ => {}
+ }
+
+ #[cfg_attr(lint, deny(non_exhaustive_omitted_patterns))]
+ match val {
+ //[lint]~^ ERROR some variants are not matched explicitly
+ NonExhaustiveEnum::Unit => {}
+ NonExhaustiveEnum::Tuple(_) => {}
+ _ => {}
+ }
+
+ match val {
+ NonExhaustiveEnum::Unit => {}
+ NonExhaustiveEnum::Tuple(_) => {}
+ #[deny(non_exhaustive_omitted_patterns)]
+ _ => {}
+ }
+ //~^^ WARN lint level must be set on the whole match
+
+ match val {
+ NonExhaustiveEnum::Unit => {}
+ NonExhaustiveEnum::Tuple(_) => {}
+ #[cfg_attr(lint, deny(non_exhaustive_omitted_patterns))]
+ _ => {}
+ }
+ //[lint]~^^ WARN lint level must be set on the whole match
+
+ match val {
+ NonExhaustiveEnum::Unit => {}
+ NonExhaustiveEnum::Tuple(_) => {}
+ #[cfg_attr(lint, warn(non_exhaustive_omitted_patterns))]
+ _ => {}
+ }
+ //[lint]~^^ WARN lint level must be set on the whole match
+}
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs
index 3482af747..e0a6051a8 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs
@@ -13,8 +13,8 @@ use enums::{
EmptyNonExhaustiveEnum, NestedNonExhaustive, NonExhaustiveEnum, NonExhaustiveSingleVariant,
VariantNonExhaustive,
};
-use unstable::{UnstableEnum, OnlyUnstableEnum, UnstableStruct, OnlyUnstableStruct};
use structs::{FunctionalRecord, MixedVisFields, NestedStruct, NormalStruct};
+use unstable::{OnlyUnstableEnum, OnlyUnstableStruct, UnstableEnum, UnstableStruct};
#[non_exhaustive]
#[derive(Default)]
@@ -35,10 +35,10 @@ fn main() {
let enumeration = Bar::A;
// Ok: this is a crate local non_exhaustive enum
+ #[deny(non_exhaustive_omitted_patterns)]
match enumeration {
Bar::A => {}
Bar::B => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
@@ -51,50 +51,87 @@ fn main() {
_ => {}
}
+ #[deny(non_exhaustive_omitted_patterns)]
match non_enum {
+ //~^ some variants are not matched explicitly
NonExhaustiveEnum::Unit => {}
NonExhaustiveEnum::Tuple(_) => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
- //~^^ some variants are not matched explicitly
+ #[deny(non_exhaustive_omitted_patterns)]
match non_enum {
+ //~^ some variants are not matched explicitly
NonExhaustiveEnum::Unit | NonExhaustiveEnum::Struct { .. } => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
- //~^^ some variants are not matched explicitly
let x = 5;
+ // We ignore the guard.
+ #[deny(non_exhaustive_omitted_patterns)]
match non_enum {
NonExhaustiveEnum::Unit if x > 10 => {}
NonExhaustiveEnum::Tuple(_) => {}
NonExhaustiveEnum::Struct { .. } => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
- //~^^ some variants are not matched explicitly
+
+ #[deny(non_exhaustive_omitted_patterns)]
+ match (non_enum, true) {
+ (NonExhaustiveEnum::Unit, true) => {}
+ (NonExhaustiveEnum::Tuple(_), false) => {}
+ (NonExhaustiveEnum::Struct { .. }, false) => {}
+ _ => {}
+ }
+ #[deny(non_exhaustive_omitted_patterns)]
+ match (non_enum, true) {
+ //~^ some variants are not matched explicitly
+ (NonExhaustiveEnum::Unit, true) => {}
+ (NonExhaustiveEnum::Tuple(_), false) => {}
+ _ => {}
+ }
+
+ #[deny(non_exhaustive_omitted_patterns)]
+ match (true, non_enum) {
+ (true, NonExhaustiveEnum::Unit) => {}
+ (false, NonExhaustiveEnum::Tuple(_)) => {}
+ (false, NonExhaustiveEnum::Struct { .. }) => {}
+ _ => {}
+ }
+ #[deny(non_exhaustive_omitted_patterns)]
+ match (true, non_enum) {
+ //~^ some variants are not matched explicitly
+ (true, NonExhaustiveEnum::Unit) => {}
+ (false, NonExhaustiveEnum::Tuple(_)) => {}
+ _ => {}
+ }
+
+ #[deny(non_exhaustive_omitted_patterns)]
+ match Some(non_enum) {
+ //~^ some variants are not matched explicitly
+ Some(NonExhaustiveEnum::Unit) => {}
+ Some(NonExhaustiveEnum::Tuple(_)) => {}
+ _ => {}
+ }
// Ok: all covered and not `unreachable-patterns`
#[deny(unreachable_patterns)]
+ #[deny(non_exhaustive_omitted_patterns)]
match non_enum {
NonExhaustiveEnum::Unit => {}
NonExhaustiveEnum::Tuple(_) => {}
NonExhaustiveEnum::Struct { .. } => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
#[deny(non_exhaustive_omitted_patterns)]
match NestedNonExhaustive::B {
+ //~^ some variants are not matched explicitly
NestedNonExhaustive::A(NonExhaustiveEnum::Unit) => {}
NestedNonExhaustive::A(_) => {}
NestedNonExhaustive::B => {}
_ => {}
}
- //~^^ some variants are not matched explicitly
- //~^^^^^ some variants are not matched explicitly
#[warn(non_exhaustive_omitted_patterns)]
match VariantNonExhaustive::Baz(1, 2) {
@@ -120,30 +157,36 @@ fn main() {
#[warn(non_exhaustive_omitted_patterns)]
let MixedVisFields { a, b, .. } = MixedVisFields::default();
- // Ok: because this only has 1 variant
+ // Ok: this only has 1 variant
#[deny(non_exhaustive_omitted_patterns)]
match NonExhaustiveSingleVariant::A(true) {
NonExhaustiveSingleVariant::A(true) => {}
_ => {}
}
+ // We can't catch the case below, so for consistency we don't catch this one either.
#[deny(non_exhaustive_omitted_patterns)]
match NonExhaustiveSingleVariant::A(true) {
_ => {}
}
- //~^^ some variants are not matched explicitly
+ // We can't catch this case, because this would require digging fully through all the values of
+ // any type we encounter. We need to be able to only consider present constructors.
+ #[deny(non_exhaustive_omitted_patterns)]
+ match &NonExhaustiveSingleVariant::A(true) {
+ _ => {}
+ }
// Ok: we don't lint on `if let` expressions
#[deny(non_exhaustive_omitted_patterns)]
if let NonExhaustiveEnum::Tuple(_) = non_enum {}
+ #[deny(non_exhaustive_omitted_patterns)]
match UnstableEnum::Stable {
+ //~^ some variants are not matched explicitly
UnstableEnum::Stable => {}
UnstableEnum::Stable2 => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
- //~^^ some variants are not matched explicitly
// Ok: the feature is on and all variants are matched
#[deny(non_exhaustive_omitted_patterns)]
@@ -164,10 +207,10 @@ fn main() {
#[deny(non_exhaustive_omitted_patterns)]
match OnlyUnstableEnum::Unstable {
+ //~^ some variants are not matched explicitly
OnlyUnstableEnum::Unstable => {}
_ => {}
}
- //~^^ some variants are not matched explicitly
#[warn(non_exhaustive_omitted_patterns)]
let OnlyUnstableStruct { unstable, .. } = OnlyUnstableStruct::new();
@@ -194,14 +237,13 @@ fn main() {
let local_refutable @ NonExhaustiveEnum::Unit = NonExhaustiveEnum::Unit;
//~^ refutable pattern in local binding
- // Check that matching on a reference results in a correctly spanned diagnostic
#[deny(non_exhaustive_omitted_patterns)]
match &non_enum {
+ //~^ some variants are not matched explicitly
NonExhaustiveEnum::Unit => {}
NonExhaustiveEnum::Tuple(_) => {}
_ => {}
}
- //~^^ some variants are not matched explicitly
}
#[deny(non_exhaustive_omitted_patterns)]
@@ -209,3 +251,10 @@ fn main() {
pub fn takes_non_exhaustive(_: NonExhaustiveEnum) {
let _closure = |_: NonExhaustiveEnum| {};
}
+
+// ICE #117033
+enum Void {}
+#[deny(non_exhaustive_omitted_patterns)]
+pub fn void(v: Void) -> ! {
+ match v {}
+}
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.stderr
index 923394474..7db61f124 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.stderr
@@ -1,5 +1,5 @@
warning: some fields are not explicitly listed
- --> $DIR/omitted-patterns.rs:102:9
+ --> $DIR/omitted-patterns.rs:139:9
|
LL | VariantNonExhaustive::Bar { x, .. } => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `y` not listed
@@ -7,13 +7,13 @@ LL | VariantNonExhaustive::Bar { x, .. } => {}
= help: ensure that all fields are mentioned explicitly by adding the suggested fields
= note: the pattern is of type `VariantNonExhaustive` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:99:12
+ --> $DIR/omitted-patterns.rs:136:12
|
LL | #[warn(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: some fields are not explicitly listed
- --> $DIR/omitted-patterns.rs:107:9
+ --> $DIR/omitted-patterns.rs:144:9
|
LL | let FunctionalRecord { first_field, second_field, .. } = FunctionalRecord::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `third_field` not listed
@@ -21,13 +21,13 @@ LL | let FunctionalRecord { first_field, second_field, .. } = FunctionalReco
= help: ensure that all fields are mentioned explicitly by adding the suggested fields
= note: the pattern is of type `FunctionalRecord` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:106:12
+ --> $DIR/omitted-patterns.rs:143:12
|
LL | #[warn(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: some fields are not explicitly listed
- --> $DIR/omitted-patterns.rs:115:29
+ --> $DIR/omitted-patterns.rs:152:29
|
LL | let NestedStruct { bar: NormalStruct { first_field, .. }, .. } = NestedStruct::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `second_field` not listed
@@ -35,13 +35,13 @@ LL | let NestedStruct { bar: NormalStruct { first_field, .. }, .. } = Nested
= help: ensure that all fields are mentioned explicitly by adding the suggested fields
= note: the pattern is of type `NormalStruct` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:114:12
+ --> $DIR/omitted-patterns.rs:151:12
|
LL | #[warn(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: some fields are not explicitly listed
- --> $DIR/omitted-patterns.rs:115:9
+ --> $DIR/omitted-patterns.rs:152:9
|
LL | let NestedStruct { bar: NormalStruct { first_field, .. }, .. } = NestedStruct::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `foo` not listed
@@ -50,7 +50,7 @@ LL | let NestedStruct { bar: NormalStruct { first_field, .. }, .. } = Nested
= note: the pattern is of type `NestedStruct` and the `non_exhaustive_omitted_patterns` attribute was found
warning: some fields are not explicitly listed
- --> $DIR/omitted-patterns.rs:173:9
+ --> $DIR/omitted-patterns.rs:216:9
|
LL | let OnlyUnstableStruct { unstable, .. } = OnlyUnstableStruct::new();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `unstable2` not listed
@@ -58,13 +58,13 @@ LL | let OnlyUnstableStruct { unstable, .. } = OnlyUnstableStruct::new();
= help: ensure that all fields are mentioned explicitly by adding the suggested fields
= note: the pattern is of type `OnlyUnstableStruct` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:172:12
+ --> $DIR/omitted-patterns.rs:215:12
|
LL | #[warn(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: some fields are not explicitly listed
- --> $DIR/omitted-patterns.rs:181:9
+ --> $DIR/omitted-patterns.rs:224:9
|
LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `unstable` not listed
@@ -72,120 +72,125 @@ LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default();
= help: ensure that all fields are mentioned explicitly by adding the suggested fields
= note: the pattern is of type `UnstableStruct` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:180:12
+ --> $DIR/omitted-patterns.rs:223:12
|
LL | #[warn(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:58:9
+ --> $DIR/omitted-patterns.rs:55:11
|
-LL | _ => {}
- | ^ pattern `NonExhaustiveEnum::Struct { .. }` not covered
+LL | match non_enum {
+ | ^^^^^^^^ pattern `NonExhaustiveEnum::Struct { .. }` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
= note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:57:16
+ --> $DIR/omitted-patterns.rs:54:12
|
-LL | #[deny(non_exhaustive_omitted_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:65:9
+ --> $DIR/omitted-patterns.rs:63:11
|
-LL | _ => {}
- | ^ pattern `NonExhaustiveEnum::Tuple(_)` not covered
+LL | match non_enum {
+ | ^^^^^^^^ pattern `NonExhaustiveEnum::Tuple(_)` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
= note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:64:16
+ --> $DIR/omitted-patterns.rs:62:12
|
-LL | #[deny(non_exhaustive_omitted_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:75:9
+ --> $DIR/omitted-patterns.rs:87:11
|
-LL | _ => {}
- | ^ pattern `NonExhaustiveEnum::Unit` not covered
+LL | match (non_enum, true) {
+ | ^^^^^^^^^^^^^^^^ pattern `(NonExhaustiveEnum::Struct { .. }, _)` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
- = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
+ = note: the matched value is of type `(NonExhaustiveEnum, bool)` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:74:16
+ --> $DIR/omitted-patterns.rs:86:12
|
-LL | #[deny(non_exhaustive_omitted_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:92:32
+ --> $DIR/omitted-patterns.rs:102:11
|
-LL | NestedNonExhaustive::A(_) => {}
- | ^ patterns `NonExhaustiveEnum::Tuple(_)` and `NonExhaustiveEnum::Struct { .. }` not covered
+LL | match (true, non_enum) {
+ | ^^^^^^^^^^^^^^^^ pattern `(_, NonExhaustiveEnum::Struct { .. })` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
- = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
+ = note: the matched value is of type `(bool, NonExhaustiveEnum)` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:89:12
+ --> $DIR/omitted-patterns.rs:101:12
|
LL | #[deny(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:94:9
+ --> $DIR/omitted-patterns.rs:110:11
|
-LL | _ => {}
- | ^ pattern `NestedNonExhaustive::C` not covered
+LL | match Some(non_enum) {
+ | ^^^^^^^^^^^^^^ pattern `Some(NonExhaustiveEnum::Struct { .. })` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
- = note: the matched value is of type `NestedNonExhaustive` and the `non_exhaustive_omitted_patterns` attribute was found
+ = note: the matched value is of type `Option<NonExhaustiveEnum>` and the `non_exhaustive_omitted_patterns` attribute was found
+note: the lint level is defined here
+ --> $DIR/omitted-patterns.rs:109:12
+ |
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:132:9
+ --> $DIR/omitted-patterns.rs:128:11
|
-LL | _ => {}
- | ^ pattern `NonExhaustiveSingleVariant::A(_)` not covered
+LL | match NestedNonExhaustive::B {
+ | ^^^^^^^^^^^^^^^^^^^^^^ patterns `NestedNonExhaustive::C`, `NestedNonExhaustive::A(NonExhaustiveEnum::Tuple(_))` and `NestedNonExhaustive::A(NonExhaustiveEnum::Struct { .. })` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
- = note: the matched value is of type `NonExhaustiveSingleVariant` and the `non_exhaustive_omitted_patterns` attribute was found
+ = note: the matched value is of type `NestedNonExhaustive` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:130:12
+ --> $DIR/omitted-patterns.rs:127:12
|
LL | #[deny(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:144:9
+ --> $DIR/omitted-patterns.rs:184:11
|
-LL | _ => {}
- | ^ pattern `UnstableEnum::Unstable` not covered
+LL | match UnstableEnum::Stable {
+ | ^^^^^^^^^^^^^^^^^^^^ pattern `UnstableEnum::Unstable` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
= note: the matched value is of type `UnstableEnum` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:143:16
+ --> $DIR/omitted-patterns.rs:183:12
|
-LL | #[deny(non_exhaustive_omitted_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:168:9
+ --> $DIR/omitted-patterns.rs:209:11
|
-LL | _ => {}
- | ^ pattern `OnlyUnstableEnum::Unstable2` not covered
+LL | match OnlyUnstableEnum::Unstable {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `OnlyUnstableEnum::Unstable2` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
= note: the matched value is of type `OnlyUnstableEnum` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:165:12
+ --> $DIR/omitted-patterns.rs:208:12
|
LL | #[deny(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0005]: refutable pattern in local binding
- --> $DIR/omitted-patterns.rs:194:9
+ --> $DIR/omitted-patterns.rs:237:9
|
LL | let local_refutable @ NonExhaustiveEnum::Unit = NonExhaustiveEnum::Unit;
| ^^^^^^^^^^^^^^^ pattern `_` not covered
@@ -199,15 +204,15 @@ LL | let local_refutable @ NonExhaustiveEnum::Unit = NonExhaustiveEnum::Unit
| ++++++++++++++++
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:202:9
+ --> $DIR/omitted-patterns.rs:241:11
|
-LL | _ => {}
- | ^ pattern `NonExhaustiveEnum::Struct { .. }` not covered
+LL | match &non_enum {
+ | ^^^^^^^^^ pattern `&NonExhaustiveEnum::Struct { .. }` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
- = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
+ = note: the matched value is of type `&NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:198:12
+ --> $DIR/omitted-patterns.rs:240:12
|
LL | #[deny(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.rs
index 82ee68687..1828fdef9 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.rs
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.rs
@@ -6,23 +6,23 @@
// aux-build:unstable.rs
extern crate unstable;
-use unstable::{UnstableEnum, OnlyUnstableEnum, UnstableStruct, OnlyUnstableStruct};
+use unstable::{OnlyUnstableEnum, OnlyUnstableStruct, UnstableEnum, UnstableStruct};
fn main() {
// OK: this matches all the stable variants
+ #[deny(non_exhaustive_omitted_patterns)]
match UnstableEnum::Stable {
UnstableEnum::Stable => {}
UnstableEnum::Stable2 => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
+ #[deny(non_exhaustive_omitted_patterns)]
match UnstableEnum::Stable {
+ //~^ some variants are not matched explicitly
UnstableEnum::Stable => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
- //~^^ some variants are not matched explicitly
// Ok: although this is a bit odd, we don't have anything to report
// since there is no stable variants and the feature is off
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.stderr
index f38368590..27939176f 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.stderr
@@ -13,18 +13,18 @@ LL | #[warn(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/stable-omitted-patterns.rs:23:9
+ --> $DIR/stable-omitted-patterns.rs:21:11
|
-LL | _ => {}
- | ^ pattern `UnstableEnum::Stable2` not covered
+LL | match UnstableEnum::Stable {
+ | ^^^^^^^^^^^^^^^^^^^^ pattern `UnstableEnum::Stable2` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
= note: the matched value is of type `UnstableEnum` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/stable-omitted-patterns.rs:22:16
+ --> $DIR/stable-omitted-patterns.rs:20:12
|
-LL | #[deny(non_exhaustive_omitted_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error; 1 warning emitted
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr
index a9c54af04..c125756a6 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr
@@ -62,14 +62,14 @@ LL | match x {}
| ^ patterns `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered
|
note: `UninhabitedVariants` defined here
- --> $DIR/auxiliary/uninhabited.rs:17:23
+ --> $DIR/auxiliary/uninhabited.rs:16:1
|
LL | pub enum UninhabitedVariants {
- | ----------------------------
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | #[non_exhaustive] Tuple(!),
- | ^^^^^ not covered
+ | ----- not covered
LL | #[non_exhaustive] Struct { x: ! }
- | ^^^^^^ not covered
+ | ------ not covered
= note: the matched value is of type `UninhabitedVariants`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr
index ec2a2f6f0..7a12aca85 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr
@@ -43,14 +43,14 @@ LL | match x {}
| ^ patterns `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered
|
note: `UninhabitedVariants` defined here
- --> $DIR/match_same_crate.rs:16:23
+ --> $DIR/match_same_crate.rs:15:10
|
LL | pub enum UninhabitedVariants {
- | -------------------
+ | ^^^^^^^^^^^^^^^^^^^
LL | #[non_exhaustive] Tuple(!),
- | ^^^^^ not covered
+ | ----- not covered
LL | #[non_exhaustive] Struct { x: ! }
- | ^^^^^^ not covered
+ | ------ not covered
= note: the matched value is of type `UninhabitedVariants`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr
index b6b777ec5..19e2546b0 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr
@@ -62,14 +62,14 @@ LL | match x {}
| ^ patterns `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered
|
note: `UninhabitedVariants` defined here
- --> $DIR/auxiliary/uninhabited.rs:17:23
+ --> $DIR/auxiliary/uninhabited.rs:16:1
|
LL | pub enum UninhabitedVariants {
- | ----------------------------
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | #[non_exhaustive] Tuple(!),
- | ^^^^^ not covered
+ | ----- not covered
LL | #[non_exhaustive] Struct { x: ! }
- | ^^^^^^ not covered
+ | ------ not covered
= note: the matched value is of type `UninhabitedVariants`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
diff --git a/tests/ui/rfcs/rfc-2091-track-caller/tracked-closure.rs b/tests/ui/rfcs/rfc-2091-track-caller/tracked-closure.rs
index 670c423a7..86bcf1f6f 100644
--- a/tests/ui/rfcs/rfc-2091-track-caller/tracked-closure.rs
+++ b/tests/ui/rfcs/rfc-2091-track-caller/tracked-closure.rs
@@ -2,10 +2,10 @@
#![feature(stmt_expr_attributes)]
#![feature(closure_track_caller)]
-#![feature(generator_trait)]
-#![feature(generators)]
+#![feature(coroutine_trait)]
+#![feature(coroutines)]
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
use std::panic::Location;
@@ -93,53 +93,53 @@ fn test_closure() {
#[track_caller]
-fn mono_generator<F: Generator<String, Yield = (&'static str, String, Loc), Return = ()>>(
+fn mono_coroutine<F: Coroutine<String, Yield = (&'static str, String, Loc), Return = ()>>(
val: Pin<&mut F>
) -> (&'static str, String, Loc) {
match val.resume("Mono".to_string()) {
- GeneratorState::Yielded(val) => val,
+ CoroutineState::Yielded(val) => val,
_ => unreachable!()
}
}
#[track_caller]
-fn dyn_generator(
- val: Pin<&mut dyn Generator<String, Yield = (&'static str, String, Loc), Return = ()>>
+fn dyn_coroutine(
+ val: Pin<&mut dyn Coroutine<String, Yield = (&'static str, String, Loc), Return = ()>>
) -> (&'static str, String, Loc) {
match val.resume("Dyn".to_string()) {
- GeneratorState::Yielded(val) => val,
+ CoroutineState::Yielded(val) => val,
_ => unreachable!()
}
}
-fn test_generator() {
- let generator = #[track_caller] |arg: String| {
+fn test_coroutine() {
+ let coroutine = #[track_caller] |arg: String| {
yield ("first", arg.clone(), Location::caller());
yield ("second", arg.clone(), Location::caller());
};
- let mut pinned = Box::pin(generator);
- let (dyn_ret, dyn_arg, dyn_loc) = dyn_generator(pinned.as_mut());
+ let mut pinned = Box::pin(coroutine);
+ let (dyn_ret, dyn_arg, dyn_loc) = dyn_coroutine(pinned.as_mut());
assert_eq!(dyn_ret, "first");
assert_eq!(dyn_arg, "Dyn".to_string());
- // The `Generator` trait does not have `#[track_caller]` on `resume`, so
+ // The `Coroutine` trait does not have `#[track_caller]` on `resume`, so
// this will not match.
assert_ne!(dyn_loc.file(), file!());
- let (mono_ret, mono_arg, mono_loc) = mono_generator(pinned.as_mut());
+ let (mono_ret, mono_arg, mono_loc) = mono_coroutine(pinned.as_mut());
let mono_line = line!() - 1;
assert_eq!(mono_ret, "second");
- // The generator ignores the argument to the second `resume` call
+ // The coroutine ignores the argument to the second `resume` call
assert_eq!(mono_arg, "Dyn".to_string());
assert_eq!(mono_loc.file(), file!());
assert_eq!(mono_loc.line(), mono_line);
assert_eq!(mono_loc.column(), 42);
- let non_tracked_generator = || { yield Location::caller(); };
- let non_tracked_line = line!() - 1; // This is the line of the generator, not its caller
- let non_tracked_loc = match Box::pin(non_tracked_generator).as_mut().resume(()) {
- GeneratorState::Yielded(val) => val,
+ let non_tracked_coroutine = || { yield Location::caller(); };
+ let non_tracked_line = line!() - 1; // This is the line of the coroutine, not its caller
+ let non_tracked_loc = match Box::pin(non_tracked_coroutine).as_mut().resume(()) {
+ CoroutineState::Yielded(val) => val,
_ => unreachable!()
};
assert_eq!(non_tracked_loc.file(), file!());
@@ -150,5 +150,5 @@ fn test_generator() {
fn main() {
test_closure();
- test_generator();
+ test_coroutine();
}
diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/dont-infer-static.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/dont-infer-static.stderr
index 0c388f5fe..041f7ebc0 100644
--- a/tests/ui/rfcs/rfc-2093-infer-outlives/dont-infer-static.stderr
+++ b/tests/ui/rfcs/rfc-2093-infer-outlives/dont-infer-static.stderr
@@ -2,14 +2,17 @@ error[E0310]: the parameter type `U` may not live long enough
--> $DIR/dont-infer-static.rs:6:10
|
LL | bar: Bar<U>
- | ^^^^^^ ...so that the type `U` will meet its required lifetime bounds...
+ | ^^^^^^
+ | |
+ | the parameter type `U` must be valid for the static lifetime...
+ | ...so that the type `U` will meet its required lifetime bounds...
|
note: ...that is required by this bound
--> $DIR/dont-infer-static.rs:8:15
|
LL | struct Bar<T: 'static> {
| ^^^^^^^
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | struct Foo<U: 'static> {
| +++++++++
diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.stderr
index 2c660b285..5b605f3ee 100644
--- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.stderr
+++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.stderr
@@ -1,10 +1,12 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-enum-not-wf.rs:17:18
|
+LL | enum Ref1<'a, T> {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | Ref1Variant1(RequireOutlives<'a, T>),
| ^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | enum Ref1<'a, T: 'a> {
| ++++
@@ -12,10 +14,13 @@ LL | enum Ref1<'a, T: 'a> {
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-enum-not-wf.rs:22:25
|
+LL | enum Ref2<'a, T> {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+LL | Ref2Variant1,
LL | Ref2Variant2(isize, RequireOutlives<'a, T>),
| ^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | enum Ref2<'a, T: 'a> {
| ++++
@@ -23,10 +28,12 @@ LL | enum Ref2<'a, T: 'a> {
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-enum-not-wf.rs:35:23
|
+LL | enum RefDouble<'a, 'b, T> {
+ | -- the parameter type `T` must be valid for the lifetime `'b` as defined here...
LL | RefDoubleVariant1(&'a RequireOutlives<'b, T>),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | enum RefDouble<'a, 'b, T: 'b> {
| ++++
diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr
index 34ff1362c..eb17ce736 100644
--- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr
+++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr
@@ -1,10 +1,12 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-struct-not-wf.rs:13:16
|
+LL | impl<'a, T> Trait<'a, T> for usize {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | type Out = &'a T;
| ^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<'a, T: 'a> Trait<'a, T> for usize {
| ++++
@@ -12,6 +14,8 @@ LL | impl<'a, T: 'a> Trait<'a, T> for usize {
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-struct-not-wf.rs:21:16
|
+LL | impl<'a, T> Trait<'a, T> for u32 {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | type Out = RefOk<'a, T>;
| ^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
|
@@ -20,7 +24,7 @@ note: ...that is required by this bound
|
LL | struct RefOk<'a, T:'a> {
| ^^
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<'a, T: 'a> Trait<'a, T> for u32 {
| ++++
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr
index d27fde582..087e54244 100644
--- a/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr
@@ -1,5 +1,5 @@
error[E0382]: use of moved value: `x`
- --> $DIR/move-guard-if-let-chain.rs:12:27
+ --> $DIR/move-guard-if-let-chain.rs:12:23
|
LL | let x: Box<_> = Box::new(1);
| - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
@@ -7,7 +7,7 @@ LL | let x: Box<_> = Box::new(1);
LL | (1, 2) if let y = x && c => (),
| - value moved here
LL | (1, 2) if let z = x => (),
- | ^ value used here after move
+ | ^ value used here after move
|
help: borrow this binding in the pattern to avoid moving the value
|
@@ -15,7 +15,7 @@ LL | (1, 2) if let ref y = x && c => (),
| +++
error[E0382]: use of moved value: `x`
- --> $DIR/move-guard-if-let-chain.rs:36:27
+ --> $DIR/move-guard-if-let-chain.rs:36:23
|
LL | let x: Box<_> = Box::new(1);
| - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
@@ -23,7 +23,7 @@ LL | let x: Box<_> = Box::new(1);
LL | (1, _) if let y = x && c => (),
| - value moved here
LL | (_, 2) if let z = x => (),
- | ^ value used here after move
+ | ^ value used here after move
|
help: borrow this binding in the pattern to avoid moving the value
|
@@ -31,15 +31,13 @@ LL | (1, _) if let ref y = x && c => (),
| +++
error[E0382]: use of moved value: `x`
- --> $DIR/move-guard-if-let-chain.rs:59:36
+ --> $DIR/move-guard-if-let-chain.rs:59:32
|
LL | let x: Box<_> = Box::new(1);
| - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
...
LL | (1, _) | (_, 2) if let y = x && c => (),
- | - ^ value used here after move
- | |
- | value moved here
+ | ^ value used here after move
|
help: borrow this binding in the pattern to avoid moving the value
|
diff --git a/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr b/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr
index e97fdcce1..9dc339abc 100644
--- a/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr
+++ b/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr
@@ -1,13 +1,14 @@
error[E0382]: use of moved value: `a`
- --> $DIR/dbg-macro-move-semantics.rs:9:18
+ --> $DIR/dbg-macro-move-semantics.rs:9:13
|
LL | let a = NoCopy(0);
| - move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait
LL | let _ = dbg!(a);
| ------- value moved here
LL | let _ = dbg!(a);
- | ^ value used here after move
+ | ^^^^^^^ value used here after move
|
+ = note: this error originates in the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs
index 43bda4962..1374ad935 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs
@@ -21,14 +21,14 @@ fn call_once(f: impl FnOnce()) {
}
fn main() {
- call(foo); //~ ERROR expected a `Fn<()>` closure, found `fn() {foo}`
- call_mut(foo); //~ ERROR expected a `FnMut<()>` closure, found `fn() {foo}`
- call_once(foo); //~ ERROR expected a `FnOnce<()>` closure, found `fn() {foo}`
+ call(foo); //~ ERROR expected a `Fn()` closure, found `fn() {foo}`
+ call_mut(foo); //~ ERROR expected a `FnMut()` closure, found `fn() {foo}`
+ call_once(foo); //~ ERROR expected a `FnOnce()` closure, found `fn() {foo}`
call(foo_unsafe);
- //~^ ERROR expected a `Fn<()>` closure, found `unsafe fn() {foo_unsafe}`
+ //~^ ERROR expected a `Fn()` closure, found `unsafe fn() {foo_unsafe}`
call_mut(foo_unsafe);
- //~^ ERROR expected a `FnMut<()>` closure, found `unsafe fn() {foo_unsafe}`
+ //~^ ERROR expected a `FnMut()` closure, found `unsafe fn() {foo_unsafe}`
call_once(foo_unsafe);
- //~^ ERROR expected a `FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}`
+ //~^ ERROR expected a `FnOnce()` closure, found `unsafe fn() {foo_unsafe}`
}
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr
index fc7bf2277..100f20482 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<()>` closure, found `fn() {foo}`
+error[E0277]: expected a `Fn()` closure, found `fn() {foo}`
--> $DIR/fn-traits.rs:24:10
|
LL | call(foo);
- | ---- ^^^ expected an `Fn<()>` closure, found `fn() {foo}`
+ | ---- ^^^ expected an `Fn()` closure, found `fn() {foo}`
| |
| required by a bound introduced by this call
|
@@ -15,11 +15,11 @@ note: required by a bound in `call`
LL | fn call(f: impl Fn()) {
| ^^^^ required by this bound in `call`
-error[E0277]: expected a `FnMut<()>` closure, found `fn() {foo}`
+error[E0277]: expected a `FnMut()` closure, found `fn() {foo}`
--> $DIR/fn-traits.rs:25:14
|
LL | call_mut(foo);
- | -------- ^^^ expected an `FnMut<()>` closure, found `fn() {foo}`
+ | -------- ^^^ expected an `FnMut()` closure, found `fn() {foo}`
| |
| required by a bound introduced by this call
|
@@ -32,11 +32,11 @@ note: required by a bound in `call_mut`
LL | fn call_mut(f: impl FnMut()) {
| ^^^^^^^ required by this bound in `call_mut`
-error[E0277]: expected a `FnOnce<()>` closure, found `fn() {foo}`
+error[E0277]: expected a `FnOnce()` closure, found `fn() {foo}`
--> $DIR/fn-traits.rs:26:15
|
LL | call_once(foo);
- | --------- ^^^ expected an `FnOnce<()>` closure, found `fn() {foo}`
+ | --------- ^^^ expected an `FnOnce()` closure, found `fn() {foo}`
| |
| required by a bound introduced by this call
|
@@ -49,7 +49,7 @@ note: required by a bound in `call_once`
LL | fn call_once(f: impl FnOnce()) {
| ^^^^^^^^ required by this bound in `call_once`
-error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() {foo_unsafe}`
+error[E0277]: expected a `Fn()` closure, found `unsafe fn() {foo_unsafe}`
--> $DIR/fn-traits.rs:28:10
|
LL | call(foo_unsafe);
@@ -58,6 +58,7 @@ LL | call(foo_unsafe);
| required by a bound introduced by this call
|
= help: the trait `Fn<()>` is not implemented for fn item `unsafe fn() {foo_unsafe}`
+ = note: unsafe function cannot be called generically without an unsafe block
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
= note: `#[target_feature]` functions do not implement the `Fn` traits
note: required by a bound in `call`
@@ -66,7 +67,7 @@ note: required by a bound in `call`
LL | fn call(f: impl Fn()) {
| ^^^^ required by this bound in `call`
-error[E0277]: expected a `FnMut<()>` closure, found `unsafe fn() {foo_unsafe}`
+error[E0277]: expected a `FnMut()` closure, found `unsafe fn() {foo_unsafe}`
--> $DIR/fn-traits.rs:30:14
|
LL | call_mut(foo_unsafe);
@@ -75,6 +76,7 @@ LL | call_mut(foo_unsafe);
| required by a bound introduced by this call
|
= help: the trait `FnMut<()>` is not implemented for fn item `unsafe fn() {foo_unsafe}`
+ = note: unsafe function cannot be called generically without an unsafe block
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
= note: `#[target_feature]` functions do not implement the `Fn` traits
note: required by a bound in `call_mut`
@@ -83,7 +85,7 @@ note: required by a bound in `call_mut`
LL | fn call_mut(f: impl FnMut()) {
| ^^^^^^^ required by this bound in `call_mut`
-error[E0277]: expected a `FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}`
+error[E0277]: expected a `FnOnce()` closure, found `unsafe fn() {foo_unsafe}`
--> $DIR/fn-traits.rs:32:15
|
LL | call_once(foo_unsafe);
@@ -92,6 +94,7 @@ LL | call_once(foo_unsafe);
| required by a bound introduced by this call
|
= help: the trait `FnOnce<()>` is not implemented for fn item `unsafe fn() {foo_unsafe}`
+ = note: unsafe function cannot be called generically without an unsafe block
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
= note: `#[target_feature]` functions do not implement the `Fn` traits
note: required by a bound in `call_once`
diff --git a/tests/ui/rfcs/rfc-2457-non-ascii-idents/mod_file_nonascii_forbidden.stderr b/tests/ui/rfcs/rfc-2457-non-ascii-idents/mod_file_nonascii_forbidden.stderr
index 7639ae9f6..8ca6a37c6 100644
--- a/tests/ui/rfcs/rfc-2457-non-ascii-idents/mod_file_nonascii_forbidden.stderr
+++ b/tests/ui/rfcs/rfc-2457-non-ascii-idents/mod_file_nonascii_forbidden.stderr
@@ -5,6 +5,7 @@ LL | mod řųśť;
| ^^^^^^^^^
|
= help: to create the module `řųśť`, create file "$DIR/řųśť.rs" or "$DIR/řųśť/mod.rs"
+ = note: if there is a `mod řųśť` elsewhere in the crate already, import it with `use crate::...` instead
error[E0754]: trying to load file for module `řųśť` with non-ascii identifier name
--> $DIR/mod_file_nonascii_forbidden.rs:1:5
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
index ad11c090f..6d436018b 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
@@ -1,14 +1,12 @@
-error[E0277]: the trait bound `T: Foo` is not satisfied
- --> $DIR/assoc-type-const-bound-usage.rs:12:6
+error[E0308]: mismatched types
+ --> $DIR/assoc-type-const-bound-usage.rs:12:5
|
LL | <T as Foo>::Assoc::foo();
- | ^ the trait `Foo` is not implemented for `T`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `host`, found `true`
|
-help: consider further restricting this bound
- |
-LL | const fn foo<T: ~const Foo + Foo>() {
- | +++++
+ = note: expected constant `host`
+ found constant `true`
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.rs
index f396deff4..8e4de57b0 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.rs
@@ -4,7 +4,6 @@
associated_type_bounds,
const_trait_impl,
const_cmp,
- return_position_impl_trait_in_trait,
)]
use std::marker::Destruct;
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.stderr
index f9078e227..4a9090d0b 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.stderr
@@ -5,31 +5,31 @@ LL | const_cmp,
| ^^^^^^^^^
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/const-impl-trait.rs:12:30
+ --> $DIR/const-impl-trait.rs:11:30
|
LL | const fn cmp(a: &impl ~const PartialEq) -> bool {
| ^^^^^^^^^
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/const-impl-trait.rs:16:30
+ --> $DIR/const-impl-trait.rs:15:30
|
LL | const fn wrap(x: impl ~const PartialEq + ~const Destruct)
| ^^^^^^^^^
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/const-impl-trait.rs:17:20
+ --> $DIR/const-impl-trait.rs:16:20
|
LL | -> impl ~const PartialEq + ~const Destruct
| ^^^^^^^^^
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/const-impl-trait.rs:24:29
+ --> $DIR/const-impl-trait.rs:23:29
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
| ^^^^^^^^^
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/const-impl-trait.rs:28:29
+ --> $DIR/const-impl-trait.rs:27:29
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy {
| ^^^^^^^^^
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs
index 1b45cd9aa..13881e042 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs
@@ -7,7 +7,7 @@
#![feature(staged_api)]
#![feature(const_trait_impl)]
-#![stable(since = "1", feature = "foo")]
+#![stable(feature = "foo", since = "3.3.3")]
#[const_trait]
trait Tr {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/auxiliary/cross-crate.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/auxiliary/cross-crate.rs
new file mode 100644
index 000000000..a74c50cc8
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/auxiliary/cross-crate.rs
@@ -0,0 +1,12 @@
+#![feature(const_trait_impl, effects)]
+
+pub const fn foo() {}
+
+#[const_trait]
+pub trait Bar {
+ fn bar();
+}
+
+impl Bar for () {
+ fn bar() {}
+}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.rs
new file mode 100644
index 000000000..1e22ddcea
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.rs
@@ -0,0 +1,28 @@
+#![feature(const_trait_impl, effects)]
+
+#[const_trait]
+trait MyTrait {
+ fn do_something(&self);
+}
+
+trait OtherTrait {
+ fn do_something_else() where Self: ~const MyTrait;
+ //~^ ERROR `~const` is not allowed here
+}
+
+struct MyStruct<T>(T);
+
+impl const MyTrait for u32 {
+ fn do_something(&self) {}
+}
+
+impl<T> MyStruct<T> {
+ pub fn foo(&self) where T: ~const MyTrait {
+ //~^ ERROR `~const` is not allowed here
+ self.0.do_something();
+ }
+}
+
+fn main() {
+ MyStruct(0u32).foo();
+}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.stderr
new file mode 100644
index 000000000..9210f6427
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.stderr
@@ -0,0 +1,26 @@
+error: `~const` is not allowed here
+ --> $DIR/const-bound-on-not-const-associated-fn.rs:9:40
+ |
+LL | fn do_something_else() where Self: ~const MyTrait;
+ | ^^^^^^^^^^^^^^
+ |
+note: this function is not `const`, so it cannot have `~const` trait bounds
+ --> $DIR/const-bound-on-not-const-associated-fn.rs:9:8
+ |
+LL | fn do_something_else() where Self: ~const MyTrait;
+ | ^^^^^^^^^^^^^^^^^
+
+error: `~const` is not allowed here
+ --> $DIR/const-bound-on-not-const-associated-fn.rs:20:32
+ |
+LL | pub fn foo(&self) where T: ~const MyTrait {
+ | ^^^^^^^^^^^^^^
+ |
+note: this function is not `const`, so it cannot have `~const` trait bounds
+ --> $DIR/const-bound-on-not-const-associated-fn.rs:20:12
+ |
+LL | pub fn foo(&self) where T: ~const MyTrait {
+ | ^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.rs
new file mode 100644
index 000000000..6598d1da0
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.rs
@@ -0,0 +1,15 @@
+#![feature(const_closures, const_trait_impl, effects)]
+#![allow(incomplete_features)]
+
+trait Foo {
+ fn foo(&self);
+}
+
+impl Foo for () {
+ fn foo(&self) {}
+}
+
+fn main() {
+ (const || { (()).foo() })();
+ //~^ ERROR: cannot call non-const fn
+}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.stderr
new file mode 100644
index 000000000..002d586ac
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.stderr
@@ -0,0 +1,11 @@
+error[E0015]: cannot call non-const fn `<() as Foo>::foo` in constant functions
+ --> $DIR/const_closure-const_trait_impl-ice-113381.rs:13:22
+ |
+LL | (const || { (()).foo() })();
+ | ^^^^^
+ |
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-113375-index-out-of-bounds-generics.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-113375-index-out-of-bounds-generics.rs
new file mode 100644
index 000000000..1954d2942
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-113375-index-out-of-bounds-generics.rs
@@ -0,0 +1,18 @@
+// check-pass
+
+// effects ice https://github.com/rust-lang/rust/issues/113375 index out of bounds
+
+#![allow(incomplete_features, unused)]
+#![feature(effects, adt_const_params)]
+
+struct Bar<T>(T);
+
+impl<T> Bar<T> {
+ const fn value() -> usize {
+ 42
+ }
+}
+
+struct Foo<const N: [u8; Bar::<u32>::value()]>;
+
+pub fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs
new file mode 100644
index 000000000..c38b4b3f1
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs
@@ -0,0 +1,504 @@
+#![crate_type = "lib"]
+#![feature(no_core, lang_items, unboxed_closures, auto_traits, intrinsics, rustc_attrs)]
+#![feature(fundamental)]
+#![feature(const_trait_impl, effects, const_mut_refs)]
+#![allow(internal_features)]
+#![no_std]
+#![no_core]
+
+// known-bug: #110395
+
+#[lang = "sized"]
+trait Sized {}
+#[lang = "copy"]
+trait Copy {}
+
+#[lang = "add"]
+#[const_trait]
+trait Add<Rhs = Self> {
+ type Output;
+
+ fn add(self, rhs: Rhs) -> Self::Output;
+}
+
+// FIXME we shouldn't need to have to specify `Rhs`.
+impl const Add<i32> for i32 {
+ type Output = i32;
+ fn add(self, rhs: i32) -> i32 {
+ loop {}
+ }
+}
+
+fn foo() {
+ let x = 42_i32 + 43_i32;
+}
+
+const fn bar() {
+ let x = 42_i32 + 43_i32;
+}
+
+
+#[lang = "Try"]
+#[const_trait]
+trait Try: FromResidual {
+ type Output;
+ type Residual;
+
+ #[lang = "from_output"]
+ fn from_output(output: Self::Output) -> Self;
+
+ #[lang = "branch"]
+ fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
+}
+
+// FIXME
+// #[const_trait]
+trait FromResidual<R = <Self as Try>::Residual> {
+ #[lang = "from_residual"]
+ fn from_residual(residual: R) -> Self;
+}
+
+enum ControlFlow<B, C = ()> {
+ #[lang = "Continue"]
+ Continue(C),
+ #[lang = "Break"]
+ Break(B),
+}
+
+#[const_trait]
+#[lang = "fn"]
+#[rustc_paren_sugar]
+trait Fn<Args: Tuple>: ~const FnMut<Args> {
+ extern "rust-call" fn call(&self, args: Args) -> Self::Output;
+}
+
+#[const_trait]
+#[lang = "fn_mut"]
+#[rustc_paren_sugar]
+trait FnMut<Args: Tuple>: ~const FnOnce<Args> {
+ extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
+}
+
+#[const_trait]
+#[lang = "fn_once"]
+#[rustc_paren_sugar]
+trait FnOnce<Args: Tuple> {
+ type Output;
+
+ extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
+}
+
+struct ConstFnMutClosure<CapturedData, Function> {
+ data: CapturedData,
+ func: Function,
+}
+
+#[lang = "tuple_trait"]
+pub trait Tuple {}
+
+macro_rules! impl_fn_mut_tuple {
+ ($($var:ident)*) => {
+ impl<'a, $($var,)* ClosureArguments: Tuple, Function, ClosureReturnValue> const
+ FnOnce<ClosureArguments> for ConstFnMutClosure<($(&'a mut $var),*), Function>
+ where
+ Function: ~const Fn(($(&mut $var),*), ClosureArguments) -> ClosureReturnValue,
+ Function: ~const Destruct,
+ {
+ type Output = ClosureReturnValue;
+
+ extern "rust-call" fn call_once(mut self, args: ClosureArguments) -> Self::Output {
+ self.call_mut(args)
+ }
+ }
+ impl<'a, $($var,)* ClosureArguments: Tuple, Function, ClosureReturnValue> const
+ FnMut<ClosureArguments> for ConstFnMutClosure<($(&'a mut $var),*), Function>
+ where
+ Function: ~const Fn(($(&mut $var),*), ClosureArguments)-> ClosureReturnValue,
+ Function: ~const Destruct,
+ {
+ extern "rust-call" fn call_mut(&mut self, args: ClosureArguments) -> Self::Output {
+ #[allow(non_snake_case)]
+ let ($($var),*) = &mut self.data;
+ (self.func)(($($var),*), args)
+ }
+ }
+ };
+}
+//impl_fn_mut_tuple!(A);
+//impl_fn_mut_tuple!(A B);
+//impl_fn_mut_tuple!(A B C);
+//impl_fn_mut_tuple!(A B C D);
+//impl_fn_mut_tuple!(A B C D E);
+
+#[lang = "receiver"]
+trait Receiver {}
+
+impl<T: ?Sized> Receiver for &T {}
+
+impl<T: ?Sized> Receiver for &mut T {}
+
+#[lang = "destruct"]
+#[const_trait]
+trait Destruct {}
+
+#[lang = "freeze"]
+unsafe auto trait Freeze {}
+
+#[lang = "drop"]
+#[const_trait]
+trait Drop {
+ fn drop(&mut self);
+}
+
+/*
+#[const_trait]
+trait Residual<O> {
+ type TryType: ~const Try<Output = O, Residual = Self> + Try<Output = O, Residual = Self>;
+}
+*/
+
+const fn size_of<T>() -> usize {
+ 42
+}
+
+impl Copy for u8 {}
+
+impl usize {
+ #[rustc_allow_incoherent_impl]
+ const fn repeat_u8(x: u8) -> usize {
+ usize::from_ne_bytes([x; size_of::<usize>()])
+ }
+ #[rustc_allow_incoherent_impl]
+ const fn from_ne_bytes(bytes: [u8; size_of::<Self>()]) -> Self {
+ loop {}
+ }
+}
+
+#[rustc_do_not_const_check] // hooked by const-eval
+const fn panic_display() {
+ panic_fmt();
+}
+
+fn panic_fmt() {}
+
+#[lang = "index"]
+#[const_trait]
+trait Index<Idx: ?Sized> {
+ type Output: ?Sized;
+
+ fn index(&self, index: Idx) -> &Self::Output;
+}
+
+
+#[const_trait]
+unsafe trait SliceIndex<T: ?Sized> {
+ type Output: ?Sized;
+ fn index(self, slice: &T) -> &Self::Output;
+}
+
+impl<T, I> const Index<I> for [T]
+where
+ I: ~const SliceIndex<[T]>,
+{
+ type Output = I::Output;
+
+ #[inline]
+ fn index(&self, index: I) -> &I::Output {
+ index.index(self)
+ }
+}
+/* FIXME
+impl<T, I, const N: usize> const Index<I> for [T; N]
+where
+ [T]: ~const Index<I>,
+{
+ type Output = <[T] as Index<I>>::Output;
+
+ #[inline]
+ // FIXME: make `Self::Output` act like `<Self as ~const Index<I>>::Output`
+ fn index(&self, index: I) -> &<[T] as Index<I>>::Output {
+ Index::index(self as &[T], index)
+ }
+}
+*/
+
+#[lang = "unsize"]
+trait Unsize<T: ?Sized> {
+}
+
+#[lang = "coerce_unsized"]
+trait CoerceUnsized<T: ?Sized> {
+}
+
+impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {}
+
+
+#[lang = "deref"]
+// #[const_trait] FIXME
+trait Deref {
+ #[lang = "deref_target"]
+ type Target: ?Sized;
+
+ fn deref(&self) -> &Self::Target;
+}
+
+
+impl<T: ?Sized> /* const */ Deref for &T {
+ type Target = T;
+
+ fn deref(&self) -> &T {
+ *self
+ }
+}
+
+impl<T: ?Sized> /* const */ Deref for &mut T {
+ type Target = T;
+
+ fn deref(&self) -> &T {
+ *self
+ }
+}
+
+enum Option<T> {
+ #[lang = "None"]
+ None,
+ #[lang = "Some"]
+ Some(T),
+}
+
+impl<T> Option<T> {
+ const fn as_ref(&self) -> Option<&T> {
+ match *self {
+ Some(ref x) => Some(x),
+ None => None,
+ }
+ }
+
+ const fn as_mut(&mut self) -> Option<&mut T> {
+ match *self {
+ Some(ref mut x) => Some(x),
+ None => None,
+ }
+ }
+}
+
+use Option::*;
+
+/*
+const fn as_deref<T>(opt: &Option<T>) -> Option<&T::Target>
+where
+ T: ~const Deref,
+{
+ match opt {
+ Option::Some(t) => Option::Some(t.deref()),
+ Option::None => Option::None,
+ }
+}
+*/
+
+#[const_trait]
+trait Into<T>: Sized {
+ fn into(self) -> T;
+}
+
+#[const_trait]
+trait From<T>: Sized {
+ fn from(value: T) -> Self;
+}
+
+impl<T, U> const Into<U> for T
+where
+ U: ~const From<T>,
+{
+ fn into(self) -> U {
+ U::from(self)
+ }
+}
+
+impl<T> const From<T> for T {
+ fn from(t: T) -> T {
+ t
+ }
+}
+
+enum Result<T, E> {
+ Ok(T),
+ Err(E),
+}
+use Result::*;
+
+fn from_str(s: &str) -> Result<bool, ()> {
+ match s {
+ "true" => Ok(true),
+ "false" => Ok(false),
+ _ => Err(()),
+ }
+}
+
+#[lang = "eq"]
+#[const_trait]
+trait PartialEq<Rhs: ?Sized = Self> {
+ fn eq(&self, other: &Rhs) -> bool;
+ fn ne(&self, other: &Rhs) -> bool {
+ !self.eq(other)
+ }
+}
+
+// FIXME(effects): again, this should not error without Rhs specified
+impl PartialEq<str> for str {
+ fn eq(&self, other: &str) -> bool {
+ loop {}
+ }
+}
+
+
+#[lang = "not"]
+#[const_trait]
+trait Not {
+ type Output;
+ fn not(self) -> Self::Output;
+}
+
+impl const Not for bool {
+ type Output = bool;
+ fn not(self) -> bool {
+ !self
+ }
+}
+
+impl Copy for bool {}
+impl<'a> Copy for &'a str {}
+
+#[lang = "pin"]
+#[fundamental]
+#[repr(transparent)]
+struct Pin<P> {
+ pointer: P,
+}
+
+impl<P> Pin<P> {
+ #[lang = "new_unchecked"]
+ const unsafe fn new_unchecked(pointer: P) -> Pin<P> {
+ Pin { pointer }
+ }
+}
+
+impl<'a, T: ?Sized> Pin<&'a T> {
+ const fn get_ref(self) -> &'a T {
+ self.pointer
+ }
+}
+
+
+impl<P: Deref> Pin<P> {
+ /* const */ fn as_ref(&self) -> Pin<&P::Target>
+ where
+ P: /* ~const */ Deref,
+ {
+ unsafe { Pin::new_unchecked(&*self.pointer) }
+ }
+}
+
+
+impl<'a, T: ?Sized> Pin<&'a mut T> {
+ const unsafe fn get_unchecked_mut(self) -> &'a mut T {
+ self.pointer
+ }
+}
+/* FIXME lol
+impl<T> Option<T> {
+ const fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&T>> {
+ match Pin::get_ref(self).as_ref() {
+ Some(x) => unsafe { Some(Pin::new_unchecked(x)) },
+ None => None,
+ }
+ }
+
+ const fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut T>> {
+ unsafe {
+ match Pin::get_unchecked_mut(self).as_mut() {
+ Some(x) => Some(Pin::new_unchecked(x)),
+ None => None,
+ }
+ }
+ }
+}
+*/
+
+impl<P: /* ~const */ Deref> /* const */ Deref for Pin<P> {
+ type Target = P::Target;
+ fn deref(&self) -> &P::Target {
+ Pin::get_ref(Pin::as_ref(self))
+ }
+}
+
+impl<T> /* const */ Deref for Option<T> {
+ type Target = T;
+ fn deref(&self) -> &T {
+ loop {}
+ }
+}
+
+impl<P: Receiver> Receiver for Pin<P> {}
+
+impl<T: Clone> Clone for RefCell<T> {
+ fn clone(&self) -> RefCell<T> {
+ RefCell::new(self.borrow().clone())
+ }
+}
+
+struct RefCell<T: ?Sized> {
+ borrow: UnsafeCell<()>,
+ value: UnsafeCell<T>,
+}
+impl<T> RefCell<T> {
+ const fn new(value: T) -> RefCell<T> {
+ loop {}
+ }
+}
+impl<T: ?Sized> RefCell<T> {
+ fn borrow(&self) -> Ref<'_, T> {
+ loop {}
+ }
+}
+
+#[lang = "unsafe_cell"]
+#[repr(transparent)]
+struct UnsafeCell<T: ?Sized> {
+ value: T,
+}
+
+struct Ref<'b, T: ?Sized + 'b> {
+ value: *const T,
+ borrow: &'b UnsafeCell<()>,
+}
+
+impl<T: ?Sized> Deref for Ref<'_, T> {
+ type Target = T;
+
+ #[inline]
+ fn deref(&self) -> &T {
+ loop {}
+ }
+}
+
+#[lang = "clone"]
+#[rustc_trivial_field_reads]
+#[const_trait]
+trait Clone: Sized {
+ fn clone(&self) -> Self;
+ fn clone_from(&mut self, source: &Self)
+ where
+ Self: ~const Destruct,
+ {
+ *self = source.clone()
+ }
+}
+
+#[lang = "structural_peq"]
+trait StructuralPartialEq {}
+
+#[lang = "structural_teq"]
+trait StructuralEq {}
+
+const fn drop<T: ~const Destruct>(_: T) {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr
new file mode 100644
index 000000000..024293742
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr
@@ -0,0 +1,32 @@
+error[E0369]: cannot add `i32` to `i32`
+ --> $DIR/minicore.rs:33:20
+ |
+LL | let x = 42_i32 + 43_i32;
+ | ------ ^ ------ i32
+ | |
+ | i32
+
+error[E0369]: cannot add `i32` to `i32`
+ --> $DIR/minicore.rs:37:20
+ |
+LL | let x = 42_i32 + 43_i32;
+ | ------ ^ ------ i32
+ | |
+ | i32
+
+error[E0600]: cannot apply unary operator `!` to type `bool`
+ --> $DIR/minicore.rs:343:9
+ |
+LL | !self.eq(other)
+ | ^^^^^^^^^^^^^^^ cannot apply unary operator `!`
+
+error[E0600]: cannot apply unary operator `!` to type `bool`
+ --> $DIR/minicore.rs:365:9
+ |
+LL | !self
+ | ^^^^^ cannot apply unary operator `!`
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0369, E0600.
+For more information about an error, try `rustc --explain E0369`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.rs
new file mode 100644
index 000000000..8e4850197
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.rs
@@ -0,0 +1,18 @@
+// aux-build: cross-crate.rs
+extern crate cross_crate;
+
+use cross_crate::{Bar, foo};
+
+fn main() {
+ foo::<true>();
+ //~^ ERROR: function takes 0 generic arguments but 1 generic argument was supplied
+ <() as Bar<true>>::bar();
+ //~^ ERROR: trait takes 0 generic arguments but 1 generic argument was supplied
+}
+
+const FOO: () = {
+ foo::<false>();
+ //~^ ERROR: function takes 0 generic arguments but 1 generic argument was supplied
+ <() as Bar<false>>::bar();
+ //~^ ERROR: trait takes 0 generic arguments but 1 generic argument was supplied
+};
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr
new file mode 100644
index 000000000..cc870ad33
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr
@@ -0,0 +1,59 @@
+error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params-cross-crate.rs:14:5
+ |
+LL | foo::<false>();
+ | ^^^--------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: function defined here, with 0 generic parameters
+ --> $DIR/auxiliary/cross-crate.rs:3:14
+ |
+LL | pub const fn foo() {}
+ | ^^^
+
+error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params-cross-crate.rs:16:12
+ |
+LL | <() as Bar<false>>::bar();
+ | ^^^------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: trait defined here, with 0 generic parameters
+ --> $DIR/auxiliary/cross-crate.rs:6:11
+ |
+LL | pub trait Bar {
+ | ^^^
+
+error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params-cross-crate.rs:7:5
+ |
+LL | foo::<true>();
+ | ^^^-------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: function defined here, with 0 generic parameters
+ --> $DIR/auxiliary/cross-crate.rs:3:14
+ |
+LL | pub const fn foo() {}
+ | ^^^
+
+error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params-cross-crate.rs:9:12
+ |
+LL | <() as Bar<true>>::bar();
+ | ^^^------ help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: trait defined here, with 0 generic parameters
+ --> $DIR/auxiliary/cross-crate.rs:6:11
+ |
+LL | pub trait Bar {
+ | ^^^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0107`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.rs
new file mode 100644
index 000000000..929da1ca8
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.rs
@@ -0,0 +1,27 @@
+#![feature(const_trait_impl, effects)]
+
+const fn foo() {}
+
+#[const_trait]
+trait Bar {
+ fn bar();
+}
+
+impl Bar for () {
+ fn bar() {}
+}
+
+fn main() {
+ foo::<true>();
+ //~^ ERROR: function takes 0 generic arguments but 1 generic argument was supplied
+ <() as Bar<true>>::bar();
+ //~^ ERROR: trait takes 0 generic arguments but 1 generic argument was supplied
+}
+
+const FOO: () = {
+ foo::<false>();
+ //~^ ERROR: function takes 0 generic arguments but 1 generic argument was supplied
+ <() as Bar<false>>::bar();
+ //~^ ERROR: trait takes 0 generic arguments but 1 generic argument was supplied
+ //~| ERROR: mismatched types
+};
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr
new file mode 100644
index 000000000..0745d0304
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr
@@ -0,0 +1,69 @@
+error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params.rs:22:5
+ |
+LL | foo::<false>();
+ | ^^^--------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: function defined here, with 0 generic parameters
+ --> $DIR/no-explicit-const-params.rs:3:10
+ |
+LL | const fn foo() {}
+ | ^^^
+
+error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params.rs:24:12
+ |
+LL | <() as Bar<false>>::bar();
+ | ^^^------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: trait defined here, with 0 generic parameters
+ --> $DIR/no-explicit-const-params.rs:6:7
+ |
+LL | trait Bar {
+ | ^^^
+
+error[E0308]: mismatched types
+ --> $DIR/no-explicit-const-params.rs:24:5
+ |
+LL | <() as Bar<false>>::bar();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `false`, found `true`
+ |
+ = note: expected constant `false`
+ found constant `true`
+
+error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params.rs:15:5
+ |
+LL | foo::<true>();
+ | ^^^-------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: function defined here, with 0 generic parameters
+ --> $DIR/no-explicit-const-params.rs:3:10
+ |
+LL | const fn foo() {}
+ | ^^^
+
+error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params.rs:17:12
+ |
+LL | <() as Bar<true>>::bar();
+ | ^^^------ help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: trait defined here, with 0 generic parameters
+ --> $DIR/no-explicit-const-params.rs:6:7
+ |
+LL | trait Bar {
+ | ^^^
+
+error: aborting due to 5 previous errors
+
+Some errors have detailed explanations: E0107, E0308.
+For more information about an error, try `rustc --explain E0107`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/project.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/project.rs
new file mode 100644
index 000000000..b30d7743e
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/project.rs
@@ -0,0 +1,11 @@
+// check-pass
+#![feature(const_trait_impl, effects)]
+
+pub trait Owo<X = <Self as Uwu>::T> {}
+
+#[const_trait]
+pub trait Uwu: Owo {
+ type T;
+}
+
+fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr
index 8bf00eaff..e8ae7e4e3 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr
@@ -13,6 +13,7 @@ LL | use core::convert::{From, TryFrom};
| ^^^^ maybe a missing crate `core`?
|
= help: consider adding `extern crate core` to use the `core` crate
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr
index 97f346e8c..b60399c57 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr
@@ -9,6 +9,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | trait Bar: ~const Foo {}
| ^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr
index 97f346e8c..b60399c57 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr
@@ -9,6 +9,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | trait Bar: ~const Foo {}
| ^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr
index 2897eabb0..eb12a236d 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr
@@ -9,6 +9,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | trait Bar: ~const Foo {}
| ^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:17:24
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr
index 9839a4f24..cd0ee7327 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr
@@ -9,6 +9,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | trait Bar: ~const Foo {}
| ^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.rs
index 89d74cecf..4b720b534 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.rs
@@ -7,7 +7,8 @@ struct Foo<const N: usize>;
impl<const N: usize> Foo<N> {
fn add<A: ~const Add42>(self) -> Foo<{ A::add(N) }> {
- //~^ ERROR mismatched types
+ //~^ ERROR `~const` is not allowed here
+ //~| ERROR mismatched types
Foo
}
}
@@ -30,7 +31,7 @@ fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> {
}
fn main() {
- let foo = Foo::<0>;
- let foo = bar::<(), _>(foo);
- let _foo = bar::<(), _>(foo);
+ let foo = Foo::<0>;
+ let foo = bar::<(), _>(foo);
+ let _foo = bar::<(), _>(foo);
}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr
index ec5d21d33..be7a83dc1 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr
@@ -1,17 +1,29 @@
error: `~const` is not allowed here
- --> $DIR/tilde-const-and-const-params.rs:26:11
+ --> $DIR/tilde-const-and-const-params.rs:9:15
+ |
+LL | fn add<A: ~const Add42>(self) -> Foo<{ A::add(N) }> {
+ | ^^^^^^^^^^^^
+ |
+note: this function is not `const`, so it cannot have `~const` trait bounds
+ --> $DIR/tilde-const-and-const-params.rs:9:8
+ |
+LL | fn add<A: ~const Add42>(self) -> Foo<{ A::add(N) }> {
+ | ^^^
+
+error: `~const` is not allowed here
+ --> $DIR/tilde-const-and-const-params.rs:27:11
|
LL | fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> {
| ^^^^^^^^^^^^
|
note: this function is not `const`, so it cannot have `~const` trait bounds
- --> $DIR/tilde-const-and-const-params.rs:26:4
+ --> $DIR/tilde-const-and-const-params.rs:27:4
|
LL | fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> {
| ^^^
error[E0308]: mismatched types
- --> $DIR/tilde-const-and-const-params.rs:26:61
+ --> $DIR/tilde-const-and-const-params.rs:27:61
|
LL | fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> {
| ^^^^^^^^^ expected `false`, found `true`
@@ -28,6 +40,6 @@ LL | fn add<A: ~const Add42>(self) -> Foo<{ A::add(N) }> {
= note: expected constant `false`
found constant `true`
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
index c94563d35..2a9647da7 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
@@ -1,35 +1,21 @@
-error[E0277]: the trait bound `T: ~const Bar` is not satisfied
+error[E0308]: mismatched types
--> $DIR/trait-where-clause-const.rs:21:5
|
LL | T::b();
- | ^ the trait `Bar` is not implemented for `T`
+ | ^^^^^^ expected `host`, found `true`
|
-note: required by a bound in `Foo::b`
- --> $DIR/trait-where-clause-const.rs:15:24
- |
-LL | fn b() where Self: ~const Bar;
- | ^^^^^^^^^^ required by this bound in `Foo::b`
-help: consider further restricting this bound
- |
-LL | const fn test1<T: ~const Foo + Bar + Bar>() {
- | +++++
+ = note: expected constant `host`
+ found constant `true`
-error[E0277]: the trait bound `T: ~const Bar` is not satisfied
- --> $DIR/trait-where-clause-const.rs:23:12
+error[E0308]: mismatched types
+ --> $DIR/trait-where-clause-const.rs:23:5
|
LL | T::c::<T>();
- | ^ the trait `Bar` is not implemented for `T`
- |
-note: required by a bound in `Foo::c`
- --> $DIR/trait-where-clause-const.rs:16:13
- |
-LL | fn c<T: ~const Bar>();
- | ^^^^^^^^^^ required by this bound in `Foo::c`
-help: consider further restricting this bound
+ | ^^^^^^^^^^^ expected `host`, found `true`
|
-LL | const fn test1<T: ~const Foo + Bar + Bar>() {
- | +++++
+ = note: expected constant `host`
+ found constant `true`
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.rs
index 85ca5fc90..11f353f3f 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.rs
@@ -6,7 +6,9 @@ trait Bar {}
trait Foo {
fn a();
fn b() where Self: ~const Bar;
+ //~^ ERROR `~const` is not allowed here
fn c<T: ~const Bar>();
+ //~^ ERROR `~const` is not allowed here
}
fn test1<T: Foo>() {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr
index 255878e17..3d6fedbab 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr
@@ -1,5 +1,29 @@
+error: `~const` is not allowed here
+ --> $DIR/trait-where-clause.rs:8:24
+ |
+LL | fn b() where Self: ~const Bar;
+ | ^^^^^^^^^^
+ |
+note: this function is not `const`, so it cannot have `~const` trait bounds
+ --> $DIR/trait-where-clause.rs:8:8
+ |
+LL | fn b() where Self: ~const Bar;
+ | ^
+
+error: `~const` is not allowed here
+ --> $DIR/trait-where-clause.rs:10:13
+ |
+LL | fn c<T: ~const Bar>();
+ | ^^^^^^^^^^
+ |
+note: this function is not `const`, so it cannot have `~const` trait bounds
+ --> $DIR/trait-where-clause.rs:10:8
+ |
+LL | fn c<T: ~const Bar>();
+ | ^
+
error[E0277]: the trait bound `T: Bar` is not satisfied
- --> $DIR/trait-where-clause.rs:14:5
+ --> $DIR/trait-where-clause.rs:16:5
|
LL | T::b();
| ^ the trait `Bar` is not implemented for `T`
@@ -15,13 +39,13 @@ LL | fn test1<T: Foo + Bar>() {
| +++++
error[E0277]: the trait bound `T: Bar` is not satisfied
- --> $DIR/trait-where-clause.rs:16:12
+ --> $DIR/trait-where-clause.rs:18:12
|
LL | T::c::<T>();
| ^ the trait `Bar` is not implemented for `T`
|
note: required by a bound in `Foo::c`
- --> $DIR/trait-where-clause.rs:9:13
+ --> $DIR/trait-where-clause.rs:10:13
|
LL | fn c<T: ~const Bar>();
| ^^^^^^^^^^ required by this bound in `Foo::c`
@@ -30,6 +54,6 @@ help: consider further restricting this bound
LL | fn test1<T: Foo + Bar>() {
| +++++
-error: aborting due to 2 previous errors
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0277`.