about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2020-09-10Syntactically permit unsafety on modsDavid Tolnay-2/+173
2020-09-10Auto merge of #76378 - petrochenkov:lldtest, r=Mark-Simulacrumbors-2/+2
rustbuild: Build tests with LLD if `use-lld = true` was passed Addresses https://github.com/rust-lang/rust/pull/76127#discussion_r479932392. Our test suite is generally ready to run with an explicitly specified linker (https://github.com/rust-lang/rust/pull/45191), so LLD specified with `use-lld = true` works as well. Only 4 tests fail (on `x86_64-pc-windows-msvc`): ``` ui/panic-runtime/lto-unwind.rs run-make-fulldeps/debug-assertions run-make-fulldeps/foreign-exceptions run-make-fulldeps/test-harness ``` All of them are legitimate issues with LLD (or at least with combination Rust+LLD) and manifest in segfaults on access to TLS (https://github.com/rust-lang/rust/pull/76127#issuecomment-683473325). UPD: These issues are caused by https://github.com/rust-lang/rust/issues/72145 and appear because I had `-Ctarget-cpu=native` set. UPD: Further commits build tests with LLD for non-MSVC targets and propagate LLD to more places when `use-lld` is enabled.
2020-09-10Auto merge of #76291 - matklad:spacing, r=petrochenkovbors-2/+2
Rename IsJoint -> Spacing Builds on #76286 and might conflict with #76285 r? `@petrochenkov`
2020-09-10Auto merge of #75573 - Aaron1011:feature/const-mutation-lint, r=oli-obkbors-11/+183
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 #76500 - richkadel:mir-graphviz-dark, r=tmandryTyler Mandry-3/+3
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 #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-234/+684
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-101/+105
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-09Also fixed monospace font for d3-graphviz engineRich Kadel-3/+3
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-09Auto merge of #74595 - lcnr:ConstEvaluatable-fut-compat, r=oli-obkbors-3/+71
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-09fix test on 32 bit systemsBastian Kauschke-8/+5
2020-09-09Auto merge of #76445 - jyn514:doctests, r=Mark-Simulacrum,ollie27bors-1/+1
Make rustdoc output deterministic for UI tests Closes https://github.com/rust-lang/rust/issues/76442 (hopefully, since it's non-deterministic I don't have a way to test). r? `@Mark-Simulacrum` cc `@GuillaumeGomez`
2020-09-09Auto merge of #76406 - GuillaumeGomez:create-e0774, r=pickfire,jyn514bors-28/+38
Create E0774
2020-09-08Capitalize safety commentsFlying-Toast-1/+1
2020-09-09Rollup merge of #76401 - JulianKnodt:i68366, r=lcnrDylan DPC-0/+39
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-08Update testsGuillaume Gomez-28/+38
2020-09-08fix testBastian Kauschke-2/+7
2020-09-08add tracking issue, fix rebaseBastian Kauschke-3/+3
2020-09-08add testsBastian Kauschke-0/+29
2020-09-08convert to future compat lintBastian Kauschke-10/+18
2020-09-08make `ConstEvaluatable` more strictBastian Kauschke-5/+34
2020-09-08Auto merge of #76308 - wesleywiser:enable_simplifyarmidentity_mir_opt, r=oli-obkbors-6/+8
Enable the SimplifyArmIdentity MIR optimization at mir-opt-level=1 r? `@ghost`
2020-09-08Auto merge of #75585 - RalfJung:demotion, r=oli-obkbors-0/+50
Do not promote &mut of a non-ZST ever Since ~pre-1.0~ 1.36, we have accepted code like this: ```rust static mut TEST: &'static mut [i32] = { let x = &mut [1,2,3]; x }; ``` I tracked it back to https://github.com/rust-lang/rust/pull/21744, but unfortunately could not find any discussion or RFC that would explain why we thought this was a good idea. And it's not, it breaks all sorts of things -- see https://github.com/rust-lang/rust/issues/75556. To fix https://github.com/rust-lang/rust/issues/75556, we have to stop promoting non-ZST mutable references no matter the context, which is what this PR does. It's a breaking change. Notice that this still works, since it does not rely on promotion: ```rust static mut TEST: &'static mut [i32] = &mut [0,1,2]; ``` Cc `@rust-lang/wg-const-eval`
2020-09-08Auto merge of #75138 - jumbatm:session-diagnostic-derive, r=oli-obkbors-0/+395
Add derive macro for specifying diagnostics using attributes. Introduces `#[derive(SessionDiagnostic)]`, a derive macro for specifying structs that can be converted to Diagnostics using directions given by attributes on the struct and its fields. Currently, the following attributes have been implemented: - `#[code = "..."]` -- this sets the Diagnostic's error code, and must be provided on the struct iself (ie, not on a field). Equivalent to calling `code`. - `#[message = "..."]` -- this sets the Diagnostic's primary error message. - `#[label = "..."]` -- this must be applied to fields of type `Span`, and is equivalent to `span_label` - `#[suggestion(..)]` -- this allows a suggestion message to be supplied. This attribute must be applied to a field of type `Span` or `(Span, Applicability)`, and is equivalent to calling `span_suggestion`. Valid arguments are: - `message = "..."` -- this sets the suggestion message. - (Optional) `code = "..."` -- this suggests code for the suggestion. Defaults to empty. `suggestion`also comes with other variants: `#[suggestion_short(..)]`, `#[suggestion_hidden(..)]` and `#[suggestion_verbose(..)]` which all take the same keys. Within the strings passed to each attribute, fields can be referenced without needing to be passed explicitly into the format string -- eg, `#[error = "{ident} already declared"] ` will set the error message to `format!("{} already declared", &self.ident)`. Any fields on the struct can be referenced in this way. Additionally, for any of these attributes, Option fields can be used to only optionally apply the decoration -- for example: ```rust #[derive(SessionDiagnostic)] #[code = "E0123"] struct SomeKindOfError { ... #[suggestion(message = "informative error message")] opt_sugg: Option<(Span, Applicability)> ... } ``` will not emit a suggestion if `opt_sugg` is `None`. We plan on iterating on this macro further; this PR is a start. Closes #61132. r? `@oli-obk`
2020-09-07Make rustdoc output deterministic for UI testsJoshua Nelson-1/+1
2020-09-07Add regression test and help notekadmin-0/+39
2020-09-07Add CONST_ITEM_MUTATION lintAaron Hill-11/+183
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-07Auto merge of #76368 - ayushmishra2005:move_str_contact_library, r=jyn514bors-9/+0
Added str tests in library Added str tests in library as a part of #76268 r? @matklad
2020-09-06Improved the MIR spanview outputRich Kadel-234/+684
* 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
2020-09-07Rollup merge of #76324 - ayushmishra2005:move_vec_tests_in_library, r=matkladDylan DPC-62/+0
Move Vec slice UI tests in library Moved some of Vec slice UI tests in Library as a part of #76268 r? @matklad
2020-09-07Rollup merge of #76309 - lzutao:indent-note, r=jyn514Dylan DPC-5/+5
Indent a note to make folding work nicer Sublime Text folds code based on indentation. It maybe an unnecessary change, but does it look nicer after that ?
2020-09-07Rollup merge of #76305 - CDirkx:const-tests, r=matkladDylan DPC-46/+0
Move various ui const tests to `library` Move: - `src\test\ui\consts\const-nonzero.rs` to `library\core` - `src\test\ui\consts\ascii.rs` to `library\core` - `src\test\ui\consts\cow-is-borrowed` to `library\alloc` Part of #76268 r? @matklad
2020-09-07Rollup merge of #76299 - CDirkx:ip-tests, r=matkladDylan DPC-111/+0
Make `Ipv4Addr` and `Ipv6Addr` const tests unit tests under `library` These tests are about the standard library, not the compiler itself, thus should live in `library`, see #76268.
2020-09-07Rollup merge of #76293 - Amjad50:incompatible_features_error, r=lcnrDylan DPC-0/+20
Implementation of incompatible features error Proposal of a new error: Incompatible features This error should happen if two features which are not compatible are used together. For now the only incompatible features are `const_generics` and `min_const_generics` fixes #76280
2020-09-07Rollup merge of #76274 - scottmcm:fix-76271, r=petrochenkovDylan DPC-0/+12
Allow try blocks as the argument to return expressions Fixes #76271 I don't think this needs to be edition-aware (phew) since `return try` in 2015 is also the start of an expression, just with a struct literal instead of a block (`return try { x: 4, y: 5 }`).
2020-09-07Rollup merge of #76273 - CraftSpider:master, r=matkladDylan DPC-69/+0
Move some Vec UI tests into alloc unit tests A bit of work towards #76268, makes a number of the Vec UI tests that are simply running code into unit tests. Ensured that they are being run when testing liballoc locally.
2020-09-07rustbuild: Build tests with LLD if `use-lld = true` was passedVadim Petrochenkov-2/+2
2020-09-06Auto merge of #76390 - MaulingMonkey:pr-min-cdb-version, r=petrochenkovbors-0/+4
debuginfo: Ignore HashMap .natvis tests before cdb 10.0.18362.1 CDB <10.0.18362.1 chokes on casts within HashMap's natvis visualizers. This PR adds support for "min-cdb-version" (per existing "min-gdb-version" and "min-lldb-version" filters) and uses it. CI uses a more recent version of CDB for testing and thus should still run the tests. Credit to @petrochenkov per https://github.com/rust-lang/rust/issues/76352 for helping catch this. ### SDK Testing | Win 10 SDK | x64 CDB | rustc 1.47.0-nightly (bf4342114 2020-08-25) built-in .natvis | Note | | --------------------------------------------------------------------- | ----------------- | ------------------------------------------------------------- | ---- | | [10.0.19041.0](https://go.microsoft.com/fwlink/p/?linkid=2120843) | 10.0.19041.1 | ✔️ | CI | [10.0.18362.1](https://go.microsoft.com/fwlink/?linkid=2083338) | 10.0.18362.1 | ✔️ | MaulingMonkey | [10.0.17763.0](https://go.microsoft.com/fwlink/p/?LinkID=2033908) | 10.0.17763.132 | ❌ `Unable to find type 'tuple<u64,u64> *' for cast.` | [10.0.17134.12](https://go.microsoft.com/fwlink/p/?linkid=870807) | 10.0.17134.12 | ❌ `Unable to find type 'tuple<u64,u64> *' for cast.` | [10.0.16299.91](https://go.microsoft.com/fwlink/p/?linkid=864422) | 10.0.16299.91 | ❌ `Unable to find type 'tuple<u64,u64> *' for cast.` | [10.0.15063.468](https://go.microsoft.com/fwlink/p/?LinkId=845298) | 10.0.15063.468 | ❌ `Unable to find type 'tuple<u64,u64> *' for cast.` | [10.0.14393.795](https://go.microsoft.com/fwlink/p/?LinkId=838916) | 10.0.14321.1024 | ❌ `Unable to find type 'tuple<u64,u64> *' for cast.` | petrochenkov | [10.0.10586.212](https://go.microsoft.com/fwlink/p/?LinkID=698771) | 10.0.10586.567 | ❌ `Expected ')' at '+ 1)].__1'` | [10.0.10240](https://go.microsoft.com/fwlink/p/?LinkId=619296) | 10.0.10240? | ❔ Untested ### Rust Testing ```cmd x.py test --stage 1 src/tools/tidy x.py test --stage 1 --build x86_64-pc-windows-msvc src\test\debuginfo ``` Also verified test still fails when intentionally broken w/ CDB version >= min-cdb-version.
2020-09-06add compile-fail test for &mut promotionRalf Jung-1/+34
2020-09-06do not premote non-ZST mutable references everRalf Jung-0/+17
2020-09-06Generalize to Eq(true, _place) and Eq(_place, true)Simon Vandel Sillesen-0/+44
2020-09-06Add peephold optimization that simplifies Ne(_1, false) and Ne(false, _1) ↵Simon Vandel Sillesen-0/+81
into _1 This was observed emitted from the MatchBranchSimplification pass.
2020-09-06Auto merge of #76331 - Aaron1011:fix/group-compat-hack-test, r=petrochenkovbors-7/+43
Account for version number in NtIdent hack Issue #74616 tracks a backwards-compatibility hack for certain macros. This has is implemented by hard-coding the filenames and macro names of certain code that we want to continue to compile. However, the initial implementation of the hack was based on the directory structure when building the crate from its repository (e.g. `js-sys/src/lib.rs`). When the crate is build as a dependency, it will include a version number from the clone from the cargo registry (e.g. `js-sys-0.3.17/src/lib.rs`), which would fail the check. This commit modifies the backwards-compatibility hack to check that desired crate name (`js-sys` or `time-macros-impl`) is a prefix of the proper part of the path. See https://github.com/rust-lang/rust/issues/76070#issuecomment-687215646 for more details.
2020-09-05debuginfo: Ignore HashMap tests before cdb 10.0.18362.1MaulingMonkey-0/+4
cdb chokes on the cast and reports "Unable to find type 'tuple<u64,u64> *' for cast."
2020-09-05Auto merge of #75872 - mati865:pgo-tests, r=petrochenkovbors-1/+29
Enable some of profiler tests on Windows-gnu CC https://github.com/rust-lang/rust/issues/61266 Because of force-push GitHub didn't let me reopen https://github.com/rust-lang/rust/pull/75184 Because of the GCC miscompilation, generated binaries either segfault or `.profraw` is malformed. Clang works fine but we can't use it on the CI. However we can still test the IR for the proper instrumentation so let's do it.
2020-09-05Rollup merge of #76263 - tmiasko:inline-codegen-fn-attrs, r=ecstatic-morseDylan DPC-0/+133
inliner: Check for codegen fn attributes compatibility * Check for target features compatibility * Check for no_sanitize attribute compatibility Fixes #76259.
2020-09-05Rollup merge of #76254 - tmiasko:fold-len, r=wesleywiserDylan DPC-0/+29
Fold length constant in Rvalue::Repeat Fixes #76248.
2020-09-05Rollup merge of #76082 - jyn514:top-level-links, r=ollie27,GuillaumeGomezDylan DPC-0/+31
Fix intra-doc links on pub re-exports Partial fix for https://github.com/rust-lang/rust/issues/76073 - This removes the incorrect error, but doesn't show the documentation anywhere. r? @GuillaumeGomez
2020-09-05Rollup merge of #76078 - jyn514:no-disambiguator, r=manishearthDylan DPC-0/+51
Remove disambiguators from intra doc link text Closes https://github.com/rust-lang/rust/issues/65354. r? @Manishearth The commits are mostly atomic, but there might be some mix between them here and there. I recommend reading 'refactor ItemLink' and 'refactor RenderedLink' on their own though, lots of churn without any logic changes.
2020-09-05Rollup merge of #75695 - JohnTitor:regression-test, r=Dylan-DPCDylan DPC-0/+27
Add a regression test for issue-72793 Adds a regression test for #72793, which is fixed by #75443. Note that this won't close the issue as the snippet still shows ICE with `-Zmir-opt-level=2`. But it makes sense to add a test anyway.