about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2020-09-10Rollup merge of #76567 - matthiaskrgr:clone_on_copy, r=varkorTyler Mandry-31/+33
use push(char) to add chars (single-char &strs) to strings instead of push_str(&str)
2020-09-10Rollup merge of #76565 - matthiaskrgr:box_place, r=oli-obkTyler Mandry-1/+1
take reference to Place directly instead of taking reference to Box<Place> clippy::borrowed_box
2020-09-10Rollup merge of #76563 - yokodake:patch-1, r=jonas-schievinkTyler Mandry-1/+1
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.
2020-09-10Rollup merge of #76559 - lcnr:const-evaluatable, r=oli-obkTyler Mandry-17/+78
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
2020-09-10Rollup merge of #76548 - tmiasko:validate, r=davidtwcoTyler Mandry-2/+26
Validate removal of AscribeUserType, FakeRead, and Shallow borrow Those statements are removed by CleanupNonCodegenStatements pass in drop lowering phase, and should not occur afterwards.
2020-09-10Rollup merge of #76524 - davidtwco:issue-76077-inaccessible-private-fields, ↵Tyler Mandry-42/+166
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
2020-09-10typeck/pat: inaccessible private fieldsDavid Wood-9/+81
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>
2020-09-10typeck/expr: inaccessible private fieldsDavid Wood-33/+85
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>
2020-09-10Syntactically permit unsafety on modsDavid Tolnay-35/+111
2020-09-10use push(char) instead of push_str(&str) to add single chars to stringsMatthias Krüger-29/+31
clippy::single-char-push-str
2020-09-10don't clone types that are copy (clippy::clone_on_copy)Matthias Krüger-1/+1
2020-09-10use String::from instead of format!() macro to craft string ↵Matthias Krüger-1/+1
clippy::useless_format
2020-09-10take reference to Place directly instead of taking reference to Box<Place>Matthias Krüger-1/+1
clippy::borrowed_box
2020-09-10small typo fix in rustc_parse docsNanami-1/+1
2020-09-10Auto merge of #76291 - matklad:spacing, r=petrochenkovbors-95/+84
Rename IsJoint -> Spacing Builds on #76286 and might conflict with #76285 r? `@petrochenkov`
2020-09-10fix tidy, small cleanupBastian Kauschke-13/+4
2020-09-10implement `const_evaluatable_checked` feature MVPBastian Kauschke-17/+87
2020-09-10Auto merge of #75573 - Aaron1011:feature/const-mutation-lint, r=oli-obkbors-60/+223
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.
2020-09-09Rollup merge of #76556 - tmandry:revert-76285, r=tmandryTyler Mandry-25/+16
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
2020-09-09Rollup merge of #76500 - richkadel:mir-graphviz-dark, r=tmandryTyler Mandry-11/+46
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">
2020-09-09Rollup merge of #74787 - petrochenkov:rustllvm, r=cuviperTyler Mandry-3/+4371
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`).
2020-09-10Revert "Rollup merge of #76285 - matklad:censor-spacing, r=petrochenkov"Tyler Mandry-25/+16
This reverts commit 85cee57fd791d670d92dc61e0ad71594128dd45a, reversing changes made to b4d387302416c90a3f70211770292d8d8ab5e07d.
2020-09-10Validate removal of AscribeUserType, FakeRead, and Shallow borrowTomasz Miąsko-2/+26
Those statements are removed by CleanupNonCodegenStatements pass in drop lowering phase, and should not occur afterwards.
2020-09-09Rollup merge of #76523 - tmiasko:non-use-context-coverage, r=wesleywiserTyler Mandry-5/+1
Remove unused PlaceContext::NonUse(NonUseContext::Coverage) r? @richkadel / @wesleywiser
2020-09-09Rollup merge of #76522 - matthiaskrgr:redundant_clone, r=jonas-schievinkTyler Mandry-2/+2
remove redundant clones (clippy::redundant_clone)
2020-09-09Rollup merge of #76515 - jumbatm:issue76496-reproducibility-regression, ↵Tyler Mandry-5/+6
r=oli-obk SessionDiagnostic: Fix non-determinism in generated format string. Fixes #76496. r? @oli-obk
2020-09-09Rollup merge of #76504 - Flying-Toast:master, r=lcnrTyler Mandry-1/+1
Capitalize safety comments
2020-09-09Rollup merge of #76313 - richkadel:mir-spanview-2, r=wesleywiserTyler Mandry-85/+296
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
2020-09-09Rollup merge of #75984 - kornelski:typeormodule, r=matthewjasperTyler Mandry-4/+21
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.
2020-09-09Rollup merge of #75094 - 0dvictor:cgu, r=oli-obkTyler Mandry-15/+90
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
2020-09-09Also fixed monospace font for d3-graphviz engineRich Kadel-2/+2
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.
2020-09-09Move `rustllvm` into `rustc_llvm`Vadim Petrochenkov-3/+4371
2020-09-09Auto merge of #74595 - lcnr:ConstEvaluatable-fut-compat, r=oli-obkbors-15/+113
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`
2020-09-09Remove unused PlaceContext::NonUse(NonUseContext::Coverage)Tomasz Miąsko-5/+1
2020-09-09remove redundant clonesMatthias Krüger-2/+2
(clippy::redundant_clone)
2020-09-09Fix non-determinism in generated format string.jumbatm-5/+6
2020-09-09Auto merge of #76406 - GuillaumeGomez:create-e0774, r=pickfire,jyn514bors-3/+31
Create E0774
2020-09-09Add `-Z combine_cgu` flagVictor Ding-15/+90
Introduce a compiler option to let rustc combines all regular CGUs into a single one at the end of compilation. Part of Issue #64191
2020-09-09Auto merge of #76463 - camelid:improve-E0607-explanation, r=jyn514bors-7/+7
Improve wording of E0607 explanation `@rustbot` modify labels: A-diagnostics C-enhancement
2020-09-08Capitalize safety commentsFlying-Toast-1/+1
2020-09-08Add -Zgraphviz_dark_modeRich Kadel-11/+46
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.
2020-09-09Rollup merge of #76403 - scileo:doc-all-impls, r=lcnrDylan DPC-1/+1
Fix documentation for TyCtxt::all_impls `TyCtxt::all_impls` documentation was wrong about the return type.
2020-09-09Rollup merge of #76401 - JulianKnodt:i68366, r=lcnrDylan DPC-5/+13
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
2020-09-09Rollup merge of #76355 - calebcartwright:reduce-rustfmt-visibility, ↵Dylan DPC-2/+1
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)
2020-09-08Create new E0774 code errorGuillaume Gomez-3/+31
2020-09-08add tracking issue, fix rebaseBastian Kauschke-1/+62
2020-09-08reviewBastian Kauschke-13/+15
2020-09-08convert to future compat lintBastian Kauschke-0/+11
2020-09-08make `ConstEvaluatable` more strictBastian Kauschke-21/+45
2020-09-08Auto merge of #76308 - wesleywiser:enable_simplifyarmidentity_mir_opt, r=oli-obkbors-5/+1
Enable the SimplifyArmIdentity MIR optimization at mir-opt-level=1 r? `@ghost`