Add a tidy check for leading newlines
This is fairly uncommon, but it can slip through when refactoring (as evidenced by the files with leading newlines here).
Enable NLL migrate mode on the 2015 edition
## What is in this PR?
* Remove the `-Zborrowck=ast` flag option from rustc.
* The default in the 2015 edition is now `-Zborrowck=migrate`.
* The 2018 edition default is unchanged: it's still `-Zborrowck=migrate`.
* Enable two-phase borrows (currently toggled via the `-Ztwo-phase-borrows` flag) on all editions.
* Remove most dead code that handled these options.
* Update tests for the above changes.
## What is *not* in this PR?
These are left for future PRs
* Use `-Zborrowck=mir` in NLL compare mode tests (#56993)
* Remove the `-Zborrowck=compare` option (#59193)
* Remove the `-Ztwo-phase-borrows` flag. It's kept, as a flag that does nothing so that perf.rlo has time to stop using it (cc @Mark-Simulacrum)
* Remove MIR typeck as its own MIR pass - it's now run by NLL.
* Enabling `-Zborrowck=mir` by default (#58781)
* Replace `allow_bind_by_move_patterns_with_guards` and `check_for_mutation_in_guard_via_ast_walk` with just using the feature gate. (#59192)
Soundness issues that are fixed by NLL will stay open until full NLL is emitting hard errors. However, these diagnostics and completeness issues can now be closed:
Closes#18330Closes#22323Closes#23591Closes#26736Closes#27487Closes#28092Closes#28970Closes#29733Closes#30104Closes#38915Closes#39908Closes#43407Closes#47524Closes#48540Closes#49073Closes#52614Closes#55085Closes#56093Closes#56496Closes#57804
cc #43234
r? @pnkfelix
cc @rust-lang/lang
cc @rust-lang/wg-compiler-nll
save-analysis: Use serde instead of libserialize to dump JSON data
This breaks the save-analysis infrastructure (which also includes `rls-{analysis, data, span}` crates) from depending on rustc_serialize and so we can start moving them to being supported on stable without implementing `Decodable` et al. by hand for data structures defined there.
Notable benefits:
- we drop the awkward raw byte `PathBuf` [serialization](https://gist.github.com/Xanewok/f4fe8564d0dc0c3ab1dbc244279ff895) (until now (de)serialized as `&[u8]`)
- [faster](https://github.com/serde-rs/json-benchmark) (hopefully noticeable for inner crate dependencies for the RLS workloads)
- we can easily explore the binary serialization backend (which we planned to do for save-analysis anyway)
~This should be merged together with an update to RLS (https://github.com/rust-lang/rls/pull/1435), which technically could be included right now because we can use the bundled `rls-analysis` here directly, however I'd prefer to publish this to crates.io first (https://github.com/rust-lang/rls/pull/1434, cc @nrc) and use the published version, instead.~
Includes https://github.com/rust-lang/rls/pull/1436.
@matklad @nikomatsakis This is also important for the potential RLS 1.0 - 2.0 bridge we talked about on Zulip today
Remove mutability from `Def::Static`
Querify `TyCtxt::is_static`.
Use `Mutability` instead of bool in foreign statics in AST/HIR.
cc https://github.com/rust-lang/rust/pull/60110
r? @eddyb
This also bumps RLS version to 1.36.
The updated rls-* packages use serde but *not* serde_derive thanks to
manual proc macro expansion. This is a hack, since rustc cannot handle
crates.io proc macros (duplicated in tools) when cross-compiling, so
that's the best we can do in order to support serde_json in save-analysis.
Fix fn front matter parsing ICE from invalid code.
Fixes#60075.
This PR fixes an "unreachable code" ICE that results from parsing
invalid code where the compiler is expecting the next trait item
declaration in the middle of the previous trait item due to extra
closing braces.
r? @estebank (thanks for the minimized test case)
This commit fixes an "unreachable code" ICE that results from parsing
invalid code where the compiler is expecting the next trait item
declaration in the middle of the previous trait item due to extra
closing braces.
Doc fixes for core::future::Future.
Fixed outdated reference to `waker` argument; now futures are passed a
`Context`, from which one can obtain a `waker`.
Cleaned up explanation of what happens when you call `poll` on a completed
future. It doesn't make sense to say that `poll` implementations can't cause
memory unsafety; no safe function is ever allowed to cause memory unsafety, so
why mention it here? It seems like the intent is to say that the `Future` trait
doesn't say what the consequences of excess polls will be, and they might be
bad; but that the usual constraints that Rust imposes on any non-`unsafe`
function still apply. It's also oddly specific to say 'memory corruption'
instead of just 'undefined behavior'; UB is a bit jargony, so the text should
provide examples.