| Age | Commit message (Collapse) | Author | Lines |
|
use push(char) to add chars (single-char &strs) to strings instead of push_str(&str)
|
|
take reference to Place directly instead of taking reference to Box<Place>
clippy::borrowed_box
|
|
small typo fix in rustc_parse docs
small typo in rustc_parse::new_parser_from_file's documentation
I'm not sure a PR is the way to do this though.
|
|
add the `const_evaluatable_checked` feature
Implements a rather small subset of https://github.com/rust-lang/compiler-team/issues/340
Unlike the MCP, this does not try to compare different constant, but instead only adds the constants found in where clauses
to the predicates of a function. This PR adds the feature gate `const_evaluatable_checked`, without which nothing should change.
r? @oli-obk @eddyb
|
|
Validate removal of AscribeUserType, FakeRead, and Shallow borrow
Those statements are removed by CleanupNonCodegenStatements pass
in drop lowering phase, and should not occur afterwards.
|
|
r=estebank
typeck: don't suggest inaccessible private fields
Fixes #76077.
This PR adjusts the missing field diagnostic logic in typeck so that when none of the missing fields in a struct expr are accessible then the error is less confusing.
r? @estebank
|
|
This commit adjusts the missing field diagnostic logic for struct
patterns in typeck to improve the diagnostic when the missing fields are
inaccessible.
Signed-off-by: David Wood <david@davidtw.co>
|
|
This commit adjusts the missing field diagnostic logic for struct
expressions in typeck to improve the diagnostic when the missing
fields are inaccessible.
Signed-off-by: David Wood <david@davidtw.co>
|
|
|
|
clippy::single-char-push-str
|
|
|
|
clippy::useless_format
|
|
clippy::borrowed_box
|
|
|
|
Rename IsJoint -> Spacing
Builds on #76286 and might conflict with #76285
r? `@petrochenkov`
|
|
|
|
|
|
Add CONST_ITEM_MUTATION lint
Fixes #74053
Fixes #55721
This PR adds a new lint `CONST_ITEM_MUTATION`.
Given an item `const FOO: SomeType = ..`, this lint fires on:
* Attempting to write directly to a field (`FOO.field = some_val`) or
array entry (`FOO.array_field[0] = val`)
* Taking a mutable reference to the `const` item (`&mut FOO`), including
through an autoderef `FOO.some_mut_self_method()`
The lint message explains that since each use of a constant creates a
new temporary, the original `const` item will not be modified.
|
|
Revert #76285
Fixes #76399. Reverting because the issue is P-critical and there are no PRs up to fix it.
r? @Mark-Simulacrum
cc @matklad @dtolnay
|
|
Add -Zgraphviz_dark_mode and monospace font fix
Many developers use a dark theme with editors and IDEs, but this
typically doesn't extend to graphviz output.
When I bring up a MIR graphviz document, the white background is
strikingly bright. This new option changes the colors used for graphviz
output to work better in dark-themed UIs.
<img width="1305" alt="Screen Shot 2020-09-09 at 3 00 31 PM" src="https://user-images.githubusercontent.com/3827298/92659478-4b9bff00-f2ad-11ea-8894-b40d3a873cb9.png">
Also fixed the monospace font for common graphviz renders (e.g., VS Code extensions), as described in https://github.com/rust-lang/rust/pull/76500#issuecomment-689837948
**Before:**
<img width="943" alt="Screen Shot 2020-09-09 at 2 48 44 PM" src="https://user-images.githubusercontent.com/3827298/92658939-47231680-f2ac-11ea-97ac-96727e4dd622.png">
**Now with fix:**
<img width="943" alt="Screen Shot 2020-09-09 at 2 49 02 PM" src="https://user-images.githubusercontent.com/3827298/92658959-51451500-f2ac-11ea-9aae-de982d466d6a.png">
|
|
Move `rustllvm` into `compiler/rustc_llvm`
The `rustllvm` directory is not self-contained, it contains C++ code built by a build script of the `rustc_llvm` crate which is then linked into that crate.
So it makes sense to make `rustllvm` a part of `rustc_llvm` and move it into its directory.
I replaced `rustllvm` with more obvious `llvm-wrapper` as the subdirectory name, but something like `llvm-adapter` would work as well, other suggestions are welcome.
To make things more confusing, the Rust side of FFI functions defined in `rustllvm` can be found in `rustc_codegen_llvm` rather than in `rustc_llvm`. Perhaps they need to be moved as well, but this PR doesn't do that.
The presence of multiple LLVM-related directories in `src` (`llvm-project`, `rustllvm`, `librustc_llvm`, `librustc_codegen_llvm` and their predecessors) historically confused me and made me wonder about their purpose.
With this PR we will have LLVM itself (`llvm-project`), a FFI crate (`rustc_llvm`, kind of `llvm-sys`) and a codegen backend crate using LLVM through the FFI crate (`rustc_codegen_llvm`).
|
|
This reverts commit 85cee57fd791d670d92dc61e0ad71594128dd45a, reversing
changes made to b4d387302416c90a3f70211770292d8d8ab5e07d.
|
|
Those statements are removed by CleanupNonCodegenStatements pass
in drop lowering phase, and should not occur afterwards.
|
|
Remove unused PlaceContext::NonUse(NonUseContext::Coverage)
r? @richkadel / @wesleywiser
|
|
remove redundant clones
(clippy::redundant_clone)
|
|
r=oli-obk
SessionDiagnostic: Fix non-determinism in generated format string.
Fixes #76496.
r? @oli-obk
|
|
Capitalize safety comments
|
|
Improved the MIR spanview output
* Adds missing "tail" spans (spans that continue beyond the end of
overlapping spans)
* Adds a caret to highlight empty spans associated with MIR elements
that have a position, but otherwise would not be visible.
* Adds visual pointing brackets at the beginning and end of each span
<img width="590" alt="Screen Shot 2020-09-03 at 8 38 08 PM" src="https://user-images.githubusercontent.com/3827298/92202571-25510c00-ee34-11ea-89bc-89eea939476d.png">
<img width="1061" alt="Screen Shot 2020-09-03 at 8 41 04 PM" src="https://user-images.githubusercontent.com/3827298/92202629-49145200-ee34-11ea-8fda-fc6e62c80736.png">
<img width="1113" alt="Screen Shot 2020-09-06 at 5 42 57 PM" src="https://user-images.githubusercontent.com/3827298/92339198-ca085f00-f069-11ea-96d1-c01ced50e2ba.png">
<img width="1692" alt="Screen Shot 2020-09-06 at 5 45 54 PM" src="https://user-images.githubusercontent.com/3827298/92339209-d4c2f400-f069-11ea-94c0-b4d36c200878.png">
r? @tmandry
FYI: @wesleywiser
|
|
Improve unresolved use error message
"use of undeclared type or module `foo`" doesn't mention that it could be a crate.
This error can happen when users forget to add a dependency to `Cargo.toml`, so I think it's important to mention that it could be a missing crate.
I've used a heuristic based on Rust's naming conventions. It complains about an unknown type if the ident starts with an upper-case letter, and crate or module otherwise. It seems to work very well. The expanded error help covers both an unknown type and a missing crate case.
|
|
Add `-Z combine_cgu` flag
Introduce a compiler option to let rustc combines all regular CGUs into a single one at the end of compilation.
Part of Issue #64191
|
|
VS code graphviz extensions use d3-graphviz, which supports `Courier`
fontname but does not support `monospace`. This caused graphs to render
poorly because the text sizes were wrong.
|
|
|
|
make `ConstEvaluatable` more strict
relevant zulip discussion: https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/.60ConstEvaluatable.60.20generic.20functions/near/204125452
Let's see how much this impacts. Depending on how this goes this should probably be a future compat warning.
Short explanation: we currently forbid anonymous constants which depend on generic types, e.g. `[0; std::mem::size_of::<T>]` currently errors.
We previously checked this by evaluating the constant and returned an error if that failed. This however allows things like
```rust
const fn foo<T>() -> usize {
if std::mem::size_of::<*mut T>() < 8 { // size of *mut T does not depend on T
std::mem::size_of::<T>()
} else {
8
}
}
fn test<T>() {
let _ = [0; foo::<T>()];
}
```
which is a backwards compatibility hazard. This also has worrying interactions with mir optimizations (https://github.com/rust-lang/rust/pull/74491#issuecomment-661890421) and intrinsics (#74538).
r? `@oli-obk` `@eddyb`
|
|
|
|
(clippy::redundant_clone)
|
|
|
|
Create E0774
|
|
Introduce a compiler option to let rustc combines all regular CGUs into
a single one at the end of compilation.
Part of Issue #64191
|
|
Improve wording of E0607 explanation
`@rustbot` modify labels: A-diagnostics C-enhancement
|
|
|
|
Many developers use a dark theme with editors and IDEs, but this
typically doesn't extend to graphviz output.
When I bring up a MIR graphviz document, the white background is
strikingly bright. This new option changes the colors used for graphviz
output to work better in dark-themed UIs.
|
|
Fix documentation for TyCtxt::all_impls
`TyCtxt::all_impls` documentation was wrong about the return type.
|
|
Add help note to unconstrained const parameter
Resolves #68366, since it is currently intended behaviour.
If demonstrating `T -> U` is injective, there should be an additional word that it is not **yet** supported.
r? @lcnr
|
|
r=nikomatsakis
remove public visibility previously needed for rustfmt
`submod_path_from_attr` in rustc_expand::module was previously public because it was also consumed by rustfmt. However, we've done a bit of refactoring in rustfmt and no longer need to use this function.
This changes the visibility to the parent mod as was originally going to be done before the rustfmt dependency was realized (https://github.com/rust-lang/rust/commit/c189565edc5c9fc516170885b3a3061b936205fb#diff-cd1b379893bae95f7991d5a3f3c6d337R201)
|
|
|
|
|
|
|
|
|
|
|
|
Enable the SimplifyArmIdentity MIR optimization at mir-opt-level=1
r? `@ghost`
|