about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2021-03-15Rollup merge of #83141 - lnicola:rust-analyzer-2021-03-15, r=jonas-schievinkDylan DPC-16/+16
:arrow_up: rust-analyzer
2021-03-15Rollup merge of #83132 - Aaron1011:fix/incr-cache-dummy, r=estebankDylan DPC-0/+26
Don't encode file information for span with a dummy location Fixes #83112 The location information for a dummy span isn't real, so don't encode it. This brings the incr comp cache code into line with the Span `StableHash` impl, which doesn't hash the location information for dummy spans. Previously, we would attempt to load the 'original' file from a dummy span - if the file id changed (e.g. due to being moved on disk), we would get an ICE, since the Span was still valid due to its hash being unchanged.
2021-03-15Rollup merge of #83127 - Aaron1011:time-macros-impl-warn, r=petrochenkovDylan DPC-11/+83
Introduce `proc_macro_back_compat` lint, and emit for `time-macros-impl` Now that future-incompat-report support has landed in nightly Cargo, we can start to make progress towards removing the various proc-macro back-compat hacks that have accumulated in the compiler. This PR introduces a new lint `proc_macro_back_compat`, which results in a future-incompat-report entry being generated. All proc-macro back-compat warnings will be grouped under this lint. Note that this lint will never actually become a hard error - instead, we will remove the special cases for various macros, which will cause older versions of those crates to emit some other error. I've added code to fire this lint for the `time-macros-impl` case. This is the easiest case out of all of our current back-compat hacks - the crate was renamed to `time-macros`, so seeing a filename with `time-macros-impl` guarantees that an older version of the parent `time` crate is in use. When Cargo's future-incompat-report feature gets stabilized, affected users will start to see future-incompat warnings when they build their crates.
2021-03-15Rollup merge of #83098 - camelid:more-doc-attr-check, r=davidtwcoDylan DPC-9/+129
Find more invalid doc attributes - Lint on `#[doc(123)]`, `#[doc("hello")]`, etc. - Lint every attribute; e.g., will now report two warnings for `#[doc(foo, bar)]` - Add hyphen to "crate level" - Display paths like `#[doc(foo::bar)]` correctly instead of as an empty string
2021-03-15Rollup merge of #83054 - tmiasko:rustc_layout_scalar_valid_range, r=davidtwcoDylan DPC-0/+54
Validate rustc_layout_scalar_valid_range_{start,end} attributes Fixes #82251, fixes #82981.
2021-03-15Rollup merge of #82989 - Smittyvb:other-lang-literal-errors, r=varkorDylan DPC-0/+107
Custom error on literal names from other languages This detects all Java literal types and all single word C data types, and suggests the corresponding Rust literal type.
2021-03-15Fix `src/test/run-make-fulldeps/issue-19371`hyd-dev-0/+1
2021-03-15Custom error on literal names from other languagesSmitty-0/+107
This detects all Java literal types and all single word C data types, and suggests the corresponding Rust literal type.
2021-03-15:arrow_up: rust-analyzerLaurențiu Nicola-16/+16
2021-03-15Auto merge of #83118 - erikdesjardins:removezst, r=oli-obkbors-89/+45
Rebase and fixup #80493: Remove MIR assignments to ZST types closes #80493 cc `@simonvandel` r? `@oli-obk`
2021-03-15Use `rustc_interface::interface::Config::parse_sess_created` in Clippyhyd-dev-12/+8
2021-03-15Use `rustc_interface::interface::Config::parse_sess_created` in Clippyhyd-dev-12/+8
2021-03-15Add `rustc_interface::interface::Config::parse_sess_created`hyd-dev-0/+2
2021-03-15Auto merge of #83074 - Aaron1011:new-sort-fix, r=jackh726bors-62/+98
Avoid sorting predicates by `DefId` Fixes issue #82920 Even if an item does not change between compilation sessions, it may end up with a different `DefId`, since inserting/deleting an item affects the `DefId`s of all subsequent items. Therefore, we use a `DefPathHash` in the incremental compilation system, which is stable in the face of changes to unrelated items. In particular, the query system will consider the inputs to a query to be unchanged if any `DefId`s in the inputs have their `DefPathHash`es unchanged. Queries are pure functions, so the query result should be unchanged if the query inputs are unchanged. Unfortunately, it's possible to inadvertantly make a query result incorrectly change across compilations, by relying on the specific value of a `DefId`. Specifically, if the query result is a slice that gets sorted by `DefId`, the precise order will depend on how the `DefId`s got assigned in a particular compilation session. If some definitions end up with different `DefId`s (but the same `DefPathHash`es) in a subsequent compilation session, we will end up re-computing a *different* value for the query, even though the query system expects the result to unchanged due to the unchanged inputs. It turns out that we have been sorting the predicates computed during `astconv` by their `DefId`. These predicates make their way into the `super_predicates_that_define_assoc_type`, which ends up getting used to compute the vtables of trait objects. This, re-ordering these predicates between compilation sessions can lead to undefined behavior at runtime - the query system will re-use code built with a *differently ordered* vtable, resulting in the wrong method being invoked at runtime. This PR avoids sorting by `DefId` in `astconv`, fixing the miscompilation. However, it's possible that other instances of this issue exist - they could also be easily introduced in the future. To fully fix this issue, we should 1. Turn on `-Z incremental-verify-ich` by default. This will cause the compiler to ICE whenver an 'unchanged' query result changes between compilation sessions, instead of causing a miscompilation. 2. Remove the `Ord` impls for `CrateNum` and `DefId`. This will make it difficult to introduce ICEs in the first place.
2021-03-14Introduce `proc_macro_back_compat` lint, and emit for `time-macros-impl`Aaron Hill-11/+83
Now that future-incompat-report support has landed in nightly Cargo, we can start to make progress towards removing the various proc-macro back-compat hacks that have accumulated in the compiler. This PR introduces a new lint `proc_macro_back_compat`, which results in a future-incompat-report entry being generated. All proc-macro back-compat warnings will be grouped under this lint. Note that this lint will never actually become a hard error - instead, we will remove the special cases for various macros, which will cause older versions of those crates to emit some other error. I've added code to fire this lint for the `time-macros-impl` case. This is the easiest case out of all of our current back-compat hacks - the crate was renamed to `time-macros`, so seeing a filename with `time-macros-impl` guarantees that an older version of the parent `time` crate is in use. When Cargo's future-incompat-report feature gets stabilized, affected users will start to see future-incompat warnings when they build their crates.
2021-03-14Don't encode file information for span with a dummy locationAaron Hill-0/+26
Fixes #83112 The location information for a dummy span isn't real, so don't encode it. This brings the incr comp cache code into line with the Span `StableHash` impl, which doesn't hash the location information for dummy spans. Previously, we would attempt to load the 'original' file from a dummy span - if the file id changed (e.g. due to being moved on disk), we would get an ICE, since the Span was still valid due to its hash being unchanged.
2021-03-14Add fake_read() to clippyRoxane-0/+9
2021-03-14Only borrow place for matching under specific conditionsRoxane-0/+148
2021-03-14Use the correct FakeReadCauseRoxane-439/+214
2021-03-14Address review commentsAmanieu d'Antras-3/+62
2021-03-14Make nameWithoutUndescores lowercasedMichael Howell-14/+15
This basically fixes a search bug introduced by earlier changes.
2021-03-14Auto merge of #83062 - JohnTitor:improve-reassign-err, r=davidtwcobors-0/+6
Improve the wording for the `can't reassign` error Follow-up for https://github.com/rust-lang/rust/pull/71976#discussion_r448186151. Fixes #66736
2021-03-14Attempt to deal with nested closures properlyRoxane-0/+528
2021-03-14Tweak diagnosticsCamelid-16/+16
- Tweak lint message - Display multi-segment paths correctly
2021-03-14Introduce new fake readsRoxane-11/+7
2021-03-14bless tests (32-bit)Erik Desjardins-25/+17
2021-03-14Use a number for row.id, instead of a stringMichael Howell-11/+5
There's no reason for it to be a string, since it's only used for de-duplicating the results arrays anyhow.
2021-03-14Avoid generating new strings for names that have no undescoresMichael Howell-2/+8
This should have negligible effect on time, but it cuts about 1MiB off of resident memory usage.
2021-03-14expand: Resolve and expand inner attributes on out-of-line modulesVadim Petrochenkov-0/+148
2021-03-14Remove Option::{unwrap_none, expect_none}.Mara Bos-5/+0
2021-03-14Auto merge of #83044 - kubo39:set-llvm-code-model, r=nikicbors-0/+20
Add support for storing code model to LLVM module IR This patch avoids undefined behavior by linking different object files. Also this would it could be propagated properly to LTO. See https://reviews.llvm.org/D52322 and https://reviews.llvm.org/D52323. This patch is based on https://github.com/rust-lang/rust/pull/74002
2021-03-14Auto merge of #83094 - GuillaumeGomez:crates-js-location, r=Nemo157bors-1/+1
crates.js should use root_path and not static_root_path r? `@Nemo157`
2021-03-14Auto merge of #83028 - GuillaumeGomez:prevent-js-error-if-no-filter, r=Nemo157bors-1/+5
Prevent JS error when there is no dependency or other crate documented (or --disable-per-crate-search has been used) When there is only one crate, the dropdown is removed, creating an error (that you can see pretty easily on docs.rs for example). r? `@jyn514`
2021-03-14Rollup merge of #83081 - hyd-dev:assert-message, r=m-ou-seYuki Okushi-0/+29
Fix panic message of `assert_failed_inner` cc https://github.com/rust-lang/rust/pull/79100#discussion_r593731020 r? ``@m-ou-se``
2021-03-14Rollup merge of #83070 - ehuss:update-cargo, r=ehussYuki Okushi-0/+0
Update cargo 7 commits in 970bc67c3775781b9708c8a36893576b9459c64a..32da9eaa5de5be241cf8096ca6b749a157194f77 2021-03-07 18:09:40 +0000 to 2021-03-13 01:18:40 +0000 - Fix logic for determining prefer-dynamic for a dylib. (rust-lang/cargo#9252) - Fix issue with filtering exclusive target dependencies. (rust-lang/cargo#9255) - Update pkgid-spec docs. (rust-lang/cargo#9249) - Wordsmith the edition documentation a bit more (rust-lang/cargo#9233) - Package ID specification urls must contain a host (rust-lang/cargo#9188) - Add documentation for JSON message_path. (rust-lang/cargo#9247) - Fix filter_platform to run on targets other than x86. (rust-lang/cargo#9246)
2021-03-14Rollup merge of #82798 - jyn514:rustdoc-group, r=Manishearth,GuillaumeGomezYuki Okushi-33/+57
Rename `rustdoc` to `rustdoc::all` When rustdoc lints were changed to be tool lints, the `rustdoc` group was removed, leading to spurious warnings like ``` warning: unknown lint: `rustdoc` ``` The lint group still worked when rustdoc ran, since rustdoc added the group itself. This renames the group to `rustdoc::all` for consistency with `clippy::all` and the rest of the rustdoc lints. Follow-up to #80527. r? ``@Manishearth``
2021-03-14Rollup merge of #82789 - csmoe:issue-82772, r=estebankYuki Okushi-5/+41
Get with field index from pattern slice instead of directly indexing Closes #82772 r? ``@estebank`` https://github.com/rust-lang/rust/pull/82789#issuecomment-796921977 > ``@estebank`` So the real cause is we only generate single pattern for Box here https://github.com/csmoe/rust/blob/615b03aeaa8ce9819de7828740ab3cd7def4fa76/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs#L1130-L1132 But in the replacing function, it tries to index on the 1-length pattern slice with field 1, thus out of bounds. https://github.com/csmoe/rust/blob/615b03aeaa8ce9819de7828740ab3cd7def4fa76/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs#L1346
2021-03-13bless testsErik Desjardins-27/+17
2021-03-13Update `rustdoc-ui` versions of the `doc-attr` testCamelid-1/+61
It seems there are two copies of it: one in `src/test/ui/attributes/` and one in `src/test/rustdoc-ui/`. I'm guessing this is to test that the lint is emitted both when you run the compiler and when you run rustdoc.
2021-03-13Add hyphen to "crate level"Camelid-7/+7
"crate level attribute" -> "crate-level attribute"
2021-03-13Do not emit alloca for ZST local even if it is uninitializedSimon Vandel Sillesen-3/+0
2021-03-13Move ZST check inside UsedLocalsSimon Vandel Sillesen-0/+1
2021-03-13Extend SimplifyLocals to remove ZST writesSimon Vandel Sillesen-37/+13
2021-03-13Add another test caseCamelid-1/+24
2021-03-13Report error for each invalid nested attributeCamelid-1/+12
2021-03-13Lint non-meta doc attributesCamelid-1/+27
E.g., `#[doc(123)]`.
2021-03-13Always lower asm! to valid HIRAmanieu d'Antras-0/+19
2021-03-13crates.js should use root_path and not static_root_pathGuillaume Gomez-1/+1
2021-03-13Avoid sorting predicates by `DefId`Aaron Hill-62/+98
Fixes issue #82920 Even if an item does not change between compilation sessions, it may end up with a different `DefId`, since inserting/deleting an item affects the `DefId`s of all subsequent items. Therefore, we use a `DefPathHash` in the incremental compilation system, which is stable in the face of changes to unrelated items. In particular, the query system will consider the inputs to a query to be unchanged if any `DefId`s in the inputs have their `DefPathHash`es unchanged. Queries are pure functions, so the query result should be unchanged if the query inputs are unchanged. Unfortunately, it's possible to inadvertantly make a query result incorrectly change across compilations, by relying on the specific value of a `DefId`. Specifically, if the query result is a slice that gets sorted by `DefId`, the precise order will depend on how the `DefId`s got assigned in a particular compilation session. If some definitions end up with different `DefId`s (but the same `DefPathHash`es) in a subsequent compilation session, we will end up re-computing a *different* value for the query, even though the query system expects the result to unchanged due to the unchanged inputs. It turns out that we have been sorting the predicates computed during `astconv` by their `DefId`. These predicates make their way into the `super_predicates_that_define_assoc_type`, which ends up getting used to compute the vtables of trait objects. This, re-ordering these predicates between compilation sessions can lead to undefined behavior at runtime - the query system will re-use code built with a *differently ordered* vtable, resulting in the wrong method being invoked at runtime. This PR avoids sorting by `DefId` in `astconv`, fixing the miscompilation. However, it's possible that other instances of this issue exist - they could also be easily introduced in the future. To fully fix this issue, we should 1. Turn on `-Z incremental-verify-ich` by default. This will cause the compiler to ICE whenver an 'unchanged' query result changes between compilation sessions, instead of causing a miscompilation. 2. Remove the `Ord` impls for `CrateNum` and `DefId`. This will make it difficult to introduce ICEs in the first place.
2021-03-13Remove tab characterMichael Howell-2/+2