Skip to content

Commit 599b36c

Browse files
committed
Suffering from success
1 parent 4183c2d commit 599b36c

File tree

7 files changed

+63
-61
lines changed

7 files changed

+63
-61
lines changed

src/tools/compiletest/src/runtest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ impl<'test> TestCx<'test> {
381381
// if a test does not crash, consider it an error
382382
if proc_res.status.success() || matches!(proc_res.status.code(), Some(1 | 0)) {
383383
self.fatal(&format!(
384-
"test no longer crashes/triggers ICE! Please give it a mearningful name, \
384+
"test no longer crashes/triggers ICE! Please give it a meaningful name, \
385385
add a doc-comment to the start of the test explaining why it exists and \
386386
move it to tests/ui or wherever you see fit."
387387
));

tests/crashes/114456-2.rs

-20
This file was deleted.

tests/crashes/114456.rs

-17
This file was deleted.

tests/crashes/119381.rs

-6
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//! Issue #114456: `InferCtxt::super_combine_consts` shouldn't canonicalize its `ty::Const` if its
2+
//! `ParamEnv` isn't canonicalized yet.
3+
//@ check-pass
4+
#![feature(adt_const_params, lazy_type_alias)]
5+
#![allow(incomplete_features)]
6+
7+
mod foo {
8+
pub type Matrix = [usize; 1];
9+
10+
const EMPTY_MATRIX: Matrix = [0; 1];
11+
12+
pub struct Walk<const REMAINING: Matrix> {}
13+
14+
impl Walk<EMPTY_MATRIX> {
15+
pub const fn new() -> Self {
16+
Self {}
17+
}
18+
}
19+
}
20+
21+
mod bar {
22+
const EMPTY_MATRIX: <Type as Trait>::Matrix = [0; 1];
23+
24+
pub struct Walk<const REMAINING: <Type as Trait>::Matrix> {}
25+
26+
impl Walk<EMPTY_MATRIX> {
27+
pub const fn new() -> Self {
28+
Self {}
29+
}
30+
}
31+
32+
pub enum Type {}
33+
pub trait Trait { type Matrix; }
34+
impl Trait for Type { type Matrix = [usize; 1]; }
35+
}
36+
37+
fn main() {
38+
let _ = foo::Walk::new();
39+
let _ = bar::Walk::new();
40+
}

tests/ui/inference/combine-consts-with-negative-coherence.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
//! `ParamEnv` isn't canonicalized yet.
33
44
#![feature(with_negative_coherence)]
5-
6-
impl<const N: u8> Copy for [(); N] {}
7-
//~^ only traits defined in the current crate can be implemented for arbitrary types
5+
trait Trait {}
6+
impl<const N: u8> Trait for [(); N] {}
7+
impl<const N: i8> Trait for [(); N] {}
8+
//~^ conflicting implementations of trait `Trait` for type `[(); _]`
89
//~| mismatched types
10+
//~^^^^ mismatched types
911

1012
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
2-
--> $DIR/combine-consts-with-negative-coherence.rs:6:1
1+
error[E0119]: conflicting implementations of trait `Trait` for type `[(); _]`
2+
--> $DIR/combine-consts-with-negative-coherence.rs:7:1
33
|
4-
LL | impl<const N: u8> Copy for [(); N] {}
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^-------
6-
| | |
7-
| | this is not defined in the current crate because arrays are always foreign
8-
| impl doesn't use only types from inside the current crate
4+
LL | impl<const N: u8> Trait for [(); N] {}
5+
| ----------------------------------- first implementation here
6+
LL | impl<const N: i8> Trait for [(); N] {}
7+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `[(); _]`
8+
9+
error[E0308]: mismatched types
10+
--> $DIR/combine-consts-with-negative-coherence.rs:6:34
911
|
10-
= note: define and implement a trait or new type instead
12+
LL | impl<const N: u8> Trait for [(); N] {}
13+
| ^ expected `usize`, found `u8`
1114

1215
error[E0308]: mismatched types
13-
--> $DIR/combine-consts-with-negative-coherence.rs:6:33
16+
--> $DIR/combine-consts-with-negative-coherence.rs:7:34
1417
|
15-
LL | impl<const N: u8> Copy for [(); N] {}
16-
| ^ expected `usize`, found `u8`
18+
LL | impl<const N: i8> Trait for [(); N] {}
19+
| ^ expected `usize`, found `i8`
1720

18-
error: aborting due to 2 previous errors
21+
error: aborting due to 3 previous errors
1922

20-
Some errors have detailed explanations: E0117, E0308.
21-
For more information about an error, try `rustc --explain E0117`.
23+
Some errors have detailed explanations: E0119, E0308.
24+
For more information about an error, try `rustc --explain E0119`.

0 commit comments

Comments
 (0)