about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2021-06-03Auto merge of #85952 - JohnTitor:rollup-r00gu9q, r=JohnTitorbors-0/+102
Rollup of 13 pull requests Successful merges: - #83362 (Stabilize `vecdeque_binary_search`) - #85706 (Turn off frame pointer elimination on all Apple platforms. ) - #85724 (Fix issue 85435 by restricting Fake Read precision) - #85852 (Clarify meaning of MachineApplicable suggestions.) - #85877 (Intra doc link-ify a reference to a function) - #85880 (convert assertion on rvalue::threadlocalref to delay bug) - #85896 (Add test for forward declared const param defaults) - #85897 (Update I-unsound label for triagebot) - #85900 (Use pattern matching instead of checking lengths explicitly) - #85911 (Avoid a clone of output_filenames.) - #85926 (Update cargo) - #85934 (Add `Ty::is_union` predicate) - #85935 (Validate type of locals used as indices) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-06-03Rollup merge of #85896 - BoxyUwU:remove-fixme-fwd-declared-const-default, ↵Yuki Okushi-0/+42
r=petrochenkov Add test for forward declared const param defaults
2021-06-03Rollup merge of #85880 - csmoe:ice-85768, r=oli-obkYuki Okushi-0/+60
convert assertion on rvalue::threadlocalref to delay bug Closes #85768 r? ``@oli-obk``
2021-06-03Auto merge of #84988 - alexcrichton:safe-target-feature-wasm, r=joshtriplettbors-0/+44
rustc: Allow safe #[target_feature] on wasm This commit updates the compiler's handling of the `#[target_feature]` attribute when applied to functions on WebAssembly-based targets. The compiler in general requires that any functions with `#[target_feature]` are marked as `unsafe` as well, but this commit relaxes the restriction for WebAssembly targets where the attribute can be applied to safe functions as well. The reason this is done is that the motivation for this feature of the compiler is not applicable for WebAssembly targets. In general the `#[target_feature]` attribute is used to enhance target CPU features enabled beyond the basic level for the rest of the compilation. If done improperly this means that your program could execute an instruction that the CPU you happen to be running on does not understand. This is considered undefined behavior where it is unknown what will happen (e.g. it's not a deterministic `SIGILL`). For WebAssembly, however, the target is different. It is not possible for a running WebAssembly program to execute an instruction that the engine does not understand. If this were the case then the program would not have validated in the first place and would not run at all. Even if this were allowed in some hypothetical future where engines have some form of runtime feature detection (which they do not right now) any implementation of such a feature would generate a trap if a module attempts to execute an instruction the module does not understand. This deterministic trap behavior would still not fall into the category of undefined behavior because the trap is deterministic. For these reasons the `#[target_feature]` attribute is now allowed on safe functions, but only for WebAssembly targets. This notably enables the wasm-SIMD intrinsics proposed for stabilization in #74372 to be marked as safe generally instead of today where they're all `unsafe` due to the historical implementation of `#[target_feature]` in the compiler.
2021-06-03Auto merge of #84834 - GuillaumeGomez:sidebar-unification, r=jshabors-1/+69
Sidebar unification This PR does a few things: * Put crates list at all levels (before, it was only on the "top" items) * Fix bug in module sidebar: the list of items was from the parent module. The other changes (on bootstrap mostly) were to allow to generate multiple crates in a same folder so that we can ensure that clicking on the crates in the sidebar works as expected. I added a rustdoc-gui test to ensure everything is where it should be. r? `@jyn514`
2021-06-02Auto merge of #84703 - GuillaumeGomez:cleanup-dom, r=jshabors-163/+170
Clean up dom The commits come from #84480. They were errors reported by the `tidy` script that we will use to ensure that the HTML generated by rustdoc is valid. I checked carefully that there were no difference so in principle it should be exactly the same rendering but a double-check would be very appreciated in case I missed something. Extra note: `<h4>` and some `<h3>` tags were replaced by `<div>` because they're not supposed to contain tags as they currently do. r? `@jsha`
2021-06-02Update rustdoc testsGuillaume Gomez-94/+100
2021-06-02Auto merge of #85687 - m-ou-se:new-prelude, r=yaahcbors-0/+7
New prelude RFC: rust-lang/rfcs#3114 Tracking issue: https://github.com/rust-lang/rust/issues/85684
2021-06-02convert Rvalue::threadlocalref assertion to delay bugcsmoe-8/+7
2021-06-01Auto merge of #85331 - cjgillot:dirty-dancing, r=Aaron1011bors-686/+500
Make rustc_dirty/clean annotations exhaustive by default Fixes #45009
2021-06-01Auto merge of #85829 - bjorn3:simplify_crate_num, r=jackh726bors-5/+5
Remove CrateNum::ReservedForIncrCompCache It's only use is easily replaceable with `Option<CrateNum>`.
2021-06-01Replace h3 and h4 containing invalid DOMGuillaume Gomez-81/+82
2021-06-01Add test for forward declared const param defaultsEllen-0/+42
2021-06-01Fix testbjorn3-5/+5
2021-06-01Auto merge of #85886 - GuillaumeGomez:rollup-l3yr3np, r=GuillaumeGomezbors-44/+60
Rollup of 4 pull requests Successful merges: - #85473 (fix split-debuginfo error message) - #85622 (Remove toggle for "undocumented items.") - #85826 (Mention "null pointer optimization" in option docs.) - #85860 (Fix details rustdoc toggle for blanket impl) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-06-01Rollup merge of #85622 - jsha:untoggle-undocumented, r=GuillaumeGomezGuillaume Gomez-44/+60
Remove toggle for "undocumented items." Per discussion in #84326. For trait implementations, this was misleading: the items actually do have documentation (but it comes from the trait definition). For both trait implementations and trait implementors, this was redundant: in both of those cases, the items are default-hidden by different toggle at the level above. Update tests: Remove XPath selectors that over-specified on details tag, in cases that weren't testing toggles. Add an explicit test for toggles on methods. Rename item-hide-threshold to toggle-item-contents for consistency. Demo: https://hoffman-andrews.com/rust/untoggle-undocumented/std/string/struct.String.html https://hoffman-andrews.com/rust/untoggle-undocumented/std/io/trait.Read.html
2021-06-01Revert "Reduce the amount of untracked state in TyCtxt"Camille Gillot-16/+16
2021-06-01skip check_static on rvalue::threadlocalrefcsmoe-0/+61
2021-06-01Auto merge of #85153 - cjgillot:qresolve, r=Aaron1011bors-16/+16
Reduce the amount of untracked state in TyCtxt Access to untracked global state may generate instances of #84970. The GlobalCtxt contains the lowered HIR, the resolver outputs and interners. By wrapping the resolver inside a query, we make sure those accesses are properly tracked. As a no_hash query, all dependent queries essentially become `eval_always`, what they should have been from the beginning.
2021-05-31Auto merge of #85702 - Aaron1011:no-vec-sort, r=michaelwoeristerbors-0/+15
Don't sort a `Vec` before computing its `DepTrackingHash` Previously, we sorted the vec prior to hashing, making the hash independent of the original (command-line argument) order. However, the original vec was still always kept in the original order, so we were relying on the rest of the compiler always working with it in an 'order-independent' way. This assumption was not being upheld by the `native_libraries` query - the order of the entires in its result depends on the order of entries in `Options.libs`. This lead to an 'unstable fingerprint' ICE when the `-l` arguments were re-ordered. This PR removes the sorting logic entirely. Re-ordering command-line arguments (without adding/removing/changing any arguments) seems like a really niche use case, and correctly optimizing for it would require additional work. By always hashing arguments in their original order, we can entirely avoid a cause of 'unstable fingerprint' errors.
2021-05-31Improve display of the separation between page items and siblings in the sidebarGuillaume Gomez-1/+11
2021-05-31Only list crates on the crate pageGuillaume Gomez-8/+7
2021-05-31Auto merge of #85704 - Aaron1011:const-panic-hard-err, r=RalfJungbors-128/+56
Emit a hard error when a panic occurs during const-eval Previous, a panic during const evaluation would go through the `const_err` lint. This PR ensures that such a panic always causes compilation to fail.
2021-05-31Update rustdoc testGuillaume Gomez-1/+2
2021-05-31Add sidebar GUI testsGuillaume Gomez-0/+58
2021-05-31Auto merge of #85395 - 12101111:build-crt, r=petrochenkovbors-0/+32
Build crtbegin.o/crtend.o from source code Build crtbengin.o/crtend.o from source code instead of copying from gcc. The crtbegin and crtend implementation from llvm don't need `crtbeginS.o` for PIC. `crtbegin{,S,T}.o` is unified into one generic `crtbegin.o`. See the comments in https://reviews.llvm.org/D28791#1419436 and https://reviews.llvm.org/D28791#1420914 fix: https://github.com/rust-lang/rust/issues/85310 , fix: https://github.com/rust-lang/rust/issues/47551 , fix: https://github.com/rust-lang/rust/issues/84033
2021-05-30Remove toggle for "undocumented items."Jacob Hoffman-Andrews-44/+60
Per discussion in #84326. For trait implementations, this was misleading: the items actually do have documentation (but it comes from the trait definition). For both trait implementations and trait implementors, this was redundant: in both of those cases, the items are default-hidden by different toggle at the level above. Update tests: Remove XPath selectors that over-specified on details tag, in cases that weren't testing toggles. Add an explicit test for toggles on methods. Rename item-hide-threshold to toggle-item-contents for consistency.
2021-05-31Build crtbengin.o/crtend.o from source code12101111-0/+32
2021-05-31Auto merge of #85597 - 0yoyoyo:fix-issue-71563-remove-redundant-args, ↵bors-93/+237
r=petrochenkov Fix span of redundant generic arguments Fixes #71563 Above issue is about lifetime arguments, but generic arguments also have same problem. This PR fixes both help messages.
2021-05-30Auto merge of #85559 - 12101111:sanitizer-crt-static, r=nagisabors-0/+9
Diagnose use sanitizers with crt-static Fix: https://github.com/rust-lang/rust/issues/85459
2021-05-30Auto merge of #85838 - GuillaumeGomez:rollup-rk2rh7m, r=GuillaumeGomezbors-22/+66
Rollup of 8 pull requests Successful merges: - #85285 (Add eslint checks to CI) - #85709 (Use correct edition when parsing `:pat` matchers) - #85762 (Do not try to build LLVM with Zlib on Windows) - #85770 (Remove `--print unversioned-files` from rustdoc ) - #85781 (Add documentation for aarch64-apple-ios-sim target) - #85801 (Add `String::extend_from_within`) - #85817 (Fix a typo) - #85818 (Don't drop `PResult` without handling the error) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-05-30Rollup merge of #85818 - LeSeulArtichaut:85794-diag-drop-ice, r=petrochenkovGuillaume Gomez-0/+34
Don't drop `PResult` without handling the error Fixes #85794.
2021-05-30Rollup merge of #85770 - Bobo1239:set_locale_for_sort, r=jyn514Guillaume Gomez-22/+0
Remove `--print unversioned-files` from rustdoc This flag isn't needed anymore. See #83784.
2021-05-30Rollup merge of #85709 - Aaron1011:fix-pat-crate-edition, r=petrochenkovGuillaume Gomez-0/+32
Use correct edition when parsing `:pat` matchers As described in issue #85708, we currently do not properly decode `SyntaxContext::root()` and `ExpnId::root()` from foreign crates. As a result, when we decode a span from a foreign crate with `SyntaxContext::root()`, we end up up considering it to have the edition of the *current* crate, instead of the foreign crate where it was originally created. A full fix for this issue will be a fairly significant undertaking. Fortunately, it's possible to implement a partial fix, which gives us the correct edition-dependent behavior for `:pat` matchers when the macro is loaded from another crate. Since we have the edition of the macro's defining crate available, we can 'recover' from seeing a `SyntaxContext::root()` and use the edition of the macro's defining crate. Any solution to issue #85708 must reproduce the behavior of this targeted fix - properly preserving a foreign `SyntaxContext::root()` means (among other things) preserving its edition, which by definition is the edition of the foreign crate itself. Therefore, this fix moves us closer to the correct overall solution, and does not expose any new incorrect behavior to macros.
2021-05-30Bless tests.Camille GILLOT-16/+16
2021-05-30Auto merge of #85362 - jsgf:fix-emit-metadata, r=estebankbors-0/+34
Use command line metadata path if provided If the command-line has `--emit metadata=some/path/libfoo.rmeta` then use that. Closes #85356 I couldn't find any existing tests for the `--emit TYPE=PATH` command line syntax, so I wasn't sure how to test this aside from ad-hoc manual testing. Is there a ui test type for "generated output file with expected name"?
2021-05-30Emit a hard error when a panic occurs during const-evalAaron Hill-128/+56
Previous, a panic during const evaluation would go through the `const_err` lint. This PR ensures that such a panic always causes compilation to fail.
2021-05-30Fix span of redundant generic arguments0yoyoyo-93/+237
2021-05-30Update mir opt testsbjorn3-24/+24
2021-05-30Update testsbjorn3-68/+68
2021-05-30Auto merge of #83772 - jhpratt:revamp-step-trait, r=Mark-Simulacrumbors-11/+17
Make `Step` trait safe to implement This PR makes a few modifications to the `Step` trait that I believe better position it for stabilization in the short term. In particular, 1. `unsafe trait TrustedStep` is introduced, indicating that the implementation of `Step` for a given type upholds all stated invariants (which have remained unchanged). This is gated behind a new `trusted_step` feature, as stabilization is realistically blocked on min_specialization. 2. The `Step` trait is internally specialized on the `TrustedStep` trait, which avoids a serious performance regression. 3. `TrustedLen` is implemented for `T: TrustedStep` as the latter's invariants subsume the former's. 4. The `Step` trait is no longer `unsafe`, as the invariants must not be relied upon by unsafe code (unless the type implements `TrustedStep`). 5. `TrustedStep` is implemented for all types that implement `Step` in the standard library and compiler. 6. The `step_trait_ext` feature is merged into the `step_trait` feature. I was unable to find any reasoning for the features being split; the `_unchecked` methods need not necessarily be stabilized at the same time, but I think it is useful to have them under the same feature flag. All existing implementations of `Step` will be broken, as it is not possible to `unsafe impl` a safe trait. Given this trait only exists on nightly, I feel this breakage is acceptable. The blanket `impl<T: Step> TrustedLen for T` will likely cause some minor breakage, but this should be covered by the equivalent impl for `TrustedStep`. Hopefully these changes are sufficient to place `Step` in decent position for stabilization, which would allow user-defined types to be used with `a..b` syntax.
2021-05-30Don't drop `PResult` without handling the errorLeSeulArtichaut-0/+34
2021-05-29Auto merge of #85698 - ehuss:incremental-session-panic, r=estebankbors-0/+15
Don't panic when failing to initialize incremental directory. This removes a panic when rustc fails to initialize the incremental directory. This can commonly happen on various filesystems that don't support locking (often various network filesystems). Panics can be confusing and scary, and there are already plenty of issues reporting this. This has been panicking since 1.22 due to I think #44502 which was a major rework of how things work. Previously, things were simpler and the [`load_dep_graph`](https://github.com/rust-lang/rust/blob/1.21.0/src/librustc_incremental/persist/load.rs#L43-L65) function would emit an error and then continue on without panicking. With 1.22, [`load_dep_graph`](https://github.com/rust-lang/rust/blob/1.22.0/src/librustc_incremental/persist/load.rs#L44) was changed so that it assumes it can load the data without errors. Today, the problem is that it calls [`prepare_session_directory`](https://github.com/rust-lang/rust/blob/fbf1b1a7193cda17008ab590e06ad28d9924023b/compiler/rustc_interface/src/passes.rs#L175-L179) and then immediately calls `garbage_collect_session_directories` which will panic since the session is `IncrCompSession::NotInitialized`. The solution here is to have `prepare_session_directory` return an error that must be handled so that compilation stops if it fails. Some other options: * Ignore directory lock failures. * Print a warning on directory lock failure, but otherwise continue with incremental enabled. * Print a warning on directory lock failure, and disable incremental. * Provide a different locking mechanism. Cargo ignores lock errors if locking is not supported, so that would be a precedent for the first option. These options would require quite a bit more changes, but I'm happy to entertain any of them, as I think they all have valid justifications. There is more discussion on the many issues where this is reported: #49773, #59224, #66513, #76251. I'm not sure if this can be considered closing any of those, though, since I think there is some value in discussing if there is a way to avoid the error altogether. But I think it would make sense to at least close all but one to consolidate them.
2021-05-29Use correct edition when parsing `:pat` matchersAaron Hill-0/+32
As described in issue #85708, we currently do not properly decode `SyntaxContext::root()` and `ExpnId::root()` from foreign crates. As a result, when we decode a span from a foreign crate with `SyntaxContext::root()`, we end up up considering it to have the edition of the *current* crate, instead of the foreign crate where it was originally created. A full fix for this issue will be a fairly significant undertaking. Fortunately, it's possible to implement a partial fix, which gives us the correct edition-dependent behavior for `:pat` matchers when the macro is loaded from another crate. Since we have the edition of the macro's defining crate available, we can 'recover' from seeing a `SyntaxContext::root()` and use the edition of the macro's defining crate. Any solution to issue #85708 must reproduce the behavior of this targeted fix - properly preserving a foreign `SyntaxContext::root()` means (among other things) preserving its edition, which by definition is the edition of the foreign crate itself. Therefore, this fix moves us closer to the correct overall solution, and does not expose any new incorrect behavior to macros.
2021-05-29Auto merge of #85540 - GuillaumeGomez:better-result-dom-generation, r=jshabors-0/+15
Better result dom generation First commit is from https://github.com/rust-lang/rust/pull/85506. We realized in https://github.com/rust-lang/rust/pull/85506#issuecomment-844984162 thanks to `@dns2utf8` that in some cases, the generated search result DOM was invalid. This was not strict enough and the DOM was inserted as a big string, which wasn't great. r? `@jsha`
2021-05-29Fix incremental-session-fail to work when run as root.Eric Huss-2/+1
2021-05-29Auto merge of #85767 - lqd:stackless_span_stacks, r=oli-obkbors-14/+15
A bit more polish on const eval errors This PR adds a bit more polish to the const eval errors: - a slight improvement to the PME messages from #85633: I mentioned there that the erroneous item's paths were dependent on the environment, and could be displayed fully qualified or not. This can obscure the items when they come from a dependency. This PR uses the pretty-printing code ensuring the items' paths are not trimmed. - whenever there are generics involved in an item where const evaluation errors out, the error message now displays the instance and its const arguments, so that we can see which instantiated item and compile-time values lead to the error. So we get this slight improvement for our beloved `stdarch` example, on nightly: ``` error[E0080]: evaluation of constant value failed --> ./stdarch/crates/core_arch/src/macros.rs:8:9 | 8 | assert!(IMM >= MIN && IMM <= MAX, "IMM value not in expected range"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'IMM value not in expected range', /rustc/9111b8ae9793f18179a1336417618fc07a9cac85/library/core/src/../../stdarch/crates/core_arch/src/macros.rs:8:9 | ``` to this PR's: ``` error[E0080]: evaluation of `core::core_arch::macros::ValidateConstImm::<51_i32, 0_i32, 15_i32>::VALID` failed --> ./stdarch/crates/core_arch/src/macros.rs:8:9 | 8 | assert!(IMM >= MIN && IMM <= MAX, "IMM value not in expected range"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'IMM value not in expected range', ./stdarch/crates/core_arch/src/macros.rs:8:9 | ``` with this PR. Of course this is an idea from Oli, so maybe r? `@oli-obk` if they have the time.
2021-05-28Add test for --emit TYPE=pathJeremy Fitzhardinge-0/+34
2021-05-28Auto merge of #85607 - LeSeulArtichaut:thir-unsafeck-closures, r=nikomatsakisbors-14/+142
Make closures inherit their parent's "safety context" Fixes rust-lang/project-thir-unsafeck#9, ~~blocked on #85273~~. r? `@nikomatsakis`
2021-05-28rustc: Allow safe #[target_feature] on wasmAlex Crichton-0/+44
This commit updates the compiler's handling of the `#[target_feature]` attribute when applied to functions on WebAssembly-based targets. The compiler in general requires that any functions with `#[target_feature]` are marked as `unsafe` as well, but this commit relaxes the restriction for WebAssembly targets where the attribute can be applied to safe functions as well. The reason this is done is that the motivation for this feature of the compiler is not applicable for WebAssembly targets. In general the `#[target_feature]` attribute is used to enhance target CPU features enabled beyond the basic level for the rest of the compilation. If done improperly this means that your program could execute an instruction that the CPU you happen to be running on does not understand. This is considered undefined behavior where it is unknown what will happen (e.g. it's not a deterministic `SIGILL`). For WebAssembly, however, the target is different. It is not possible for a running WebAssembly program to execute an instruction that the engine does not understand. If this were the case then the program would not have validated in the first place and would not run at all. Even if this were allowed in some hypothetical future where engines have some form of runtime feature detection (which they do not right now) any implementation of such a feature would generate a trap if a module attempts to execute an instruction the module does not understand. This deterministic trap behavior would still not fall into the category of undefined behavior because the trap is deterministic. For these reasons the `#[target_feature]` attribute is now allowed on safe functions, but only for WebAssembly targets. This notably enables the wasm-SIMD intrinsics proposed for stabilization in #74372 to be marked as safe generally instead of today where they're all `unsafe` due to the historical implementation of `#[target_feature]` in the compiler.