Make anon params lint warn-by-default
This is intended as a followup on anonymous parameters deprecation.
Cross-posting from #41686:
> After having read a bit more of the discussion that I can find, I propose a more aggressive deprecation strategy:
> - We make the lint warn-by-default as soon as possible
> - We make anon parameters a hard error at the epoch boundary
cc @matklad @est31 @aturon
When encountering an unexisting method for a given trait where an
associated function has the same name, suggest using the appropriate
syntax, instead of using `help` text.
When only one candidate is found, do not call it "candidate #1", just
call it "the candidate".
Ensure every unstable language feature has a tracking issue.
Filled in the missing numbers:
* `abi_ptx` → #38788
* `generators` → #43122
* `global_allocator` → #27389
Reused existing tracking issues because they were decomposed from a larger feature
* `*_target_feature` → #44839 (reusing the old `target_feature` number)
* `proc_macros_*` → #38356 (reusing the to-be-stabilized `proc_macros` number)
Filed new issues
* `exhaustive_patterns` → #51085
* `pattern_parentheses` → #51087
* `wasm_custom_section` and `wasm_import_module` → #51088
Point to the current box syntax tracking issue
The issue was used for both box syntax as well as placement new.
It got closed due to placement new being unapproved.
So a new one got created for box syntax, yet neither
the unstable book nor feature_gate.rs got updated.
We are doing this now.
r? @aidanhs
The issue was used for both box syntax as well as placement new.
It got closed due to placement new being unapproved.
So a new one got created for box syntax, yet neither
the unstable book nor feature_gate.rs got updated.
We are doing this now.
make ui tests robust with respect to NLL
This PR revises the `ui` tests that I could quickly identify that:
1. previously had successful compilations under non-lexical lifetimes (NLL) because they assumed lexical lifetimes, but
2. such assumption of lexical lifetimes was actually not necessarily part of the spirit of the original issue/bug we want to witness.
In many cases, this is simply a matter of adding a use of a borrow so that it gets extended long enough to observe a conflict.
(In some cases the revision was more subtle, such as adding a destructor, or revising the order of declaration of some variables.)
----
With these test revisions in place, I subsequently updated the expected stderr output under the NLL compiletest mode. So now we should get even more testing of NLL than we were before.
Fix#51025
Fix behaviour of divergence in while loop conditions
This fixes `'a: while break 'a {};` being treated as diverging, by tracking break expressions in the same way as in `loop` expressions.
Fixes#50856.
r? @nikomatsakis
Rollup of 11 pull requests
Successful merges:
- #50987 (Underline multiple suggested replacements in the same line)
- #51014 (Add documentation about env! second argument)
- #51034 (Remove unused lowering field and method)
- #51047 (Use AllFacts from polonius-engine)
- #51048 (Add more missing examples for Formatter)
- #51056 (Mention and use `Once::new` instead of `ONCE_INIT`)
- #51059 (What does an expression look like, that consists only of special characters?)
- #51065 (Update nomicon link in transmute docs)
- #51067 (Add inner links in documentation)
- #51070 (Fail typecheck if we encounter a bogus break)
- #51073 (Rename TokenStream::empty to TokenStream::new)
Failed merges:
Rename TokenStream::empty to TokenStream::new
There is no precedent for the `empty` name -- we do not have `Vec::empty` or `HashMap::empty` etc.
I would propose landing this but reflecting it in a non-breaking release of proc-macro2 that provides both `new` and a deprecated `empty` constructor.
Tracking issue: #38356
r? @alexcrichton
Fail typecheck if we encounter a bogus break
Lone breaks outside of loops create errors in the
loop check pass but as they are not fatal,
compilation continues.
MIR building code assumes all HIR break statements
to point to valid locations and fires ICEs if this
assumption is violated. In normal compilation,
this causes no issues, as code apparently prevents
MIR from being built if errors are present.
However, before that, typecheck runs and with it
MIR const eval. Here we operate differently
from normal compilation: it doesn't check for any
errors except for type checker ones and then
directly builds the MIR.
This constellation causes an ICE-on-error if
bogus break statements are being put into array
length expressions.
This commit fixes this ICE by letting typecheck
fail if bogus break statements are encountered.
This way, MIR const eval fails cleanly with a
type check error.
Fixes#50576Fixes#50581
Add inner links in documentation
From [this SO question](https://stackoverflow.com/q/50518757/2733851) it looks like this page isn't really clear.
I personally do think this page is quite clear, the only think I could think of was adding some references.
Remove unused lowering field and method
r? @nikomatsakis
So while trying to understand lowering better, I found out that there's something related to creating definitions. Analyzing that further, I realized that it is entirely dead code.
The `parent_def` field was only ever used for setting and resetting the field itself. The field was never read anywhere else and thus its value was entirely unused.
Maybe the `unused_field` lint should detect when the only use of a field is the field being read without using the read value other than writing back to the field?
The diff is best viewed without whitespace changes getting in the way: https://github.com/rust-lang/rust/pull/51034/files?w=1
std: Ensure OOM is classified as `nounwind`
OOM can't unwind today, and historically it's been optimized as if it can't
unwind. This accidentally regressed with recent changes to the OOM handler, so
this commit adds in a codegen test to assert that everything gets optimized away
after the OOM function is approrpiately classified as nounwind
Closes#50925