about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2021-03-15Rollup merge of #83144 - hyd-dev:parse-sess-created, r=oli-obkDylan DPC-12/+11
Introduce `rustc_interface::interface::Config::parse_sess_created` callback Resolves #82900. cc `@oli-obk`
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-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-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-14Tweak diagnosticsCamelid-16/+16
- Tweak lint message - Display multi-segment paths correctly
2021-03-14bless tests (32-bit)Erik Desjardins-25/+17
2021-03-14expand: Resolve and expand inner attributes on out-of-line modulesVadim Petrochenkov-0/+148
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-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-14Use only x86_64 flagHiroki Noda-1/+3
2021-03-13Auto merge of #82891 - cjgillot:monoparent, r=petrochenkovbors-11/+55
Make def_key and HIR parenting consistent. r? `@petrochenkov`
2021-03-13Add regression testshyd-dev-0/+29
2021-03-13Auto merge of #82878 - sexxi-goose:repr_packed, r=nikomatsakisbors-0/+326
2229: Handle capturing a reference into a repr packed struct RFC 1240 states that it is unsafe to capture references into a packed-struct. This PR ensures that when a closure captures a precise path, we aren't violating this safety constraint. To acheive so we restrict the capture precision to the struct itself. An interesting edge case where we decided to restrict precision: ```rust struct Foo(String); let foo: Foo; let c = || { println!("{}", foo.0); let x = foo.0; } ``` Given how closures get desugared today, foo.0 will be moved into the closure, making the `println!`, safe. However this can be very subtle and also will be unsafe if the closure gets inline. Closes: https://github.com/rust-lang/project-rfc-2229/issues/33 r? `@nikomatsakis`
2021-03-13Auto merge of #82436 - osa1:issue80258, r=nikomatsakisbors-0/+116
Allow calling *const methods on *mut values This allows `*const` methods to be called on `*mut` values. TODOs: - [x] ~~Remove debug logs~~ Done. - [x] ~~I haven't tested, but I think this currently won't work when the `self` value has type like `&&&&& *mut X` because I don't do any autoderefs when probing. To fix this the new code in `rustc_typeck::check::method::probe` needs to reuse `pick_method` somehow as I think that's the function that autoderefs.~~ This works, because autoderefs are done before calling `pick_core`, in `method_autoderef_steps`, called by `probe_op`. - [x] ~~I should probably move the new `Pick` to `pick_autorefd_method`. If not, I should move it to its own function.~~ Done. - [ ] ~~Test this with a `Pick` with `to_ptr = true` and `unsize = true`.~~ I think this case cannot happen, because we don't have any array methods with `*mut [X]` receiver. I should confirm that this is true and document this. I've placed two assertions about this. - [x] ~~Maybe give `(Mutability, bool)` a name and fields~~ I now have a `to_const_ptr` field in `Pick`. - [x] ~~Changes in `adjust_self_ty` is quite hacky. The problem is we can't deref a pointer, and even if we don't have an adjustment to get the address of a value, so to go from `*mut` to `*const` we need a special case.~~ There's still a special case for `to_const_ptr`, but I'm not sure if we can avoid this. - [ ] Figure out how `reached_raw_pointer` stuff is used. I suspect only for error messages. Fixes #80258
2021-03-12Update cargoEric Huss-0/+0
2021-03-13Rollup merge of #83059 - notriddle:config-toml-disable-minification, ↵Yuki Okushi-0/+16
r=Mark-Simulacrum Allow configuring `rustdoc --disable-minification` in config.toml This way, you can debug rustdoc's JavaScript and CSS file with normal F12 Dev Tools and you'll have useful line numbers to work with.
2021-03-13Rollup merge of #83020 - hi-rustin:rustin-patch-enum, r=lcnrYuki Okushi-0/+16
Emit the enum range assumption if the range only contains one element close https://github.com/rust-lang/rust/issues/82871
2021-03-13Rollup merge of #83012 - flip1995:clippyup, r=ManishearthYuki Okushi-12241/+15392
Update Clippy Bi-weekly Clippy sync. r? ``@Manishearth``
2021-03-12Make docs-minification default to trueMichael Howell-0/+1
2021-03-12Make def_key and HIR parenting consistent.Camille GILLOT-11/+55
2021-03-13Improve the wording for the `can't reassign` errorYuki Okushi-0/+6