Changes:
````
Rustup to rust-lang/rust#69674
Use visit_place
Check for mutation
Only fires on temporaries
Extend `redundant_clone` to the case that cloned value is not consumed
add CR feedback
Improve documentation
Use `edition:2018` flag more widely
Update tests/ui/needless_doc_main.rs
Move links to the end of each chapter on adding_lints
Move links to the end of each chapter on CONTRIBUTING
Clean-up adding_lints.md
Clean-up CONTRIBUTING.md
needless_doc_main: only check rust code
Use `node_type_opt` over `node_type`
Fix doc
Fix ICE with trivial_bounds feature
clippy_lints: readme: don't mention crates.io since it is no longer used to publish clippy.
update rust-lang.github.io to rustc-dev-guide.rust-lang.org
Improve placeholder in map_unit_fn
Fix match single binding when in a let stmt
Improve error messages for {option,result}_map_unit_fn
Mention the setup instructions in CONTRIBUTING
redundant_pattern: take binding (ref, ref mut) into account in suggestion.
check_pat: delay creation of the "normal" vec until we reach the branch where is is actually needed
deps: bump itertools 0.8 -> 0.9
add lint on File::read_to_string and File::read_to_end
transition rustc-guide to rustc-dev-guide
Rename macro_use_import -> macro_use_imports
warn on macro_use attr
Fix deploy script for tag deploys
````
Fixes#69957
miri: ICE on invalid terminators
We've run a lot of MIR in Miri (including some generators) and never seen these.
@tmandry is it correct that `Yield` and `GeneratorDrop` get lowered away?
@eddyb @oli-obk what's with this `Abort` that does not seem to ever actually exist? Codegen *does* seem to handle it, so I wonder why Miri can get away without that. In fact, codegen handles it twice:
1d5241c962/src/librustc_codegen_ssa/mir/block.rs (L796)1d5241c962/src/librustc_codegen_ssa/mir/mod.rs (L296)
Implement Error for TryReserveError
I noticed that the Error trait wasn't implemented for TryReserveError. (#48043)
Not sure if the error messages and code style are 100% correct, it's my first time contributing to the Rust std.
Rename rustc guide
This is in preparation for https://github.com/rust-lang/rustc-guide/issues/470
Needs to be merged after we actually rename the guide.
Have used this to rename:
`git grep -l 'rustc_guide' | xargs sed -i 's/rustc_guide/rustc_dev_guide/g'`
`git grep -l 'rustc-guide' | xargs sed -i 's/rustc-guide/rustc-dev-guide/g'`
`git grep -l 'rustc guide' | xargs sed -i 's/rustc guide/rustc dev guide/g'`
Toolstate: remove redundant beta-week check.
I made a bit of a mistake in #69624. The "beta regression" doesn't need to be checked twice.
I also rolled up #69693 to avoid merge conflicts.
Document unsafe blocks in core::fmt
r? @RalfJung
CC: @rust-lang/wg-unsafe-code-guidelines
#66219
Sorry for the hiatus, but here's a few more files with the unsafe blocks documented! I think working on it smaller chunks like this will be easier for everyone.
Add Display and Error impls for proc_macro::LexError
This should allow LexError to play much nicer with the `?` operator.
Fixes#68896.
(I'm not sure if I did the stability attributes right, so if I need to change them, please let me know!)
Added tvOS as targets
This is a first attempt of adding support tvOS as described in #48862. It's got a lot of overlap with [src/librustc_target/spec/apple_ios_base.rs](31dd4f4acb/src/librustc_target/spec/apple_ios_base.rs).
I thought about refactoring `apple_ios_base.rs` to include this as well but that would require each of the ios and tvos targets to be of the something like the form `let base = opts(AppleOS::TV, Arch::Arm64)?;` I also did the same thing for watchOS because from what I can tell, all three targets (iOS, tvOS, and watchOS) have the same logic but have different parameters being sent to `xcrun`. Thoughts?
As far as the `data_layout` and other parameters to `Target`, I did as much research as I could but it really seems that processor in the [iPhone 11 is the same as the apple TV](https://en.wikipedia.org/wiki/Apple-designed_processors) so I didn't change any of those parameters.
I did get this to build and tested that it's actually running the the below logic (because the parameter to `xcrun` is `appletvos` not `tvos`).
I didn't manage to get it to actually compile a file with `fn main(){}` because I don't have the stdlib for `aarch64-apple-tvos` compiled it seems. Is there documentation for this?
Similar to the ending of https://github.com/rust-lang/rust/pull/63467, I'm not sure what to do next.
Rollup of 8 pull requests
Successful merges:
- #66472 (--show-coverage json)
- #69603 (tidy: replace `make check` with `./x.py test` in documentation)
- #69760 (Improve expression & attribute parsing)
- #69828 (fix memory leak when vec::IntoIter panics during drop)
- #69850 (panic_bounds_check: use caller_location, like PanicFnLangItem)
- #69876 (Add long error explanation for E0739)
- #69888 ([Miri] Use a session variable instead of checking for an env var always)
- #69893 (librustc_codegen_llvm: Use slices instead of 0-terminated strings)
Failed merges:
r? @ghost
[Miri] Use a session variable instead of checking for an env var always
In CTFE heavy code, checking the env var everytime is inefficient. We
can do a lot better by using a `Session` variable instead.
r? @RalfJung
Part of #69297
panic_bounds_check: use caller_location, like PanicFnLangItem
The `PanicFnLangItem` got switched to using `#[caller_location]` at some point, but `PanicBoundsCheckFnLangItem` was kept in the old style. For consistency, switch that one over to use `#[caller_location]` as well.
This is also helpful for Miri as it means the `assert_panic` machine hook never needs to know the current `Span`.
Improve expression & attribute parsing
This PR includes misc improvements to expression and attribute parsing.
1. Some code simplifications
2. Better recovery for various block forms, e.g. `loop statements }` (missing `{` after `loop`). (See e.g., `block-no-opening-brace.rs` among others for examples.)
3. Added recovery for e.g., `unsafe $b` where `$b` refers to a `block` macro fragment. (See `bad-interpolated-block.rs` for examples.)
4. ^--- These are done so that code sharing in block parsing is increased.
5. Added recovery for e.g., `'label: loop { ... }` (See `labeled-no-colon-expr.rs`.)
6. Added recovery for e.g., `&'lifetime expr` (See `regions-out-of-scope-slice.rs`.)
7. Added recovery for e.g., `fn foo() = expr;` (See `fn-body-eq-expr-semi.rs`.)
8. Simplified attribute parsing code & slightly improved diagnostics.
9. Added recovery for e.g., `Box<('a) + Trait>`.
10. Added recovery for e.g, `if true #[attr] {} else #[attr] {} else #[attr] if true {}`.
r? @estebank
tidy: replace `make check` with `./x.py test` in documentation
This PR includes a minor documentation update for tidy. It replaces the `make check` approach with `./x.py test` and describes how to execute the tidy checks (only) with ~~`./x.py test src/tools/tidy`~~ `./x.py test tidy`.
--show-coverage json
The purpose of this change is to be able to use it as a tool in docs.rs in order to provide some more stats to crates' owners. Eventually even create a badge or something along the line.
r? @QuietMisdreavus
parse: Tweak the function parameter edition check
Follow-up to https://github.com/rust-lang/rust/pull/69801.
Edition of a code fragment is inferred from "the place where the code is written".
For individual tokens like edition-specific keywords it may be the span of the token itself ("uninterpolated" span), but for larger code fragments it's probably not, in the test example the trait method is obviously written in "2015 edition code".
r? @Centril
Exhaustiveness checking, `Matrix::push`: recursively expand or-patterns
> There's an implicit invariant that there should be no or-patterns directly in the first column of the matrix, but this invariant is broken exactly when an or-pattern has a child that is itself an or-pattern.
Here we preserve this broken invariant by recursively expanding `PatKind::Or`s in `Matrix::push`.
Fixes https://github.com/rust-lang/rust/issues/69875.
r? @varkor
cc @Nadrieril
cc https://github.com/rust-lang/rust/issues/54883