Addressed #51602Fixed#51602
r? @estebank
here I have addressed the case where `in` was not expected right after `if` block. Speaking of `type ascription` I am not sure if this the best approach which I have implemented. Plus I think one more test case can be added to test `type-ascription` case, though I don't have any at this point of time. I will ping you again if all existing testcases pass.
Two small improvements
In `librustc_apfloat/ieee.rs`, use the iterator.[r]find methods to simplify the code. In `libserialize/json.rs`, make use of the fact that `Vec.last` on an empty `Vec` returns `None` to simplify the code to a single match.
Documented impl From on line 367 of libserialize/json.rs
This is for the impl From mentioned in #51430 assigned to @skade .
Hopefully I didn't miss anything/get anything wrong. I looked over another PR for another part of this same issue to see what the proper formatting was, etc.
Thanks!
Don't accept non-string literals for the format string in writeln
This is to improve diagnostics.
`println` and `eprintln` were already fixed by #52394.
Fixes#30143
Start adding an `aarch64-pc-windows-msvc` target
This commit adds the necessary definitions for target specs and such as well as
the necessary support in libstd to compile basic `aarch64-pc-windows-msvc`
binaries. The target is not currently built on CI, but it can be built locally
with:
./configure --target=aarch64-pc-windows-msvc --set rust.lld
./x.py build src/libstd --target aarch64-pc-windows-msvc
Currently this fails to build `libtest` due to a linker bug (seemingly in LLD?)
which hasn't been investigate yet. Otherwise though with libstd you can build a
hello world program (linked with LLD). I've not tried to execute it yet, but it
at least links!
Full support for this target is still a long road ahead, but this is hopefully a
good stepping stone to get started.
Points of note about this target are:
* Currently defaults to `panic=abort` as support is still landing in LLVM for
SEH on AArch64.
* Currently defaults to LLD as a linker as I was able to get farther with it
than I was with `link.exe`
For move errors, suggest match ergonomics instead of `ref`
Partially fixes issue #52423. Also makes errors and suggestions more consistent between move-from-place and move-from-value errors.
Limitations:
- Only the first pattern in a match arm can have a "consider removing this borrow operator" suggestion.
- Suggestions don't always compile as-is (see the TODOs in the test for details).
Sorry for the really long test. I wanted to make sure I handled every case I could think of, and it turned out there were a lot of them.
Questions:
- Is there any particular applicability I should set on those suggestions?
- Are the notes about the `Copy` trait excessive?
A few cleanups and minor improvements for the lexer
- improve readability by adjusting the formatting of some function signatures and adding some newlines
- reorder some functions for easier reading
- remove redundant `'static` in `const`s
- remove some explicit `return`s
- read directly to a `String` in `gather_comments_and_literals`
- change `unwrap_or!` (macro) to `unwrap_or` (function)
- move an `assert!`ion from `try_next_token` (called in a loop) to `try_real_token` after all calls to `try_next_token`
- `#[inline]` some one-liner functions
- assign directly from an `if-else` expression
- refactor a `match` to `map_or`
- add a `token::is_irrelevant` function to detect tokens that are not "`real`"
This commit adds the necessary definitions for target specs and such as well as
the necessary support in libstd to compile basic `aarch64-pc-windows-msvc`
binaries. The target is not currently built on CI, but it can be built locally
with:
./configure --target=aarch64-pc-windows-msvc --set rust.lld
./x.py build src/libstd --target aarch64-pc-windows-msvc
Currently this fails to build `libtest` due to a linker bug (seemingly in LLD?)
which hasn't been investigate yet. Otherwise though with libstd you can build a
hello world program (linked with LLD). I've not tried to execute it yet, but it
at least links!
Full support for this target is still a long road ahead, but this is hopefully a
good stepping stone to get started.
Points of note about this target are:
* Currently defaults to `panic=abort` as support is still landing in LLVM for
SEH on AArch64.
* Currently defaults to LLD as a linker as I was able to get farther with it
than I was with `link.exe`
Rollup of 8 pull requests
Successful merges:
- #52453 (improve diagnostics for tests with custom return values)
- #53271 (use ? to simplify `TransitiveRelation.maybe_map`)
- #53279 (Extend documentation of `rustc_on_unimplemented`)
- #53342 (fix error for unsized packed struct field)
- #53344 (Add doc examples for std::alloc::{alloc,alloc_zeroed}.)
- #53368 (Ignore test that fails on stage1)
- #53388 (Fix links' color)
- #53396 (Fix since of Iterator::flatten to be a proper semver)
Failed merges:
r? @ghost
fix error for unsized packed struct field
It was really confusing to be told "only the last field of a struct may have a dynamically sized type" when only the last field *was* unsized.