| Age | Commit message (Collapse) | Author | Lines |
|
Add sample fix for E0749
Even though the description is clear but the solution may not be as straightforward.
Adding a suggested fix from documentation side.
r? @GuillaumeGomez
However, this suggestion should be shown in rustc itself for easy fix, the documentation should also reflect on the changes in rustc. Currently,
```
error[E0749]: negative impls cannot have any items
--> test.rs:6:5
|
6 | type Foo = i32; // error!
| ^^^^^^^^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0749`.
```
rustc should tell the user to remove it.
|
|
unused_delims: trim expr
improves rustfix output.
|
|
Tiny cleanup, remove unnecessary `unwrap`
Remove unnecessary `unwrap`.
|
|
Tweak conditions for E0026 and E0769
When we have a tuple struct used with struct we don't want to suggest using the (valid) struct syntax with numeric field names. Instead we want to suggest the expected syntax.
Given
```rust
fn main() {
match MyOption::MySome(42) {
MyOption::MySome { x: 42 } => (),
_ => (),
}
}
```
We now emit E0769 "tuple variant `MyOption::MySome` written as struct variant" instead of E0026 "variant `MyOption::MySome` does not have a field named `x`".
|
|
r=GuillaumeGomez
Rustdoc: Fix natural ordering to look at all numbers.
The old implementation only looks at numbers at the end, but not in other places in a name: `u8` and `u16` got sorted properly, but `u8_bla` and `u16_bla` did not.

|
|
move stack size check to const_eval machine
This is consistent with how we enforce the step limit. In particular, we do not want this limit checked for Miri-the-tool.
|
|
polymorphize: constrain unevaluated const handling
This PR constrains the support added for handling unevaluated consts in polymorphization (introduced in #75260) by:
- Skipping associated constants as this causes cycle errors.
- Skipping promoted constants when they contain `Self` as this ensures `T` is used in constants of the form `<Self as Foo<T>>`.
Due to an oversight on my part, when landing #75260 and #75255, some tests started failing when polymorphization was enabled that I didn't notice until after landing - this PR fixes the regressions from #75260.
r? @lcnr
|
|
Miri: Renamed "undef" to "uninit"
Renamed remaining references to "undef" to "uninit" when referring to Miri.
Impacted directories are:
- `src/librustc_codegen_llvm/consts.rs`
- `src/librustc_middle/mir/interpret/`
- `src/librustc_middle/ty/print/pretty.rs`
- `src/librustc_mir/`
- `src/tools/clippy/clippy_lints/src/consts.rs`
Upon building Miri based on the new changes it was verified that no changes needed to be made with the Miri project.
Related issue #71193
|
|
Rollup of 10 pull requests
Successful merges:
- #75098 (Clippy pointer cast lint experiment)
- #75249 (Only add a border for the rust logo)
- #75315 (Avoid deleting temporary files on error)
- #75316 (Don't try to use wasm intrinsics on vectors)
- #75337 (instance: only polymorphize upvar substs)
- #75339 (evaluate required_consts when pushing stack frame in Miri engine)
- #75363 (Use existing `infcx` when emitting trait impl diagnostic)
- #75366 (Add help button)
- #75369 (Move to intra-doc links in /library/core/src/borrow.rs)
- #75379 (Use intra-doc links in /library/core/src/cmp.rs)
Failed merges:
r? @ghost
|
|
Add help button
Part of #75197.
Here is a screenshot of the result:

r? @jyn514
|
|
Use existing `infcx` when emitting trait impl diagnostic
Fixes #75361
Fixes #74918
Previously, we were creating a new `InferCtxt`, which caused an ICE when
used with type variables from the existing `InferCtxt`
|
|
evaluate required_consts when pushing stack frame in Miri engine
[Just like codegen](https://github.com/rust-lang/rust/pull/70820/files#diff-32c57af5c8e23eb048f55d1e955e5cd5R194), Miri needs to make sure all `required_consts` evaluate successfully, to catch post-monomorphization errors.
While at it I also moved the const_eval error reporting logic into rustc_mir::const_eval::error; there is no reason it should be in `rustc_middle`. I kept this in a separate commit for easier reviewing.
Helps with https://github.com/rust-lang/miri/issues/1382. I will add a test on the Miri side (done now: https://github.com/rust-lang/miri/pull/1504).
r? @oli-obk
|
|
instance: only polymorphize upvar substs
This PR restricts the substitution polymorphization added in #75255 to only apply to the tupled upvar substitution, rather than all substitutions, fixing a bunch of regressions when polymorphization is
enabled.
Due to an oversight on my part, when landing #75260 and #75255, some tests started failing when polymorphization was enabled that I didn't notice until after landing - this PR fixes the regressions from #75255. #75336 has been filed to make sure that we don't forget to try make this change again in future, as it does enable some optimisations.
r? @lcnr
|
|
Don't try to use wasm intrinsics on vectors
This commit fixes an issue with #74695 where the fptosi and fptoui
specializations on wasm were accidentally used on vector types by the
`simd_cast` intrinsic. This issue showed up as broken CI for the stdsimd
crate. Here this commit simply skips the specialization on vector kinds
flowing into `fpto{s,u}i`.
|
|
Avoid deleting temporary files on error
Previously if the compiler error'd, fatally, then temporary directories which
should be preserved by -Csave-temps would be deleted due to fatal compiler
errors being implemented as panics.
cc @infinity0
(Hopefully) fixes #75275, but I haven't tested
|
|
Only add a border for the rust logo



I didn't add a border for the light theme though, as I felt it as unnecessary.
r? @Manishearth
|
|
Clippy pointer cast lint experiment
This PR is an experiment about exposing more parts of `rustc_typeck` for use in `clippy`. In particular, the code that checks where a cast is valid or not was exposed, which necessitated exposing [`FnCtxt`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/check/struct.FnCtxt.html), and figuring out how to create an instance of that type inside `clippy`.
This was prompted by [this clippy issue](https://github.com/rust-lang/rust-clippy/issues/2064).
r? @oli-obk
|
|
Clean up errors in typeck and resolve
* Tweak ordering of suggestions
* Do not suggest similarly named enclosing item
* Point at item definition in foreign crates
* Add missing primary label
CC #34255.
|
|
r=petrochenkov
Tweak confusable idents checking
The confusable idents checking does some sub-optimal things with symbols.
r? @petrochenkov
cc @crlf0710
|
|
Fix async-std by special-casing rustdoc in typeck
https://github.com/rust-lang/rust/issues/75100
|
|
|
|
|
|
|
|
Modify logic to make it easier to follow and recover labels that would
otherwise be lost.
|
|
Don't print "const" keyword on non-nightly build if rustc_const_unstable is used on the item
Fixes #74579.
|
|
|
|
Remove restriction on type parameters preceding consts w/ feature const-generics
Removed the restriction on type parameters preceding const parameters when the feature const-generics is enabled.
Builds on #74676, which deals with unsorted generic parameters. This just lifts the check in lowering the AST to HIR that permits consts and types to be reordered with respect to each other. Lifetimes still must precede both
This change is not intended for min-const-generics, and is gated behind the `#![feature(const_generics)]`.
One thing is that it also permits type parameters without a default to come after consts, which I expected to not work, and was hoping to get more guidance on whether that should be permitted or how to prevent it otherwise.
I did not go through the RFC process for this pull request because there was prior work to get this feature added. In the previous PR that was cited, work was done to enable this change.
r? @lcnr
|
|
|
|
|
|
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
|
|
|
|
update Miri
Fixes https://github.com/rust-lang/rust/issues/75274
Cc @rust-lang/miri r? @ghost
|
|
This commit constrains the support added for handling unevaluated consts
in polymorphization (introduced in #75260) by:
- Skipping associated constants as this causes cycle errors.
- Skipping promoted constants when they contain `Self` as this ensures
`T` is used in constants of the form `<Self as Foo<T>>`.
Signed-off-by: David Wood <david@davidtw.co>
|
|
Fixes #75361
Fixes #74918
Previously, we were creating a new `InferCtxt`, which caused an ICE when
used with type variables from the existing `InferCtxt`
|
|
Even though the description is clear but the solution may not be as straightforward.
Adding a suggested fix.
|
|
|
|
|
|
|
|
|
|
Upgrade the FreeBSD toolchain to version 11.4
FreeBSD 10 reached its end-of-life in October 2018, and that toolchain
caused issues in the LLVM 11 upgrade (#73526) that are resolved with the
toolchain from FreeBSD 11.
Closes #72390.
|
|
r=petrochenkov
MinGW: disable self-contained mode when cross compiling
When cross compiling users have to provide own linker and libraries anyway.
Using rust provided MinGW crt objects is harmful here and has no benefits.
cc https://github.com/rust-lang/rust/issues/68887
|
|
Remove unnecessary `unwrap`.
|
|
When we have a tuple struct used with struct we don't want to suggest using
the (valid) struct syntax with numeric field names. Instead we want to
suggest the expected syntax.
Given
```rust
fn main() {
match MyOption::MySome(42) {
MyOption::MySome { x: 42 } => (),
_ => (),
}
}
```
We now emit E0769 "tuple variant `MyOption::MySome` written as struct variant"
instead of E0026 "variant `MyOption::MySome` does not have a field named `x`".
|
|
Rollup of 8 pull requests
Successful merges:
- #74200 (Std panicking unsafe block in unsafe fn)
- #75286 (Add additional case for Path starts with)
- #75318 (Resolve `char` as a primitive even if there is a module in scope)
- #75320 (Detect likely `for foo of bar` JS syntax)
- #75328 (Cleanup E0749)
- #75344 (Rename "Important traits" to "Notable traits")
- #75348 (Move to intra-doc links in library/core/src/time.rs)
- #75350 (Do not ICE when lowering invalid extern fn with bodies)
Failed merges:
r? @ghost
|
|
Do not ICE when lowering invalid extern fn with bodies
Fix #75283.
|
|
r=Manishearth
Rename "Important traits" to "Notable traits"
Fixes #75245.
---
* Rename it in the UI
* Rename the CSS classes
|
|
Cleanup E0749
r? @pickfire
|
|
Detect likely `for foo of bar` JS syntax
Fix #75311.
|
|
Resolve `char` as a primitive even if there is a module in scope
Closes https://github.com/rust-lang/rust/issues/58699.
r? @Manishearth
|
|
Fix #75283.
|