| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
|
|
|
|
Signed-off-by: codehorseman <cricis@yeah.net>
|
|
|
|
r=joshtriplett
Ensure that `let_else` does not interact with `let_chains`
As requested on https://github.com/rust-lang/rust/pull/94927.
cc `@joshtriplett` `@estebank`
|
|
Extend the irrefutable_let_patterns lint to let chains
Implements the suggestion from https://github.com/rust-lang/rust/pull/94927#issuecomment-1067078300
We only look for complete suffixes or prefixes of irrefutable let patterns, so
that an irrefutable let pattern in a chain surrounded by refutable ones is
not linted, as it is an useful pattern that has no low-cost replacement (unlike suffixes or prefixes which can just be copied outside of the `if`: either into the `if`'s block, or the block surrounding the `if`).
If all patterns in a let chain are irrefutable, we lint as well.
Depends on #94958 ~~so I included it into the PR for now~~ *which has been merged since*.
r? `@estebank`
cc `@joshtriplett` `@c410-f3r`
|
|
Format core and std macro rules, removing needless surrounding blocks
Many of the asserting and printing macros in `core` and `std` are written with prehistoric-looking formatting, like this:
https://github.com/rust-lang/rust/blob/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/std/src/macros.rs#L96-L101
In modern Rust style this would conventionally be written as follows instead, always using braces and a trailing semicolon on the macro arms:
https://github.com/rust-lang/rust/blob/af53809c874e0afb7be966df4d3cfcaa05277c53/library/std/src/macros.rs#L98-L105
Getting rid of the unneeded braces inside the expansion reduces extraneous indentation in macro-expanded code. For example:
```rust
println!("repro {}", true);
```
```rust
// before:
{
::std::io::_print(
::core::fmt::Arguments::new_v1(
&["repro ", "\n"],
&[::core::fmt::ArgumentV1::new_display(&true)],
),
);
};
```
```rust
// after:
::std::io::_print(
::core::fmt::Arguments::new_v1(
&["repro ", "\n"],
&[::core::fmt::ArgumentV1::new_display(&true)],
),
);
```
|
|
|
|
Only look for complete suffixes or prefixes of irrefutable let patterns, so
that an irrefutable let pattern in a chain surrounded by refutable ones is
not linted, as it is an useful pattern.
|
|
relax `suspicious_auto_trait_impls` lint wrt lifetimes
fixes the warning for https://github.com/rust-lang/rust/issues/93367#issuecomment-1063993489.
|
|
|
|
|
|
fix typos
Rework of #94603 which got closed as I was trying to unmerge and repush. This is a subset of changes from the original pr as I sed'd whatever typos I remembered from the original PR
thanks to `@cuishuang` for the original PR
|
|
|
|
|
|
More robust fallback for `use` suggestion
Our old way to suggest where to add `use`s would first look for pre-existing `use`s in the relevant crate/module, and if there are *no* uses, it would fallback on trying to use another item as the basis for the suggestion.
But this was fragile, as illustrated in issue #87613
This PR instead identifies span of the first token after any inner attributes, and uses *that* as the fallback for the `use` suggestion.
Fix #87613
|
|
check ~Projection~ all supertrait bounds when confirming dyn candidate
I'm pretty sure Projection is the only other PredicateKind that we care about enforcing here.
Fixes #80800
|
|
|
|
|
|
|
|
r=flip1995,wesleywiser
Improve `expect` impl and handle `#[expect(unfulfilled_lint_expectations)]` (RFC 2383)
This PR updates unstable `ExpectationIds` in stashed diagnostics and adds some asserts to ensure that the stored expectations are really empty in the end. Additionally, it handles the `#[expect(unfulfilled_lint_expectations)]` case.
According to the [Errors and lints docs](https://rustc-dev-guide.rust-lang.org/diagnostics.html#diagnostic-levels) the `error` level should only be used _"when the compiler detects a problem that makes it unable to compile the program"_. As this isn't the case with `#[expect(unfulfilled_lint_expectations)]` I decided to only create a warning. To avoid adding a new lint only for this case, I simply emit a `unfulfilled_lint_expectations` diagnostic with an additional note.
---
r? `@wesleywiser` I'm requesting a review from you since you reviewed the previous PR https://github.com/rust-lang/rust/pull/87835. You are welcome to reassign it if you're busy :upside_down_face:
rfc: [RFC-2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html)
tracking issue: https://github.com/rust-lang/rust/issues/85549
cc: `@flip1995` In case you're also interested in this :)
|
|
Type params and assoc types have unit metadata if they are sized
Extend the logic in `Pointee` projection to ensure that we can satisfy `<T as Pointee>::Metadata = ()` if `T: Sized`.
cc: `@SimonSapin` and #93959
|
|
Stabilise `aarch64_target_feature`
This PR stabilises `aarch64_target_feature` - see https://github.com/rust-lang/rust/issues/90620
|
|
|
|
|
|
The Box in liballoc always has a field for the allocator. It is quite
hard to support both the old and new definition of Box in cg_clif so
this change uses the new definition in this test too.
|
|
Rollup of 3 pull requests
Successful merges:
- #94867 (Add regression test for `<i32 as Iterator>::count`)
- #94886 (Update browser-ui-test version used in CI)
- #94894 (Remove needless use of `Into`)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
r=Dylan-DPC
Add regression test for `<i32 as Iterator>::count`
Closes #84495
|
|
Fix exposing fields marked unstable or doc hidden
Closes https://github.com/rust-lang/rust/issues/89837
Work towards https://github.com/rust-lang/rust/issues/89554
Filter fields that are marked `doc(hidden)` or are unstable with that feature turned off. This brings structs and enums into alignment behavior-wise when emitting warning/errors about pattern exhaustiveness/reachability.
cc `@Nadrieril`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
notriddle:notriddle/single-colon-path-not-const-generics, r=cjgillot
diagnostics: single colon within `<>` probably, not type ascription
Fixes #94812
|
|
Return early to fix ICE
This fixes #94627, ICE happens because compiler tries to suggest constraining type parameter but the only constraint is implicit `std::Sized` one, so it gets removed and there is nothing to suggest resulting in ICE.
|
|
Co-authored-by: Camille Gillot <gillot.camille@gmail.com>
|
|
Fix ICE when using Box<T, A>, again
Sequel to #94043, fixes #94835.
|
|
diagnostics: do not spurriously claim something is "not an iterator"
Fixes a minor regression caused by #94746, where `iter::Filter` is spurriously declared "not an iterator."
|
|
[2/2] Implement macro meta-variable expression
Final part of https://github.com/rust-lang/rust/pull/93545#issuecomment-1050963295
r? `@petrochenkov`
|
|
|
|
Fixes a minor regression caused by #94746, where iter::Filter is
spurriously declared "not an iterator."
|
|
|
|
Fixes #84495
|
|
Fixes #94812
|
|
|