| Age | Commit message (Collapse) | Author | Lines |
|
|
|
remove Key impls for types that involve an AllocId
I don't understand how but somehow that leads to issues like https://github.com/rust-lang/rust/issues/83085? Anyway removing unused impls doesn't seem like a bad idea. The concerning part is that of course nothing will stop us from having such impls again in the future, alongside re-introducing bugs like #83085.
r? `@oli-obk`
|
|
rustc_monomorphize: Introduce check_fn_args_move_size()
This is in preparation of improving diagnostics of "large moves into functions", a.k.a. passing args.
Note: This PR consists of two self-contained commits that can be reviewed independently.
For https://github.com/rust-lang/rust/issues/83518
Also see https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/arg.20Spans.20for.20TerminatorKind.3A.3ACall.3F
r? `@oli-obk` who is E-mentor
|
|
fix detecting references to packed unsized fields
Fixes https://github.com/rust-lang/rust/issues/115396
This is a breaking change, but permitted as a soundness fix.
|
|
fix fast-path for try_eval_scalar_int
Cc https://github.com/rust-lang/rust/pull/116281 `@Nadrieril`
|
|
So that we later can improve the accuracy of diagnostics.
|
|
And rename to check_operand_move_size(). Later we will introduce
check_fn_args_move_size().
|
|
For `[T; 1]` it's silly to copy as `<1 x T>` when we can just copy as `T`.
|
|
Detect missing `=>` after match guard during parsing
```
error: expected one of `,`, `:`, or `}`, found `.`
--> $DIR/missing-fat-arrow.rs:25:14
|
LL | Some(a) if a.value == b {
| - while parsing this struct
LL | a.value = 1;
| -^ expected one of `,`, `:`, or `}`
| |
| while parsing this struct field
|
help: try naming a field
|
LL | a: a.value = 1;
| ++
help: you might have meant to start a match arm after the match guard
|
LL | Some(a) if a.value == b => {
| ++
```
Fix #78585.
|
|
dont call mir.post_mono_checks in codegen
It seems like all tests are still passing when I remove this... let's see what CI says.
|
|
Rollup of 7 pull requests
Successful merges:
- #114564 (Attempt to describe the intent behind the `From` trait further)
- #116297 (add some docs to hooks/mod.rs)
- #116423 (Fix typo in attrs.rs)
- #116466 (`rustc_transmute` cleanups)
- #116474 (Assorted small cleanups)
- #116481 (Reuse existing `Some`s in `Option::(x)or`)
- #116484 (Minor doc clarification in Once::call_once)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Assorted small cleanups
r? `@spastorino`
|
|
`rustc_transmute` cleanups
Just some things I found while poking around this code.
r? `@oli-obk`
|
|
add some docs to hooks/mod.rs
r? `@oli-obk`
|
|
Show more information when multiple `impl`s apply
- When there are `impl`s without type params, show only those (to avoid showing overly generic `impl`s).
```
error[E0283]: type annotations needed
--> $DIR/multiple-impl-apply.rs:34:9
|
LL | let y = x.into();
| ^ ---- type must be known at this point
|
note: multiple `impl`s satisfying `_: From<Baz>` found
--> $DIR/multiple-impl-apply.rs:14:1
|
LL | impl From<Baz> for Bar {
| ^^^^^^^^^^^^^^^^^^^^^^
...
LL | impl From<Baz> for Foo {
| ^^^^^^^^^^^^^^^^^^^^^^
= note: required for `Baz` to implement `Into<_>`
help: consider giving `y` an explicit type
|
LL | let y: /* Type */ = x.into();
| ++++++++++++
```
- Lower the importance of `T: Sized`, `T: WellFormed` and coercion errors, to prioritize more relevant errors. The pre-existing deduplication logic deals with hiding redundant errors better that way, and we show errors with more metadata that is useful to the user.
- Show `<SelfTy as Trait>::assoc_fn` suggestion in more cases.
```
error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
--> $DIR/cross-return-site-inference.rs:38:16
|
LL | return Err(From::from("foo"));
| ^^^^^^^^^^ cannot call associated function of trait
|
help: use a fully-qualified path to a specific available implementation
|
LL | return Err(</* self type */ as From>::from("foo"));
| +++++++++++++++++++ +
```
Fix #88284.
|
|
|
|
|
|
|
|
|
|
|
|
Allow file names to end with '>'
The [`rustc_span::FileName`](https://doc.rust-lang.org/stable/nightly-rustc/rustc_span/enum.FileName.html) enum already differentiates between real files and "fake" files such as `<anon>`. We do not need to artificially forbid real file names from ending in `>`.
Closes #73419
|
|
This is simpler and avoids unnecessary calls to `env::current_dir`.
rustc_plugin is left unchanged to avoid conflicts with #116412.
Updates #116426.
|
|
This is simpler and avoids unnecessary calls to `env::current_dir`.
|
|
Use `std::path::PathBuf` rather than `String`; use `std::env::var_os`
rather than `std::env::var`. These changes avoid a number of error paths
which can arise in the presence of non-UTF-8 paths.
|
|
There are 3 instances of var(...) and 3 instances of var_os(...); the
latter avoids an appearance of unhandled error, so use it everywhere.
|
|
|
|
update some comments around swap()
Based on ``@eddyb's`` comment [here](https://github.com/rust-lang/unsafe-code-guidelines/issues/461#issuecomment-1742156410).
And then I noticed the wrong capitalization for Miri and fixed it in some other places as well.
|
|
Add more diagnostic items for clippy
|
|
As per
https://github.com/rust-lang/rust/blob/master/src/doc/style-guide/src/cargo.md,
which says:
> Sort key names alphabetically within each section, with the exception
> of the [package] section.
And use tidy to enforce it.
|
|
Clarify `invalid_reference_casting` lint around interior mutable types
This is PR intends to clarify the `invalid_reference_casting` lint around interior mutable types by adding a note for them saying that they should go through `UnsafeCell::get`.
So for this code:
```rust
let cell = &std::cell::UnsafeCell::new(0);
let _num = &mut *(cell as *const _ as *mut i32);
```
the following note will be added to the lint output:
```diff
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
--> $DIR/reference_casting.rs:68:16
|
LL | let _num = &mut *(cell as *const _ as *mut i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+ = note: even for types with interior mutability, the only legal way to obtain a mutable pointer from a shared reference is through `UnsafeCell::get`
```
Suggestion are welcome around the note contents.
Fixes https://github.com/rust-lang/rust/issues/116410
cc `@RalfJung`
|
|
|
|
|
|
Also sort them.
|
|
It appears identically as a closure in two functions.
Also change its return type from `bool` to `Option<()>` so it can be
used with `?`.
|
|
|
|
|
|
Because there is also a `MaybeTransmutableQuery<Dfa<...>, C>` impl, and
we don't need both.
|
|
It was duplicated from the method above.
|
|
As per the `FIXME` comment, it's an abstraction that makes the code
harder to read.
|
|
Bring back generic parameters for indices in rustc_abi and make it compile on stable
This effectively reverses https://github.com/rust-lang/rust/pull/107163, allowing rust-analyzer to depend on this crate again,
It also moves some glob imports / expands them in the first commit because they made it more difficult for me to reason about things.
|
|
It's hyper-optimized, we don't need our own unsafe code here.
This requires getting rid of all the `Allocator` stuff, which isn't
needed anyway.
|
|
Making them consistent with similar impls.
|
|
|
|
`serialize.rs` has the `Encodable`/`Decodable` impls for lots of basic
types, including `Vec`. `collection_impls` has it for lots of collection
types. The distinction isn't really meaningful, and it's simpler to have
them all in a single file.
|
|
|
|
|
|
|
|
|
|
I.e. `maybe_uninit_slice` and `new_uninit`.
Also sort the remaining features and remove an ugly, low-value comment.
|
|
|