Commit Graph

19 Commits

Author SHA1 Message Date
Dylan MacKenzie
51fbd555f0 Bless tests 2020-09-29 19:20:33 -07:00
Aaron Hill
f422ef141a
Add CONST_ITEM_MUTATION lint
Fixes #74053
Fixes #55721

This PR adds a new lint `CONST_ITEM_MUTATION`.
Given an item `const FOO: SomeType = ..`, this lint fires on:

* Attempting to write directly to a field (`FOO.field = some_val`) or
  array entry (`FOO.array_field[0] = val`)
* Taking a mutable reference to the `const` item (`&mut FOO`), including
  through an autoderef `FOO.some_mut_self_method()`

The lint message explains that since each use of a constant creates a
new temporary, the original `const` item will not be modified.
2020-09-07 08:44:35 -04:00
Christian Poveda
96031e22d2
add new error code 2020-06-19 14:16:38 -05:00
Christian Poveda
1f48465a01
update diagnostics for &mut in constants 2020-06-19 11:48:46 -05:00
mibac138
73867365a8 Suggest to add missing feature when using gated const features 2020-05-04 23:47:00 +02:00
Matthias Prechtl
7b555178ae --bless --compare-mode=nll 2020-02-09 20:43:49 +01:00
Christian Poveda
416b439ffb Correct other tests related to const_mut_refs 2019-12-02 09:46:26 -05:00
Dylan MacKenzie
5b1e10b2f6 Remove test for unused error code
This error code is never emitted, and the contents of this test are
identical to that of `E0017.rs`.
2019-11-27 14:37:06 -08:00
Santiago Pastorino
695e91a1d5
check-consts remove cannot mutate statics in initializer of another static error 2019-11-12 13:20:52 +01:00
Matthew Jasper
8eef102270 update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
Andy Russell
b6f148c8bd
hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
Vadim Petrochenkov
fa72a81bea Update tests 2019-03-11 23:10:26 +03:00
Eduard-Mihai Burtescu
f6d1e9790c rustc_mir: split qualify_consts' checking and value qualification. 2019-02-14 13:36:51 +02:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Oliver Scherer
59eff14120 Also catch static mutation at evaluation time 2018-11-19 16:46:03 +01:00
Guillaume Gomez
2e104a77cf update tests 2018-03-14 00:53:24 +01:00
Vadim Petrochenkov
fa2d9fc4b9 Update UI tests 2018-02-26 20:24:02 +03:00
Guillaume Gomez
5747fd6611 Update ui tests 2018-02-25 12:15:05 +01:00
Esteban Küber
51f0c0dc4c Move some E0XXX to ui 2018-02-08 09:09:09 -08:00