rust/tests/crashes
Matthias Krüger ddbbda47eb
Rollup merge of #129168 - BoxyUwU:mismatched_ty_correct_id, r=compiler-errors
Return correct HirId when finding body owner in diagnostics

Fixes #129145
Fixes #128810

r? ```@compiler-errors```

```rust
fn generic<const N: u32>() {}

trait Collate<const A: u32> {
    type Pass;
    fn collate(self) -> Self::Pass;
}

impl<const B: u32> Collate<B> for i32 {
    type Pass = ();
    fn collate(self) -> Self::Pass {
        generic::<{ true }>()
        //~^ ERROR: mismatched types
    }
}
```

When type checking the `{ true }` anon const we would error with a type mismatch. This then results in diagnostics code attempting to check whether its due to a type mismatch with the return type. That logic was implemented by walking up the hir until we reached the body owner, except instead of using the `enclosing_body_owner` function it special cased various hir nodes incorrectly resulting in us walking out of the anon const and stopping at `fn collate` instead.

This then resulted in diagnostics logic inside of the anon consts `ParamEnv` attempting to do trait solving involving the `<i32 as Collate<B>>::Pass` type which ICEs because it is in the wrong environment.

I have rewritten this function to just walk up until it hits the `enclosing_body_owner` and made some other changes since I found this pretty hard to read/understand. Hopefully it's easier to understand now, it also makes it more obvious that this is not implemented in a very principled way and is definitely missing cases :)
2024-08-17 18:18:19 +02:00
..
23707.rs
34127.rs
54888.rs
57276.rs
74299.rs
74451.rs
79409.rs
79590.rs
87577.rs
88296.rs
90110.rs
91985.rs
92004.rs
92470.rs
93182.rs
93237.rs
94846.rs
95134.rs
96304.rs
98322.rs
100041.rs
100618.rs
101036.rs
101557.rs
102047.rs
102252.rs
103708.rs
103899.rs
104685.rs
105238-1.rs
105238-2.rs
105249.rs
105275.rs
105299.rs
105937.rs
106473.rs
107362.rs
108499.rs
108814.rs
109681.rs
110378.rs
110534.rs
110627.rs
110630.rs
111419.rs
111709-2.rs
111709.rs
111742.rs
112201.rs
112623.rs
113280.rs
113379.rs
113846.rs
114198-2.rs
114198.rs
114212-2.rs
114212.rs
114317.rs
114484.rs
114663.rs
114920.rs
115435.rs
115808.rs
115994.rs
116519-2.rs
116519.rs
116554.rs
116947.rs
117392-2.rs
117392.rs
117496.rs
117629.rs
117696-1.rs
117696-2.rs
117795.rs
117942.rs
118038.rs
118244.rs
118320.rs
118545.rs
118590.rs
118603.rs
118952-2.rs
118952.rs
118987-2.rs
118987.rs
119692.rs
119694.rs
119701.rs
119716-2.rs Detect non-lifetime binder params shadowing item params 2024-07-29 14:26:21 -04:00
119716.rs
119729.rs
119783.rs
119786.rs
119824.rs
119924-6.rs Migrate tests to use -Znext-solver 2024-06-30 17:08:45 +00:00
120033.rs
120241-2.rs
120241.rs
120254.rs
120482.rs
120811.rs
120873.rs
120911.rs
121052.rs
121097.rs
121127.rs Make validate_mir pull optimized/ctfe MIR for all bodies 2024-08-03 15:18:09 -04:00
121161.rs
121263-2.rs
121263.rs
121299.rs
121363.rs
121411.rs
121422.rs
121429.rs
121538.rs
121575.rs
121623.rs
121722.rs
121799.rs
121858.rs Partially implement ConstArgHasType 2024-05-29 17:06:54 +01:00
121963.rs
122259.rs
122529.rs
122630.rs
122681.rs
122704.rs
122710.rs
122823.rs
122903-1.rs Adjust crash bug to still reproduce. 2024-05-31 11:04:32 +00:00
122904-2.rs
122904.rs
123077-2.rs
123134.rs
123140.rs
123141.rs Partially implement ConstArgHasType 2024-05-29 17:06:54 +01:00
123157.rs
123456.rs
123690.rs
123693.rs
123809.rs Mark Parser::eat/check methods as must_use 2024-07-29 21:29:08 -04:00
123810.rs
123887.rs crashes: increment the number of tracked ones 2024-05-27 17:32:56 +02:00
123893.rs Give inlining bonuses to things that optimize out 2024-06-19 21:35:37 -07:00
123955.rs
123959.rs
124020.rs
124021.rs
124092.rs
124164.rs
124182.rs
124189.rs
124207.rs
124340.rs
124350.rs
124352.rs
124375.rs
124436.rs crashes: add lastest batch of crash tests 2024-05-05 23:41:08 +02:00
124440.rs crashes: add lastest batch of crash tests 2024-05-05 23:41:08 +02:00
124751.rs crashes: add lastest batch of crash tests 2024-05-05 23:41:08 +02:00
124894.rs crashes: add more 2024-05-18 23:56:57 +02:00
125014.rs crashes: increment the number of tracked ones 2024-05-27 17:32:56 +02:00
125059.rs crashes: increment the number of tracked ones 2024-05-27 17:32:56 +02:00
125185.rs crashes: add more 2024-05-18 23:56:57 +02:00
125249.rs Change RTN to use .. again 2024-06-28 14:20:43 -04:00
125323.rs crashes: increment the number of tracked ones 2024-05-27 17:32:56 +02:00
125476.rs remove fixed crashes, add fixed crashes to tests, add new cashed found in the meantime 2024-05-27 20:41:09 +02:00
125512.rs crashes: increment the number of tracked ones 2024-05-27 17:32:56 +02:00
125553.rs remove fixed crashes, add fixed crashes to tests, add new cashed found in the meantime 2024-05-27 20:41:09 +02:00
125655.rs tests: add more crashes 2024-06-09 10:16:12 +02:00
125680.rs tests: add more crashes 2024-06-09 10:16:12 +02:00
125758.rs tests: add more crashes 2024-06-09 10:16:12 +02:00
125768.rs tests: add more crashes 2024-06-09 10:16:12 +02:00
125769.rs tests: add more crashes 2024-06-09 10:16:12 +02:00
125772.rs tests: add more crashes 2024-06-09 10:16:12 +02:00
125801.rs tests: add more crashes 2024-06-09 10:16:12 +02:00
125810.rs tests: add more crashes 2024-06-09 10:16:12 +02:00
125841.rs tests: add more crashes 2024-06-09 10:16:12 +02:00
125843.rs tests: add more crashes 2024-06-09 10:16:12 +02:00
125874.rs tests: add more crashes 2024-06-09 10:16:12 +02:00
125879.rs tests: add more crashes 2024-06-09 10:16:12 +02:00
125881.rs tests: add more crashes 2024-06-09 10:16:12 +02:00
125957.rs tests: add more crashes 2024-06-09 10:16:12 +02:00
126182.rs more ice tests 2024-06-16 20:38:08 +02:00
126267.rs more ice tests 2024-06-16 20:38:08 +02:00
126269.rs more ice tests 2024-06-16 20:38:08 +02:00
126359.rs more ice tests 2024-06-16 20:38:08 +02:00
126377.rs more ice tests 2024-06-16 20:38:08 +02:00
126646.rs crashes: add more tests 2024-06-29 09:33:28 +02:00
126667.rs crashes: add more tests 2024-06-29 09:33:28 +02:00
126680.rs crashes: add more tests 2024-06-29 09:33:28 +02:00
126696.rs crashes: add more tests 2024-06-29 09:33:28 +02:00
126725.rs crashes: add more tests 2024-06-29 09:33:28 +02:00
126850.rs crashes: add more tests 2024-06-29 09:33:28 +02:00
126896.rs Make validate_mir pull optimized/ctfe MIR for all bodies 2024-08-03 15:18:09 -04:00
126939.rs crashes: add latest 2024-07-04 23:44:10 +02:00
126942.rs crashes: add latest 2024-07-04 23:44:10 +02:00
126944.rs crashes: add latest 2024-07-04 23:44:10 +02:00
126966.rs crashes: add latest 2024-07-04 23:44:10 +02:00
126969.rs crashes: add latest 2024-07-04 23:44:10 +02:00
126982.rs crashes: add latest 2024-07-04 23:44:10 +02:00
127351.rs add more tests 2024-07-21 17:50:57 +02:00
127353.rs add more tests 2024-07-21 17:50:57 +02:00
127628.rs add more tests 2024-07-21 17:50:57 +02:00
127643.rs add more tests 2024-07-21 17:50:57 +02:00
127676.rs add more tests 2024-07-21 17:50:57 +02:00
127737.rs add more tests 2024-07-21 17:50:57 +02:00
127742.rs add more tests 2024-07-21 17:50:57 +02:00
127880.rs add more tests 2024-07-21 17:50:57 +02:00
127916.rs add more tests 2024-07-21 17:50:57 +02:00
127972.rs add more tests 2024-07-21 17:50:57 +02:00
128016.rs add more tests 2024-07-21 17:50:57 +02:00
128094.rs tests: more crashes 2024-08-04 21:25:49 +02:00
128176.rs tests: more crashes 2024-08-04 21:25:49 +02:00
128190.rs tests: more crashes 2024-08-04 21:25:49 +02:00
128327.rs tests: more crashes 2024-08-04 21:25:49 +02:00
128346.rs tests: more crashes 2024-08-04 21:25:49 +02:00
128695.rs crashes: more tests 2024-08-15 22:44:16 +02:00
128848.rs crashes: more tests 2024-08-15 22:44:16 +02:00
128870.rs crashes: more tests 2024-08-15 22:44:16 +02:00
129075.rs crashes: more tests 2024-08-15 22:44:16 +02:00
129095.rs crashes: more tests 2024-08-15 22:44:16 +02:00
129099.rs crashes: more tests 2024-08-15 22:44:16 +02:00
129109.rs crashes: more tests 2024-08-15 22:44:16 +02:00
129127.rs crashes: more tests 2024-08-15 22:44:16 +02:00
README.md

This is serves as a collection of crashes so that accidental ICE fixes are tracked. This was formally done at https://github.com/rust-lang/glacier but doing it inside the rustc testsuite is more convenient.

It is imperative that a test in the suite causes an internal compiler error/panic or makes rustc crash in some other way. A test will "pass" if rustc exits with something other than 1 or 0.

When adding crashes from https://github.com/rust-lang/rust/issues, the issue number should be noted in the file name (12345.rs should suffice) and perhaps also inside the file via //@ known-bug #4321

If you happen to fix one of the crashes, please move it to a fitting subdirectory in tests/ui and give it a meaningful name. Also please add a doc comment at the top of the file explaining why this test exists. :) Adding Fixes #NNNNN Fixes #MMMMM to the description of your pull request will ensure the corresponding tickets will be closed automatically upon merge. The ticket ids can be found in the file name or the known-bug annotation inside the testfile.