You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Applying the refactoring "Introduce constant"/"Introduce variable" to const slices length specifiers that are not located in a function yields a curious prompt. The options are (also shown in the screenshot):
Replace this occurrence only
Replace all 0 occurrences
This makes no sense, the options are contradictory. The number of occurrences for the length value is 0. It should be 2 for const BUFFER: [u8; 1000] = [0; 1000]; because 1000 appears twice in this line. The first option works fine and applying the second option does nothing.
Steps to reproduce
With the minimal example below:
Move your cursor to a 1000 literal in one of the examples below the comment "these don't"
Press Ctrl+Alt+V/Ctrl+Alt+C or right-click, Refactor, "Introduce constant" / "Introduce variable"
// these work as expected
fn main() {
const BUFFER: [u8; 1000] = [0; 1000];
}
fn t() {
const BUFFER: [u8; 1000] = [0; 1000];
}
// these don't
const BUFFER: [u8; 1000] = [0; 1000];
mod t {
const BUFFER: [u8; 1000] = [0; 1000];
}
trait T {
const BUFFER: [u8; 1000] = [0; 1000];
}
The text was updated successfully, but these errors were encountered:
Environment
Problem description
Applying the refactoring "Introduce constant"/"Introduce variable" to const slices length specifiers that are not located in a function yields a curious prompt. The options are (also shown in the screenshot):
This makes no sense, the options are contradictory. The number of occurrences for the length value is 0. It should be 2 for
const BUFFER: [u8; 1000] = [0; 1000];because 1000 appears twice in this line. The first option works fine and applying the second option does nothing.Steps to reproduce
With the minimal example below:
1000literal in one of the examples below the comment "these don't"The text was updated successfully, but these errors were encountered: