Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pointing const identifier when emitting E0435 #80012

Merged

Conversation

sasurau4
Copy link
Contributor

Fix #79919

@rust-highfive
Copy link
Collaborator

r? @ecstatic-morse

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 13, 2020
@jyn514 jyn514 added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 13, 2020
Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r? @petrochenkov maybe?

@petrochenkov
Copy link
Contributor

I don't think this is necessary.
We are pointing at the same item at which we are already pointing in the primary span.
Also, why pointing to the constant name specifically?
We don't point at the function name in every error that can happen in a function body, for example, and this is basically the same case.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 17, 2020
@jyn514
Copy link
Member

jyn514 commented Dec 17, 2020

We are pointing at the same item at which we are already pointing in the primary span.

The same item, yes, but not the same part of the code.

Also, why pointing to the constant name specifically?

People just learning rust might not know that 'constant' means 'a compile-time value' instead of 'immutable'.

We don't point at the function name in every error that can happen in a function body, for example, and this is basically the same case.

Hmm, I think the difference is that most errors aren't specific to it being a function, it would occur in any expression. The exception is things like capturing environment in a function (https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=283552032a0f0dccad62310b4b811e42) and I would argue we should point to fn g there.

cc @estebank

@sasurau4
Copy link
Contributor Author

I agree with @jyn514. It's not necessary but it's helpful to the new rust users from other language has constant keyword like JavaScript.

Also, why pointing to the constant name specifically?

People just learning rust might not know that 'constant' means 'a compile-time value' instead of 'immutable'.

Improving E0435 seems another solution to fix it. To add descriptions like 'constant' means 'a compile-time value' and link to https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html?highlight=constant#differences-between-variables-and-constants mighe be more moderate change rather than to add span_label to constant.
@jyn514 How about it?

@jyn514
Copy link
Member

jyn514 commented Dec 18, 2020

@sasurau4 sure, that sounds good :) there's a diagnostic like that for Box IIRC.

@estebank
Copy link
Contributor

estebank commented Dec 18, 2020

The code changes themselves look reasonable. The ui change I'm ambivalent about. I see in the original report why this might be a problem for people coming from JS, but I don't know that this change will be a solution. I can see other possibilities, like detecting that the const is in an item body (in other words, inside an fn) and then potentially suggest let instead of const. For other cases (like the one mentioned in the help for E0435, we could emit a label pointing at the definition of the non-const binding and suggesting turning that into a const (if the value can be const). If none of these cases fit, I think that the current output is reasonable enough, but could be expanded by saying "this binding can't be const, consider using a literal of the appropriate type" or something along those lines.

@sasurau4 would you be interested in potentially implementing the above?

@sasurau4
Copy link
Contributor Author

@estebank I'm interested in that and try it out!
While implementing, this PR turn into draft.

@sasurau4 sasurau4 marked this pull request as draft December 21, 2020 07:05
@sasurau4 sasurau4 force-pushed the feature/point-constant-identifier-E0435 branch from 2c3ca68 to 00cfca8 Compare December 25, 2020 13:31
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-9 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
.........i.i..ii.................................................................................... 7100/11198
.................................................................................................... 7200/11198
.................................................................................................... 7300/11198
.................................................................................................... 7400/11198
...............................F.i..ii...........................................................ii. 7500/11198
..................i................................................................................. 7700/11198
...........................................................................................i........ 7800/11198
.................................................................................................... 7900/11198
.................................................................................................... 8000/11198
---
...................................................F................................................ 9000/11198
.................................................................................................... 9100/11198
........................................................................................i......i.... 9200/11198
.................................................................................................... 9300/11198
...........................iiiiii..iiiiii.i......................................................... 9400/11198
.................................................................................................... 9600/11198
.................................................................................................... 9700/11198
.................................................................................................... 9800/11198
.................................................................................................... 9900/11198
---
diff of stderr:

2   --> $DIR/E0435.rs:3:17
3    |
4 LL |     let _: [u8; foo];
-    |                 ^^^ non-constant value
+    |                 |
+    |                 non-constant value
+    |                 help: consider using `const` instead of `let`
6 
6 
7 error: aborting due to previous error
8 


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-codes/E0435/E0435.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args error-codes/E0435.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/error-codes/E0435.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-codes/E0435" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/error-codes/E0435/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0435]: attempt to use a non-constant value in a constant
  --> /checkout/src/test/ui/error-codes/E0435.rs:3:17
   |
LL |     let _: [u8; foo]; //~ ERROR E0435
   |                 |
   |                 non-constant value
   |                 help: consider using `const` instead of `let`

---
8 


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-3521/issue-3521.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args issues/issue-3521.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-3521.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-3521" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-3521/auxiliary"
------------------------------------------

------------------------------------------
stderr:
---
diff of stderr:

2   --> $DIR/issue-42060.rs:3:23
3    |
4 LL |     let other: typeof(thing) = thing;
-    |                       ^^^^^ non-constant value
+    |                       |
+    |                       non-constant value
+    |                       help: consider using `const` instead of `let`
6 
6 
7 error[E0435]: attempt to use a non-constant value in a constant
8   --> $DIR/issue-42060.rs:9:13

9    |
10 LL |     <typeof(q)>::N
-    |             ^ non-constant value
+    |             |
+    |             non-constant value
+    |             help: consider using `const` instead of `let`
12 
12 
13 error[E0516]: `typeof` is a reserved keyword but unimplemented


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-42060/issue-42060.stderr
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-42060/issue-42060.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args issues/issue-42060.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-42060.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-42060" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-42060/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0435]: attempt to use a non-constant value in a constant
  --> /checkout/src/test/ui/issues/issue-42060.rs:3:23
   |
LL |     let other: typeof(thing) = thing; //~ ERROR attempt to use a non-constant value in a constant
   |                       |
   |                       non-constant value
   |                       help: consider using `const` instead of `let`


error[E0435]: attempt to use a non-constant value in a constant
  --> /checkout/src/test/ui/issues/issue-42060.rs:9:13
   |
LL |     <typeof(q)>::N //~ ERROR attempt to use a non-constant value in a constant
   |             |
   |             non-constant value
   |             help: consider using `const` instead of `let`


error[E0516]: `typeof` is a reserved keyword but unimplemented
   |
   |
LL |     let other: typeof(thing) = thing; //~ ERROR attempt to use a non-constant value in a constant
   |                ^^^^^^^^^^^^^ reserved keyword

error[E0516]: `typeof` is a reserved keyword but unimplemented
   |
   |
LL |     <typeof(q)>::N //~ ERROR attempt to use a non-constant value in a constant
   |      ^^^^^^^^^ reserved keyword
error: aborting due to 4 previous errors

Some errors have detailed explanations: E0435, E0516.
For more information about an error, try `rustc --explain E0435`.
---
8 


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-44239/issue-44239.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args issues/issue-44239.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-44239.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-44239" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-44239/auxiliary"
------------------------------------------

------------------------------------------
stderr:
---
diff of stderr:

2   --> $DIR/non-constant-expr-for-arr-len.rs:5:22
3    |
4 LL |         let _x = [0; n];
-    |                      ^ non-constant value
+    |                      |
+    |                      non-constant value
+    |                      help: consider using `const` instead of `let`
6 
6 
7 error: aborting due to previous error
8 


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/non-constant-expr-for-arr-len/non-constant-expr-for-arr-len.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args non-constant-expr-for-arr-len.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/non-constant-expr-for-arr-len.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/non-constant-expr-for-arr-len" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/non-constant-expr-for-arr-len/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0435]: attempt to use a non-constant value in a constant
  --> /checkout/src/test/ui/non-constant-expr-for-arr-len.rs:5:22
   |
LL |         let _x = [0; n];
   |                      |
   |                      non-constant value
   |                      help: consider using `const` instead of `let`

---
diff of stderr:

2   --> $DIR/repeat_count.rs:5:17
3    |
4 LL |     let a = [0; n];
-    |                 ^ non-constant value
+    |                 |
+    |                 non-constant value
+    |                 help: consider using `const` instead of `let`
6 
6 
7 error[E0308]: mismatched types
8   --> $DIR/repeat_count.rs:7:17


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/repeat_count/repeat_count.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args repeat_count.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/repeat_count.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/repeat_count" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/repeat_count/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0435]: attempt to use a non-constant value in a constant
  --> /checkout/src/test/ui/repeat_count.rs:5:17
   |
LL |     let a = [0; n];
   |                 |
   |                 non-constant value
   |                 help: consider using `const` instead of `let`


error[E0308]: mismatched types
  --> /checkout/src/test/ui/repeat_count.rs:7:17
   |
LL |     let b = [0; ()];
   |                 ^^ expected `usize`, found `()`
error[E0308]: mismatched types
  --> /checkout/src/test/ui/repeat_count.rs:10:17
   |
   |
LL |     let c = [0; true];
   |                 ^^^^ expected `usize`, found `bool`
error[E0308]: mismatched types
  --> /checkout/src/test/ui/repeat_count.rs:13:17
   |
   |
LL |     let d = [0; 0.5];
   |                 ^^^ expected `usize`, found floating-point number
error[E0308]: mismatched types
  --> /checkout/src/test/ui/repeat_count.rs:16:17
   |
   |
LL |     let e = [0; "foo"];
   |                 ^^^^^ expected `usize`, found `&str`
error[E0308]: mismatched types
  --> /checkout/src/test/ui/repeat_count.rs:31:17
   |
   |
LL |     let g = [0; G { g: () }];
   |                 ^^^^^^^^^^^ expected `usize`, found struct `G`
error[E0308]: mismatched types
  --> /checkout/src/test/ui/repeat_count.rs:19:17
   |
   |
LL |     let f = [0; -4_isize];
   |                 ^^^^^^^^ expected `usize`, found `isize`
   |
   = note: `-4_isize` cannot fit into type `usize`
error[E0308]: mismatched types
  --> /checkout/src/test/ui/repeat_count.rs:22:23
   |
   |
LL |     let f = [0_usize; -1_isize];
   |                       ^^^^^^^^ expected `usize`, found `isize`
   |
   = note: `-1_isize` cannot fit into type `usize`
error[E0308]: mismatched types
Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
  --> /checkout/src/test/ui/repeat_count.rs:25:17
   |
   |
LL |     let f = [0; 4u8];
   |                 ^^^ expected `usize`, found `u8`
   |
help: change the type of the numeric literal from `u8` to `usize`
   |
LL |     let f = [0; 4usize];

error: aborting due to 9 previous errors

Some errors have detailed explanations: E0308, E0435.
---
diff of stderr:

2   --> $DIR/type-dependent-def-issue-49241.rs:3:22
3    |
4 LL |     const l: usize = v.count();
-    |           - constant ^ non-constant value
+    |           -          ^ non-constant value
+    |           |
+    |           help: consider using `let` instead of `const`
7 error: aborting due to previous error
8 



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type/type-dependent-def-issue-49241/type-dependent-def-issue-49241.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args type/type-dependent-def-issue-49241.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/type/type-dependent-def-issue-49241.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type/type-dependent-def-issue-49241" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type/type-dependent-def-issue-49241/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0435]: attempt to use a non-constant value in a constant
  --> /checkout/src/test/ui/type/type-dependent-def-issue-49241.rs:3:22
   |
LL |     const l: usize = v.count(); //~ ERROR attempt to use a non-constant value in a constant
   |           -          ^ non-constant value
   |           |
   |           help: consider using `let` instead of `const`
error: aborting due to previous error

For more information about this error, try `rustc --explain E0435`.

---
test result: FAILED. 11107 passed; 7 failed; 84 ignored; 0 measured; 0 filtered out; finished in 127.12s



command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--suite" "ui" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-9/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "9.0.0" "--llvm-components" "aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver engine executionengine fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes perfjitevents powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvutils runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap --stage 2 test --exclude src/tools/tidy
Build completed unsuccessfully in 0:14:14

@sasurau4 sasurau4 force-pushed the feature/point-constant-identifier-E0435 branch from 00cfca8 to 050c517 Compare December 26, 2020 12:17
@sasurau4 sasurau4 marked this pull request as ready for review December 26, 2020 12:17
@sasurau4 sasurau4 requested a review from jyn514 December 26, 2020 12:17
@sasurau4
Copy link
Contributor Author

@rustbot modify labels to +S-waiting-on-review, -S-waiting-on-author

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 26, 2020
Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks amazing ❤️ ❤️

I think someone else should review the implementation, but I love the error messages :)

@bors

This comment has been minimized.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 6, 2021
@sasurau4 sasurau4 force-pushed the feature/point-constant-identifier-E0435 branch from a3fadec to c71348a Compare January 7, 2021 11:21
@sasurau4
Copy link
Contributor Author

sasurau4 commented Jan 7, 2021

@rustbot modify labels to +S-waiting-on-review, -S-waiting-on-author

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 7, 2021
@petrochenkov
Copy link
Contributor

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented Jan 7, 2021

📌 Commit c71348a has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 7, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Jan 7, 2021
…ntifier-E0435, r=petrochenkov

Add pointing const identifier when emitting E0435

Fix rust-lang#79919
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 7, 2021
Rollup of 10 pull requests

Successful merges:

 - rust-lang#80012 (Add pointing const identifier when emitting E0435)
 - rust-lang#80521 (MIR Inline is incompatible with coverage)
 - rust-lang#80659 (Edit rustc_ast::tokenstream docs)
 - rust-lang#80660 (Properly handle primitive disambiguators in rustdoc)
 - rust-lang#80738 (Remove bottom margin from crate version when the docs sidebar is collapsed)
 - rust-lang#80744 (rustdoc: Turn `next_def_id` comments into docs)
 - rust-lang#80750 (Don't use to_string on Symbol in rustc_passes/check_attr.rs)
 - rust-lang#80769 (Improve wording of parse doc)
 - rust-lang#80780 (Return EOF_CHAR constant instead of magic char.)
 - rust-lang#80784 (rustc_parse: Better spans for synthesized token streams)

Failed merges:

 - rust-lang#80785 (rustc_ast_pretty: Remove `PrintState::insert_extra_parens`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit bb229b8 into rust-lang:master Jan 7, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 7, 2021
estebank added a commit to estebank/rust that referenced this pull request Jan 8, 2021
On structured suggestion for `let` -> `const`  and `const` -> `let`, use
a proper `Span` and update tests to check the correct application.

Follow up to rust-lang#80012.
@sasurau4 sasurau4 deleted the feature/point-constant-identifier-E0435 branch January 8, 2021 01:51
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Jan 10, 2021
… r=petrochenkov

Use correct span for structured suggestion

On structured suggestion for `let` -> `const`  and `const` -> `let`, use
a proper `Span` and update tests to check the correct application.

Follow up to rust-lang#80012.
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Jan 10, 2021
… r=petrochenkov

Use correct span for structured suggestion

On structured suggestion for `let` -> `const`  and `const` -> `let`, use
a proper `Span` and update tests to check the correct application.

Follow up to rust-lang#80012.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'attempt to use non-constant in a constant' should point to the constant
9 participants