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

Rollup of 11 pull requests #73422

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
d4fe955
Implement partial error recovery for `let` with `BinOpEq`
mibac138 May 7, 2020
48ff12a
Expand partial error recovery for `let` with `BinOpEq`
mibac138 May 7, 2020
05d6531
Error recovery for `let` with `+=`
mibac138 May 7, 2020
6ad24ba
Adjust according to estebank's review comments
mibac138 May 7, 2020
98532a3
Adjust according to petrochenkov's review comments
mibac138 May 20, 2020
591584e
Add tests for 'impl Default for [T; N]'
MikailBag May 26, 2020
3313bf6
Skip leak test on targets without panic=unwind
MikailBag May 28, 2020
e9b67d2
Fix link error with #[thread_local] introduced by #71192
Amanieu Jun 6, 2020
2af53e9
Add -O compile flag to test
Amanieu Jun 10, 2020
f0d2e78
add raw_ref macros
RalfJung Jun 12, 2020
01e29c7
Don't run test on emscripten which doesn't have threads
Amanieu Jun 13, 2020
724dfba
Clean up some weird command strings
GuillaumeGomez Jun 13, 2020
0687b78
Speed up bootstrap a little.
ehuss Jun 13, 2020
607e851
Switch bootstrap metadata to --no-deps.
ehuss Jun 14, 2020
c2b920f
Show suite paths (`src/test/ui/...`) in help output.
ehuss Jun 14, 2020
f17fd7b
Add some doc comments regarding PathSet.
ehuss Jun 15, 2020
9e51008
Complete the std::time documentation to warn about the inconsistencie…
poliorcetics Jun 15, 2020
d6156e8
Change how compiler-builtins gets many CGUs
alexcrichton Jun 8, 2020
96f5584
Expand "recursive opaque type" diagnostic
estebank Apr 19, 2020
8f12485
review comments
estebank Jun 15, 2020
c06876c
[const-prop] Remove `ConstPropMode::NoPropagation`
wesleywiser Apr 23, 2020
2f49d55
Add EMIR_MIR_FOR_EACH_BIT_WIDTH to failing test
wesleywiser May 5, 2020
0265e4e
add tracking issue
RalfJung Jun 16, 2020
0bcefd9
remove visit_terminator_kind from MIR visitor
RalfJung May 31, 2020
302fb50
get rid of an unused 'span' field
RalfJung May 31, 2020
046165a
rename location field of Drop terminators to place
RalfJung Jun 10, 2020
6c5345f
fmt; make visit_terminator arg names consistent with the rest
RalfJung Jun 10, 2020
827ccf7
add probably accidentally missing super_* calls
RalfJung Jun 10, 2020
dd582fe
Rollup merge of #71338 - estebank:recursive-impl-trait, r=nikomatsakis
Manishearth Jun 16, 2020
3d6cb74
Rollup merge of #71911 - wesleywiser:const_prop_small_cleanups, r=oli…
Manishearth Jun 16, 2020
4caf288
Rollup merge of #71976 - mibac138:let-recovery, r=estebank
Manishearth Jun 16, 2020
d3e878d
Rollup merge of #72279 - RalfJung:raw-ref-macros, r=nikomatsakis
Manishearth Jun 16, 2020
b3d74bb
Rollup merge of #72628 - MikailBag:array-default-tests, r=shepmaster
Manishearth Jun 16, 2020
dc6d854
Rollup merge of #72814 - RalfJung:mir-visir-terminator, r=oli-obk
Manishearth Jun 16, 2020
de98582
Rollup merge of #72836 - poliorcetics:std-time-os-specificities, r=sh…
Manishearth Jun 16, 2020
7902aa1
Rollup merge of #73065 - Amanieu:tls-fix, r=oli-obk
Manishearth Jun 16, 2020
29a3bfd
Rollup merge of #73136 - alexcrichton:thinlto-compiler-builtins, r=Ma…
Manishearth Jun 16, 2020
c46b0e7
Rollup merge of #73315 - GuillaumeGomez:clean-up-config-strs, r=kinnison
Manishearth Jun 16, 2020
eb5d3eb
Rollup merge of #73352 - ehuss:bootstrap-metadata, r=Mark-Simulacrum
Manishearth Jun 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adjust according to estebank's review comments
  • Loading branch information
mibac138 committed May 20, 2020
commit 6ad24baf06c687517f188e8c6e6ce848924d001c
19 changes: 8 additions & 11 deletions src/librustc_parse/parser/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ impl<'a> Parser<'a> {
} else {
(None, None)
};
let init = match (self.parse_initializer(let_span, ty.is_some(), err.is_some()), err) {
let init = match (
self.parse_initializer(let_span.until(pat.span), ty.is_some(), err.is_some()),
err,
) {
(Ok(init), None) => {
// init parsed, ty parsed
init
Expand Down Expand Up @@ -231,25 +234,19 @@ impl<'a> Parser<'a> {
self.sess.span_diagnostic,
self.token.span,
E0067,
"can't reassign to a uninitialized variable"
"can't reassign to an uninitialized variable"
);
err.span_suggestion_short(
self.token.span,
"replace with `=` to initialize the variable",
"initialize the variable",
"=".to_string(),
if has_ty {
// for `let x: i8 += 1` it's highly likely that the `+` is a typo
Applicability::MachineApplicable
} else {
// for `let x += 1` it's a bit less likely that the `+` is a typo
Applicability::MaybeIncorrect
},
Applicability::MaybeIncorrect,
);
// In case of code like `let x += 1` it's possible the user may have meant to write `x += 1`
if !has_ty {
err.span_suggestion_short(
let_span,
"remove to reassign to a previously initialized variable",
"otherwise, reassign to a previously initialized variable",
"".to_string(),
Applicability::MaybeIncorrect,
);
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/let-binop-plus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
fn main() {
let a: i8 += 1;
//~^ ERROR expected trait, found builtin type `i8`
//~| ERROR can't reassign to a uninitialized variable
//~| ERROR can't reassign to an uninitialized variable
let _ = a;
}
4 changes: 2 additions & 2 deletions src/test/ui/parser/let-binop-plus.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0067]: can't reassign to a uninitialized variable
error[E0067]: can't reassign to an uninitialized variable
--> $DIR/let-binop-plus.rs:4:16
|
LL | let a: i8 += 1;
| ^ help: replace with `=` to initialize the variable
| ^ help: initialize the variable

error[E0404]: expected trait, found builtin type `i8`
--> $DIR/let-binop-plus.rs:4:12
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/parser/let-binop.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
fn main() {
let a: i8 *= 1; //~ ERROR can't reassign to a uninitialized variable
let a: i8 *= 1; //~ ERROR can't reassign to an uninitialized variable
let _ = a;
let b += 1; //~ ERROR can't reassign to a uninitialized variable
let b += 1; //~ ERROR can't reassign to an uninitialized variable
let _ = b;
let c *= 1; //~ ERROR can't reassign to a uninitialized variable
let c *= 1; //~ ERROR can't reassign to an uninitialized variable
let _ = c;
}
20 changes: 10 additions & 10 deletions src/test/ui/parser/let-binop.stderr
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
error[E0067]: can't reassign to a uninitialized variable
error[E0067]: can't reassign to an uninitialized variable
--> $DIR/let-binop.rs:2:15
|
LL | let a: i8 *= 1;
| ^^ help: replace with `=` to initialize the variable
| ^^ help: initialize the variable

error[E0067]: can't reassign to a uninitialized variable
error[E0067]: can't reassign to an uninitialized variable
--> $DIR/let-binop.rs:4:11
|
LL | let b += 1;
| ^^
|
help: replace with `=` to initialize the variable
help: initialize the variable
|
LL | let b = 1;
| ^
help: remove to reassign to a previously initialized variable
help: otherwise, reassign to a previously initialized variable
|
LL | b += 1;
LL | b += 1;
| --

error[E0067]: can't reassign to a uninitialized variable
error[E0067]: can't reassign to an uninitialized variable
--> $DIR/let-binop.rs:6:11
|
LL | let c *= 1;
| ^^
|
help: replace with `=` to initialize the variable
help: initialize the variable
|
LL | let c = 1;
| ^
help: remove to reassign to a previously initialized variable
help: otherwise, reassign to a previously initialized variable
|
LL | c *= 1;
LL | c *= 1;
| --

error: aborting due to 3 previous errors
Expand Down