about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2021-05-13Tolerate SIGTRAP for panic abort after panic::always_abortIan Jackson-1/+1
Some platforma (eg ARM64) apparently generate SIGTRAP for panic abort! See eg https://github.com/rust-lang/rust/pull/81858#issuecomment-840702765 This is probably a bug, but we don't want to entangle this MR with it. When it's fixed, this commit should be reverted. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-05-13Use SIGUSR1 rather than SIGTRAP for "allocated after fork"Ian Jackson-2/+2
Some platforma (eg ARM64) apparently generate SIGTRAP for panic abort! See eg https://github.com/rust-lang/rust/pull/81858#issuecomment-840702765 This is probably a bug, but (i) we want to avoid that bug rather than trying to fix it now and (ii) it would better to use a signal that is less at risk of strangeness. I grepped the rust-lang/rut codebase for SIGUSR and there were no hits. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-05-13Auto merge of #85258 - GuillaumeGomez:rollup-kzay7o5, r=GuillaumeGomezbors-313/+191
Rollup of 4 pull requests Successful merges: - #85068 (Fix diagnostic for cross crate private tuple struct constructors) - #85175 (Rustdoc cleanup) - #85177 (add BITS associated constant to core::num::Wrapping) - #85240 (Don't suggest adding `'static` lifetime to arguments) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-05-13Rollup merge of #85240 - Aaron1011:no-suggest-static, r=davidtwcoGuillaume Gomez-35/+0
Don't suggest adding `'static` lifetime to arguments Fixes #69350 This is almost always the wrong this to do
2021-05-13Rollup merge of #85175 - GuillaumeGomez:rustdoc-cleanup, r=jshaGuillaume Gomez-274/+150
Rustdoc cleanup Part of https://github.com/rust-lang/rust/issues/83332. The goal of this PR is to remove a few unused things: * The "loading content" things are now unneeded. * Some toggle CSS rules were still there. * Some parts of the JS had a different indent, fixed it. r? `@jsha`
2021-05-13Rollup merge of #85068 - luqmana:78708-xcrate-diag, r=estebankGuillaume Gomez-4/+41
Fix diagnostic for cross crate private tuple struct constructors Fixes #78708. There was already some limited support for certain cross-crate scenarios but that didn't handle a tuple struct rexported from an inner module for example (e.g. the NonZero* types as seen in #85049). ```Rust ➜ cat bug.rs fn main() { let _x = std::num::NonZeroU32(12); let n = std::num::NonZeroU32::new(1).unwrap(); match n { std::num::NonZeroU32(i) => {}, } } ``` **Before:** <details> ```Rust ➜ rustc +nightly bug.rs error[E0423]: expected function, tuple struct or tuple variant, found struct `std::num::NonZeroU32` --> bug.rs:2:14 | 2 | let _x = std::num::NonZeroU32(12); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `std::num::NonZeroU32 { 0: val }` | ::: /home/luqman/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/nonzero.rs:148:1 [snip] error[E0532]: expected tuple struct or tuple variant, found struct `std::num::NonZeroU32` --> bug.rs:5:9 | 5 | std::num::NonZeroU32(i) => {}, | ^^^^^^^^^^^^^^^^^^^^^^^ help: use struct pattern syntax instead: `std::num::NonZeroU32 { 0 }` | ::: /home/luqman/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/nonzero.rs:148:1 [snip] error: aborting due to 2 previous errors Some errors have detailed explanations: E0423, E0532. For more information about an error, try `rustc --explain E0423`. ``` </details> **After:** <details> ```Rust ➜ /rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc bug.rs error[E0423]: cannot initialize a tuple struct which contains private fields --> bug.rs:2:14 | 2 | let _x = std::num::NonZeroU32(12); | ^^^^^^^^^^^^^^^^^^^^ | note: constructor is not visible here due to private fields --> /rust/library/core/src/num/nonzero.rs:148:1 [snip] error[E0532]: cannot match against a tuple struct which contains private fields --> bug.rs:5:9 | 5 | std::num::NonZeroU32(i) => {}, | ^^^^^^^^^^^^^^^^^^^^ | note: constructor is not visible here due to private fields --> bug.rs:5:30 | 5 | std::num::NonZeroU32(i) => {}, | ^ private field error: aborting due to 2 previous errors Some errors have detailed explanations: E0423, E0532. For more information about an error, try `rustc --explain E0423`. ``` </details> One question is if we should only collect the needed info for the cross-crate case after encountering an error instead of always doing it. Perf run perhaps to gauge the impact.
2021-05-13Auto merge of #85110 - RalfJung:no-rustc_args_required_const, r=oli-obkbors-319/+59
Remove rustc_args_required_const attribute Now that stdarch no longer needs it (thanks `@Amanieu!),` we can kill the `rustc_args_required_const` attribute. This means that lifetime extension of references to temporaries is the only remaining job that promotion is performing. :-) r? `@oli-obk` Fixes https://github.com/rust-lang/rust/issues/69493
2021-05-13Fix display for "implementors" sectionGuillaume Gomez-1/+1
2021-05-13fix test suiteRalf Jung-70/+59
2021-05-13wowEllen-2/+2
2021-05-13Use DefaultMetadataLoader in the hotplug_codegen_backend testbjorn3-13/+1
2021-05-13Auto merge of #83129 - LeSeulArtichaut:thir-unsafeck, r=nikomatsakisbors-51/+468
Introduce the beginning of a THIR unsafety checker This poses the foundations for the THIR unsafety checker, so that it can be implemented incrementally: - implements a rudimentary `Visitor` for the THIR (which will definitely need some tweaking in the future) - introduces a new `-Zthir-unsafeck` flag which tells the compiler to use THIR unsafeck instead of MIR unsafeck - implements detection of unsafe functions - adds revisions to the UI tests to test THIR unsafeck alongside MIR unsafeck This uses a very simple query design, where bodies are unsafety-checked on a body per body basis. This however has some big flaws: - the unsafety-checker builds the THIR itself, which means a lot of work is duplicated with MIR building constructing its own copy of the THIR - unsafety-checking closures is currently completely wrong: closures should take into account the "safety context" in which they are created, here we are considering that closures are always a safe context I had intended to fix these problems in follow-up PRs since they are always gated under the `-Zthir-unsafeck` flag (which is explicitely noted to be unsound). r? `@nikomatsakis` cc https://github.com/rust-lang/project-thir-unsafeck/issues/3 https://github.com/rust-lang/project-thir-unsafeck/issues/7
2021-05-13Improve commentJakub Kulik-1/+1
2021-05-13Update Docker to build the deprecated target alongside the new oneJakub Kulik-14/+10
2021-05-13completion uwuEllen-8/+0
2021-05-13have on_completion record subcyclesNiko Matsakis-36/+61
Rework `on_completion` method so that it removes all provisional cache entries that are "below" a completed node (while leaving those entries that are not below the node). This corrects an imprecise result that could in turn lead to an incremental compilation failure. Under the old scheme, if you had: * A depends on... * B depends on A * C depends on... * D depends on C * T: 'static then the provisional results for A, B, C, and D would all be entangled. Thus, if A was `EvaluatedToOkModuloRegions` (because of that final condition), then the result for C and D would also be demoted to "ok modulo regions". In reality, though, the result for C depends only on C and itself, and is not dependent on regions. If we happen to evaluate the cycle starting from C, we would never reach A, and hence the result would be "ok". Under the new scheme, the provisional results for C and D are moved to the permanent cache immediately and are not affected by the result of A.
2021-05-13introduce a unit testing feature `rustc_evaluate_where_clauses`Niko Matsakis-0/+135
This attribute will cause us to invoke evaluate on every where clause of an invoked function and to generate an error with the result. Without this, it is very difficult to observe the effects of invoking the trait evaluator.
2021-05-13Auto merge of #85041 - mibac138:suggest-generics, r=estebankbors-4/+176
Suggest adding a type parameter for impls Add a new suggestion upon encountering an unknown type in a `impl` that suggests adding a new type parameter. This diagnostic suggests to add a new type parameter even though it may be a const parameter, however after adding the parameter and running rustc again a follow up error steers the user to change the type parameter to a const parameter. ```rust struct X<const C: ()>(); impl X<C> {} ``` suggests ``` error[E0412]: cannot find type `C` in this scope --> bar.rs:2:8 | 1 | struct X<const C: ()>(); | ------------------------ similarly named struct `X` defined here 2 | impl X<C> {} | ^ | help: a struct with a similar name exists | 2 | impl X<X> {} | ^ help: you might be missing a type parameter | 2 | impl<C> X<C> {} | ^^^ ``` After adding a type parameter the code now becomes ```rust struct X<const C: ()>(); impl<C> X<C> {} ``` and the error now fully steers the user towards the correct code ``` error[E0747]: type provided when a constant was expected --> bar.rs:2:11 | 2 | impl<C> X<C> {} | ^ | help: consider changing this type parameter to be a `const` generic | 2 | impl<const C: ()> X<C> {} | ^^^^^^^^^^^ ``` r? `@estebank` Somewhat related #84946
2021-05-13Auto merge of #84732 - DrChat:asm_powerpc, r=Amanieubors-1/+176
Add asm!() support for PowerPC This includes GPRs and FPRs only. Note that this does not include PowerPC64. For my reference, this was mostly duplicated from PR #73214.
2021-05-13Auto merge of #83759 - SkiFire13:fix-diag, r=estebankbors-41/+786
Handle more span edge cases in generics diagnostics This should fix invalid suggestions that didn't account for empty bracket pairs (`<>`) or type bindings.
2021-05-12Rename `RealFileName::Named` to `LocalPath`Andy Wang-9/+10
2021-05-12Only deal with LocalPath in conversionAndy Wang-1/+1
2021-05-12Rename span_to_string to span_to_diagnostic_stringAndy Wang-1/+1
2021-05-12Don't suggest adding `'static` lifetime to argumentsAaron Hill-35/+0
Fixes #69350 This is almost always the wrong this to do
2021-05-13Auto merge of #82069 - Aaron1011:verbose-in-macro, r=estebankbors-737/+737
Show macro name in 'this error originates in macro' message When there are multiple macros in use, it can be difficult to tell which one was responsible for producing an error.
2021-05-12Show macro name in 'this error originates in macro' messageAaron Hill-737/+737
When there are multiple macros in use, it can be difficult to tell which one was responsible for producing an error.
2021-05-12Preserve `SyntaxContext` for invalid/dummy spans in crate metadataAaron Hill-0/+68
Fixes #85197 We already preserved the `SyntaxContext` for invalid/dummy spans in the incremental cache, but we weren't doing the same for crate metadata. If an invalid (lo/hi from different files) span is written to the incremental cache, we will decode it with a 'dummy' location, but keep the original `SyntaxContext`. Since the crate metadata encoder was only checking for `DUMMY_SP` (dummy location + root `SyntaxContext`), the metadata encoder would treat it as a normal span, encoding the `SyntaxContext`. As a result, the final span encoded to the metadata would change across sessions, even if the crate itself was unchanged. This PR updates our encoding of spans in the crate metadata to mirror the encoding of spans into the incremental cache. We now always encode a `SyntaxContext`, and encode location information for spans with a non-dummy location.
2021-05-12Update LLVM submoduleNikita Popov-0/+0
2021-05-12Auto merge of #85188 - RalfJung:miri, r=RalfJungbors-8/+8
update Miri Fixes https://github.com/rust-lang/rust/issues/85179 Cc `@rust-lang/miri` r? `@ghost`
2021-05-12update MiriRalf Jung-8/+8
2021-05-12Improve error message for non-exhaustive matches on non-exhaustive enumsFabian Wolff-5/+78
2021-05-12Auto merge of #85231 - GuillaumeGomez:rollup-hufe4gz, r=GuillaumeGomezbors-132/+304
Rollup of 5 pull requests Successful merges: - #84793 (Recover from invalid `struct` item syntax) - #85117 (Move global click handlers to per-element ones.) - #85141 (Update documentation for SharedContext::maybe_collapsed_doc_value) - #85174 (Fix border radius for doc code blocks in rustdoc) - #85205 (Update books) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-05-12Rollup merge of #85205 - ehuss:update-books, r=ehussGuillaume Gomez-0/+0
Update books ## nomicon 4 commits in 8551afbb2ca6f5ea37fe58380318b209785e4e02..55de6fa3c1f331774da19472c9ee57d2ae9eb039 2021-04-01 21:58:50 +0900 to 2021-05-12 00:31:01 +0900 - Clarify some of the language around marking traits safe/unsafe. (rust-lang-nursery/nomicon#268) - Use pointer 'add' instead of 'offset' (rust-lang-nursery/nomicon#265) - Adjust Vec to build on stable Rust (rust-lang-nursery/nomicon#223) - Update link to c++ atomic ordering docs (rust-lang-nursery/nomicon#264) ## reference 3 commits in d23f9da8469617e6c81121d9fd123443df70595d..5aa457bf1b54bd2cd5d4cf49797f29299bdf89a7 2021-04-28 11:16:44 -0700 to 2021-05-05 08:39:22 -0700 - Explicitly state result of compound assignment (rust-lang-nursery/reference#1013) - Adjust the definition of `target_family` (rust-lang-nursery/reference#1006) - Fix typo in `Traits` (rust-lang-nursery/reference#1012) ## book 2 commits in 50dd06cb71beb27fdc0eebade5509cdcc1f821ed..55a26488ddefc8433e73a2e8352d70f7a5c7fc2b 2021-04-23 13:21:54 -0500 to 2021-05-09 12:03:18 -0500 - Past-tensify "lead" -&gt; "led" (rust-lang/book#2717) - Merge pull request rust-lang/book#2718 from rust-lang/update-rustc ## rust-by-example 2 commits in e0a721f5202e6d9bec0aff99f10e44480c0da9e7..5f8c6da200ada77760a2fe1096938ef58151c9a6 2021-04-27 09:32:15 -0300 to 2021-04-29 08:08:01 -0300 - Fix Typo in LRBE section; closes rust-lang/rust-by-example#1434 (rust-lang/rust-by-example#1437) - Add some tests to cargo/test.md. Partially addresses rust-lang/rust-by-example#1304 (rust-lang/rust-by-example#1438) ## rustc-dev-guide 3 commits in e72b43a64925ce053dc7830e21c1a57ba00499bd..1e6c7fbda4c45e85adf63ff3f82fa9c870b1447f 2021-04-27 12:35:37 -0700 to 2021-05-10 13:38:24 +0900 - Unified CPU Requirements (rust-lang/rustc-dev-guide#1126) - add 'waiting-for-review' incantation to main contrib page (rust-lang/rustc-dev-guide#1124) - Link to Zulip search for finding the most recent check-in (rust-lang/rustc-dev-guide#1118)
2021-05-12Rollup merge of #85174 - GuillaumeGomez:doc-code-block-border-radius, r=jshaGuillaume Gomez-2/+2
Fix border radius for doc code blocks in rustdoc In #85148, I made an invalid change on the border radius of the doc code blocks (look in the top left and bottom left corners of the code blocks). Before this fix: ![Screenshot from 2021-05-11 11-14-59](https://user-images.githubusercontent.com/3050060/117791459-a4f86b80-b24a-11eb-8ac3-facc719c799a.png) After this fix: ![Screenshot from 2021-05-11 11-05-29](https://user-images.githubusercontent.com/3050060/117791482-a9bd1f80-b24a-11eb-8c38-a01989595f5c.png) r? `@jsha`
2021-05-12Rollup merge of #85141 - GuillaumeGomez:maybe_collapsed_doc_value-doc, r=jshaGuillaume Gomez-2/+2
Update documentation for SharedContext::maybe_collapsed_doc_value Fixes #85120. The `doc-collapse` was removed, however, the main crate is always "collapsed", meaning that this function is still needed. I updated the documentation instead to avoid misleading readers. r? `@jsha`
2021-05-12Rollup merge of #85117 - jsha:bubble-bubble-toil-and-trouble, r=GuillaumeGomezGuillaume Gomez-128/+138
Move global click handlers to per-element ones. In rustdoc's main.js, we had an onclick handler for the whole document that would dispatch to handlers for various elements. This change attaches the handlers to the elements that trigger them, instead. This simplifies the code and avoids reimplementing the browser's bubbling functionality. As part of this change, change from a class to an id for help button. Move the handlers and associated code for highlighting source lines into source-script.js (and factor out a shared regex). Demo at https://hoffman-andrews.com/rust/bubble-bubble-toil-and-trouble/std/string/struct.String.html Note: this conflicts with / depends on #85074. Once that's merged I'll rebase this and resolve conflicts. Part of #83332. Thanks to `@Manishearth` for the [suggestion to not reimplement bubbling](https://github.com/rust-lang/rust/issues/83332#issuecomment-803497509). r? `@GuillaumeGomez`
2021-05-12Rollup merge of #84793 - estebank:parse-struct-field-default, r=davidtwcoGuillaume Gomez-0/+162
Recover from invalid `struct` item syntax Parse unsupported "default field const values": ```rust struct S { field: Type = const_val, } ``` Recover from small `:` typo and provide suggestion: ```rust struct S { field; Type, field2= Type, } ```
2021-05-12entirely remove rustc_args_required_const attributeRalf Jung-127/+0
2021-05-12rustc_args_required_const is no longer a promotion siteRalf Jung-122/+0
2021-05-12Auto merge of #84730 - sexxi-goose:rox-auto-trait, r=nikomatsakisbors-19/+327
Add auto traits and clone trait migrations for RFC2229 This PR - renames the existent RFC2229 migration `disjoint_capture_drop_reorder` to `disjoint_capture_migration` - add additional migrations for auto traits and clone trait Closes rust-lang/project-rfc-2229#29 Closes rust-lang/project-rfc-2229#28 r? `@nikomatsakis`
2021-05-12Bless tests.Camille GILLOT-5/+5
2021-05-12Use () for all_traits.Camille GILLOT-6/+5
2021-05-12Use () for privacy.Camille GILLOT-5/+3
2021-05-12Use () for inherent_impls.Camille GILLOT-2/+2
2021-05-12Use () for entry_fn.Camille GILLOT-2/+2
2021-05-12Use () for HIR queries.Camille GILLOT-2/+2
2021-05-12Bless testsGiacomo Stevanato-41/+604
2021-05-12Update wrong-number-of-args test to cover more edge casesGiacomo Stevanato-0/+182
2021-05-12Auto merge of #83813 - cbeuw:remap-std, r=michaelwoeristerbors-33/+70
Fix `--remap-path-prefix` not correctly remapping `rust-src` component paths and unify handling of path mapping with virtualized paths This PR fixes #73167 ("Binaries end up containing path to the rust-src component despite `--remap-path-prefix`") by preventing real local filesystem paths from reaching compilation output if the path is supposed to be remapped. `RealFileName::Named` introduced in #72767 is now renamed as `LocalPath`, because this variant wraps a (most likely) valid local filesystem path. `RealFileName::Devirtualized` is renamed as `Remapped` to be used for remapped path from a real path via `--remap-path-prefix` argument, as well as real path inferred from a virtualized (during compiler bootstrapping) `/rustc/...` path. The `local_path` field is now an `Option<PathBuf>`, as it will be set to `None` before serialisation, so it never reaches any build output. Attempting to serialise a non-`None` `local_path` will cause an assertion faliure. When a path is remapped, a `RealFileName::Remapped` variant is created. The original path is preserved in `local_path` field and the remapped path is saved in `virtual_name` field. Previously, the `local_path` is directly modified which goes against its purpose of "suitable for reading from the file system on the local host". `rustc_span::SourceFile`'s fields `unmapped_path` (introduced by #44940) and `name_was_remapped` (introduced by #41508 when `--remap-path-prefix` feature originally added) are removed, as these two pieces of information can be inferred from the `name` field: if it's anything other than a `FileName::Real(_)`, or if it is a `FileName::Real(RealFileName::LocalPath(_))`, then clearly `name_was_remapped` would've been false and `unmapped_path` would've been `None`. If it is a `FileName::Real(RealFileName::Remapped{local_path, virtual_name})`, then `name_was_remapped` would've been true and `unmapped_path` would've been `Some(local_path)`. cc `@eddyb` who implemented `/rustc/...` path devirtualisation
2021-05-12make verify-channel.sh compatible with macOSPietro Albini-7/+17