| Age | Commit message (Collapse) | Author | Lines |
|
|
|
diagnostics: only talk about `Cargo.toml` if running under Cargo
Fixes #94646
|
|
Generalize `get_nullable_type` to allow types where null is all-ones.
Generalize get_nullable_type to accept types that have an all-ones bit
pattern as their sentry "null" value.
This will allow [`OwnedFd`], [`BorrowedFd`], [`OwnedSocket`], and
[`BorrowedSocket`] to be marked with
`#[rustc_nonnull_optimization_guaranteed]`, which will allow
`Option<OwnedFd>`, `Option<BorrowedFd>`, `Option<OwnedSocket>`, and
`Option<BorrowedSocket>` to be used in FFI declarations, as described
in the [I/O safety RFC].
For example, it will allow a function like `open` on Unix and `WSASocketW`
on Windows to be declared using `Option<OwnedFd>` and `Option<OwnedSocket>`
return types, respectively.
The actual change to add `#[rustc_nonnull_optimization_guaranteed]`
to the abovementioned types will be a separate PR, as it'll depend on
having this patch in the stage0 compiler.
Also, update the diagnostics to mention that "niche optimizations" are
used in libstd as well as libcore, as `rustc_layout_scalar_valid_range_start`
and `rustc_layout_scalar_valid_range_end` are already in use in libstd.
[`OwnedFd`]: https://github.com/rust-lang/rust/blob/c9dc44be24c58ff13ce46416c4b97ab5c1bd8429/library/std/src/os/fd/owned.rs#L49
[`BorrowedFd`]: https://github.com/rust-lang/rust/blob/c9dc44be24c58ff13ce46416c4b97ab5c1bd8429/library/std/src/os/fd/owned.rs#L29
[`OwnedSocket`]: https://github.com/rust-lang/rust/blob/c9dc44be24c58ff13ce46416c4b97ab5c1bd8429/library/std/src/os/windows/io/socket.rs#L51
[`BorrowedSocket`]: https://github.com/rust-lang/rust/blob/c9dc44be24c58ff13ce46416c4b97ab5c1bd8429/library/std/src/os/windows/io/socket.rs#L29
[I/O safety RFC]: https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md#ownedfd-and-borrowedfdfd-1
|
|
Emit `unused_attributes` if a level attr only has a reason
Fixes a comment from `compiler/rustc_lint/src/levels.rs`. Lint level attributes that only contain a reason will also trigger the `unused_attribute` lint. The lint now also checks for the `expect` lint level.
That's it, have a great rest of the day for everyone reasoning this :upside_down_face:
cc: #55112
|
|
Tweak output for non-exhaustive `match` expression
* Provide structured suggestion when missing `match` arms
* Move pointing at the missing variants *after* the main error
<img width="1164" alt="" src="https://user-images.githubusercontent.com/1606434/146312085-b57ef4a3-6e96-4f32-aa2a-803637d9eeba.png">
|
|
|
|
|
|
|
|
|
|
`span_label`
This makes the order of the output always consistent:
1. Place of the `match` missing arms
2. The `enum` definition span
3. The structured suggestion to add a fallthrough arm
|
|
Given
```rust
match Some(42) {
Some(0) => {}
Some(1) => {}
}
```
suggest
```rust
match Some(42) {
Some(0) => {}
Some(1) => {}
None | Some(_) => todo!(),
}
```
|
|
Given
```rust
match Some(42) {
Some(0) => {}
}
```
suggest
```rust
match Some(42) {
Some(0) => {}
None | Some(_) => todo!(),
}
```
|
|
Given
```rust
match Some(42) {}
```
suggest
```rust
match Some(42) { None | Some(_) => todo!(), }
```
|
|
|
|
|
|
|
|
|
|
Fixes #94646
|
|
|
|
|
|
|
|
|
|
It caused an ICE since `item` was `None`.
|
|
compiler-errors:free-regions-in-copy-predicate-check, r=oli-obk
Erase regions when checking for missing Copy predicates
Fixes #94662
|
|
add tests for #94502
cc #94552
|
|
|
|
Check extra function arg exprs even if the fn is not C-variadic
We should still call check_expr on the args that exceed the formal input ty count, so that we have expr types to emit during writeback.
Not sure where this regressed, but it wasn't due to the same root cause as #94334 I think. I thought this might've regressed in #92360, but I think that is in stable, ad the test I provided (which minimizes #94599) passes on stable in playground. Maybe it regressed in #93118.
Anywho, fixes #94599.
|
|
|
|
|
|
|
|
|
|
Change location of where clause on GATs
Closes #89122
~Blocked on lang FCP~
r? `@nikomatsakis`
|
|
|
|
Rollup of 4 pull requests
Successful merges:
- #94630 (Update note about tier 2 docs.)
- #94633 (Suggest removing a semicolon after derive attributes)
- #94642 (Fix source code pages scroll)
- #94645 (do not attempt to open cgroup files under Miri)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
|
|
|
|
|
|
|
|
TaKO8Ki:suggest-removing-semicolon-after-derive-attribute, r=cjgillot
Suggest removing a semicolon after derive attributes
closes #93942
|
|
Implement RFC 3184 - thread local cell methods
This implements [RFC 3184](https://github.com/rust-lang/rfcs/pull/3184), with `@danielhenrymantilla's` [suggestion](https://github.com/rust-lang/rfcs/pull/3184#issuecomment-965773616) for the `with_` method names.
Tracking issue: https://github.com/rust-lang/rust/issues/92122
|
|
use current token span
|
|
|
|
|
|
|
|
Rollup of 6 pull requests
Successful merges:
- #94446 (UNIX `remove_dir_all()`: Try recursing first on the slow path)
- #94460 (Reenable generator drop tracking tests and fix mutation handling)
- #94620 (Edit docs on consistency of `PartialOrd` and `PartialEq`)
- #94624 (Downgrade `#[test]` on macro call to warning)
- #94626 (Add known-bug directive to issue #47511 test case)
- #94631 (Fix typo in c-variadic)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
|
|
Add known-bug directive to issue #47511 test case
|
|
Downgrade `#[test]` on macro call to warning
Follow up to #92959. Address #94508.
|
|
Reenable generator drop tracking tests and fix mutation handling
The previous PR, #94068, was overly zealous in counting mutations as borrows, which effectively nullified drop tracking. We would have caught this except the drop tracking tests were still ignored, despite having the option of using the `-Zdrop-tracking` flag now.
This PR fixes the issue introduced by #94068 by only counting mutations as borrows the mutated place has a project. This is sufficient to distinguish `x.y = 42` (which should count as a borrow of `x`) from `x = 42` (which is not a borrow of `x` because the whole variable is overwritten).
This PR also re-enables the drop tracking regression tests using the `-Zdrop-tracking` flag so we will avoid introducing these sorts of issues in the future.
Thanks to ``@tmiasko`` for noticing this problem and pointing it out!
r? ``@tmiasko``
|
|
Do not point at whole file missing `fn main`
Only point at the end of the crate. We could try making it point at the
beginning of the crate, but that is confused with `DUMMY_SP`, causing
the output to be *worse*.
This change will make it so that VSCode will *not* underline the whole
file when `main` is missing, so other errors will be visible.
|