about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2021-06-12Rollup merge of #86205 - JohnTitor:full-test-for-72293, r=oli-obkYuki Okushi-11/+17
Run full const-generics test for issue-72293 Closes #72293 r? ```@oli-obk```
2021-06-12Rollup merge of #86174 - lqd:const-ub-align, r=RalfJungYuki Okushi-0/+48
Detect incorrect vtable alignment during const eval This PR fixes #86132 by detecting invalid alignment values for trait objects in the interpreter, and emitting an error about this conversion failure, to avoid the ICE. I've noticed that the error emitted at https://github.com/rust-lang/rust/blob/a50d72158e08e02cfc051b863017bdbd2c45b637/compiler/rustc_mir/src/interpret/traits.rs#L163-L166 doesn't seem to be present in the const-ub tests, so I've tried adding a test that triggers both of these cases: one for the invalid size, and another for the invalid alignment that #86132 tracks (I have found different magic values triggering different `Align::from_bytes` errors than the "power of 2" one, if need be). However, when doing that, I *cannot* for the life of me figure out the correct incantation to make these 2 errors trigger with the "it is undefined behavior to use this value" message rather than the "any use of this value will cause an error" lint. I've tried Oli's suggestions of different values, tuples and arrays, using the transparent wrapper trick from the other tests and I was only able to trigger the regular const-ub errors about the size of the vtable, or that the drop pointer was invalid. Maybe these "type validation failed" errors happen before this part of the interpreter is reached and there just needs some magic incorrect values to bypass them, I don't know. Since this fixes an ICE, and if the constants are indeed used, these 2 tests will turn into a hard error, I thought I'd open the PR anyways. And if ```@RalfJung``` you know of a way I could manage that (if you think that these tests are worth checking that the `throw_ub_format!` does indeed create const-ub errors as we expect) I'd be grateful. For that reason, r? ```@RalfJung``` and cc ```@oli-obk.```
2021-06-12Rollup merge of #85823 - fee1-dead:borrowck-0, r=jackh726Yuki Okushi-0/+20
Do not suggest ampmut if rhs is already mutable Removes invalid suggestion in #85765, although it should highlight the user type instead of the local variable. Looking at the comments of this line: https://github.com/rust-lang/rust/blob/84b1005bfd22e2cb2a4c13b0b81958fe72628354/compiler/rustc_mir_build/src/build/matches/mod.rs#L2107 It was intentionally set to `None`, causing it to highlight the local variable instead. I am not sure if I will be able to fix it. Fixes #85765
2021-06-12Rollup merge of #85800 - BoxyUwU:const-param-default-diagnostics, r=oli-obkYuki Okushi-12/+40
Fix some diagnostic issues with const_generics_defaults feature gate This PR makes a few changes: - print out const param defaults in "lifetime ordering" errors rather than discarding them - update `is_simple_text` to account for const params when checking if a type has no generics, this was causing a note to be failed to add to an error message - fixes some diagnostic wording that incorrectly said there was ordering restrictions between type/const params despite the `const_generics_defaults` feature gate is active
2021-06-11Auto merge of #86116 - FabianWolff:issue-86100, r=varkorbors-0/+80
Suggest a trailing comma if a 1-tuple is expected and a parenthesized expression is found This pull request fixes #86100. The following code: ```rust fn main() { let t: (i32,) = (1); } ``` currently produces: ``` warning: unnecessary parentheses around assigned value --> test.rs:2:21 | 2 | let t: (i32,) = (1); | ^^^ help: remove these parentheses | = note: `#[warn(unused_parens)]` on by default error[E0308]: mismatched types --> test.rs:2:21 | 2 | let t: (i32,) = (1); | ------ ^^^ expected tuple, found integer | | | expected due to this | = note: expected tuple `(i32,)` found type `{integer}` error: aborting due to previous error; 1 warning emitted ``` With my changes, I get the same warning and the following error: ``` error[E0308]: mismatched types --> test.rs:2:21 | 2 | let t: (i32,) = (1); | ------ ^^^ expected tuple, found integer | | | expected due to this | = note: expected tuple `(i32,)` found type `{integer}` help: use a trailing comma to create a tuple with one element | 2 | let t: (i32,) = (1,); | ^^^^ ``` i.e. I have added a suggestion to add a trailing comma to create a 1-tuple. This suggestion is only issued if a 1-tuple is expected and the expression (`(1)` in the example above) is surrounded by parentheses and does not already have a tuple type. In this situation, I'd say that it is pretty likely that the user meant to create a tuple.
2021-06-11Auto merge of #85994 - tmiasko:monomorphic-needs-drop, r=RalfJungbors-0/+37
Disallow non-monomorphic calls to `needs_drop` in interpreter otherwise evaluation could change after further substitutions.
2021-06-11Auto merge of #86204 - alexcrichton:wasm-simd-stable, r=Amanieubors-2/+0
std: Stabilize wasm simd intrinsics This commit performs two changes to stabilize Rust support for WebAssembly simd intrinsics: * The stdarch submodule is updated to pull in rust-lang/stdarch#1179. * The `wasm_target_feature` feature gate requirement for the `simd128` feature has been removed, stabilizing the name `simd128`. This should conclude the FCP started on #74372 and... Closes #74372
2021-06-10std: Stabilize wasm simd intrinsicsAlex Crichton-2/+0
This commit performs two changes to stabilize Rust support for WebAssembly simd intrinsics: * The stdarch submodule is updated to pull in rust-lang/stdarch#1179. * The `wasm_target_feature` feature gate requirement for the `simd128` feature has been removed, stabilizing the name `simd128`. This should conclude the FCP started on #74372 and... Closes #74372
2021-06-11Run full const-generics test for issue-72293Yuki Okushi-11/+17
2021-06-10Auto merge of #80080 - rylev:qpath-on-struct, r=petrochenkovbors-34/+147
Allow qualified paths in struct construction (both expressions and patterns) Fixes #79658
2021-06-10Auto merge of #82639 - jyn514:stable-options, r=Mark-Simulacrumbors-811/+74
Don't pass -Z unstable-options by default for UI tests Unconditionally passing -Z unstable-options makes it impossible to test whether an option requires unstable-options or not. This uncovered quite a lot of bugs, I'll open issues for each. These don't strictly need to be fixed before this is merged, it just makes the diff much larger because of the changes to diagnostics. - https://github.com/rust-lang/rust/issues/82636 - https://github.com/rust-lang/rust/issues/82637 - https://github.com/rust-lang/rust/issues/82638
2021-06-10Add support for using qualified paths with structs in expression and patternRyan Levick-34/+147
position.
2021-06-09detect incorrect vtable alignment during const eval instead of ICE-ingRémy Rakic-0/+48
also add tests for these 2 kinds of errors for size and alignment, as the existing size check wasn't apparently tested
2021-06-09Auto merge of #86003 - pnkfelix:issue-84297-revert-81238, r=Mark-Simulacrumbors-198/+25
Make copy/copy_nonoverlapping fn's again Make copy/copy_nonoverlapping fn's again, rather than intrinsics. This a short-term change to address issue #84297. It effectively reverts PRs #81167 #81238 (and part of #82967), #83091, and parts of #79684.
2021-06-09Auto merge of #86118 - spastorino:tait-soundness-bug, r=nikomatsakisbors-0/+103
Create different inference variables for different defining uses of TAITs Fixes #73481 r? `@nikomatsakis` cc `@oli-obk`
2021-06-09Rollup merge of #86124 - Aaron1011:ambig-macro-name, r=varkorYuki Okushi-2/+2
Include macro name in 'local ambiguity' error Currently, we only point at the span of the macro argument. When the macro call is itself generated by another macro, this can make it difficult or impossible to determine which macro is responsible for producing the error.
2021-06-08Rollup merge of #86096 - FabianWolff:ec-E0316, r=GuillaumeGomezYuki Okushi-0/+1
Comment out unused error codes and add description for E0316 I have added an extended description of `E0316` and commented out a bunch of unused error codes to make clear the fact that they are no longer in use. You can check for yourself with ```shell for ec in \ E0314 E0315 E0473 E0474 E0475 E0479 E0480 E0481 \ E0483 E0484 E0485 E0486 E0487 E0488 E0489 do if [ ! -z "`grep -r $ec compiler/* --exclude-dir=rustc_error_codes`" ] then echo $ec false fi done ``` i.e. these error codes appear nowhere in the compiler code and thus cannot be emitted. r? ```@GuillaumeGomez```
2021-06-08Rollup merge of #86074 - reaganmcf:iss-86039, r=jyn514Yuki Okushi-2/+2
Default panic message should print Box<dyn Any> Closes #86039 Prior to this patch, the panic message from running the following code would be `thread 'main' panicked at 'Box<Any>'...` ```rust use std::panic::panic_any; fn main() { panic_any(42); } ``` This patch updates the phrasing to be more consistent. It now instead shows the following panic message: ``` thread 'main' panicked at 'Box<dyn Any>', ... ``` It's a very small fix 😄
2021-06-07Include macro name in 'local ambiguity' errorAaron Hill-2/+2
Currently, we only point at the span of the macro argument. When the macro call is itself generated by another macro, this can make it difficult or impossible to determine which macro is responsible for producing the error.
2021-06-07Add more TAIT multiple defining uses test casesSantiago Pastorino-0/+72
2021-06-07Differentiate different defining uses of taits when they reference distinct ↵Santiago Pastorino-0/+31
generic parameters
2021-06-07Suggest a trailing comma if a 1-tuple is expectedFabian Wolff-0/+80
2021-06-07Bless ui/where-clauses/where-for-self.rs testFabian Wolff-0/+1
2021-06-07Auto merge of #85891 - bjorn3:revert_merge_crate_disambiguator, ↵bors-68/+68
r=Mark-Simulacrum Revert "Merge CrateDisambiguator into StableCrateId" This reverts https://github.com/rust-lang/rust/pull/85804
2021-06-07note :sparkles: uwuuuEllen-8/+13
2021-06-07Revert "Update tests"bjorn3-68/+68
This reverts commit c76b1b031753fc08a18a3906d828683476c1e595.
2021-06-07Rollup merge of #84262 - camelid:sized-ice, r=estebankYuki Okushi-0/+58
Fix ICE during type layout when there's a `[type error]` Fixes #84108. Based on estebank's [comment], except I used `delay_span_bug` because it should work in more cases, and I think it expresses its intent more clearly. r? `@estebank` [comment]: https://github.com/rust-lang/rust/issues/84108#issuecomment-818916848
2021-06-06Update testsuite to match new panic msgReagan McFarland-2/+2
This patch fixes tests from failing that were matching on `Box<Any>`, which was the old panic message. Since the new panic message is `Box<dyn Any>`, the tests have been updated to match against this instead.
2021-06-07Rollup merge of #86058 - fee1-dead:E0121-improvements, r=jackh726Guillaume Gomez-22/+22
Remove `_` from E0121 diagnostic suggestions Fixes #86021.
2021-06-07Rollup merge of #86010 - FabianWolff:ICE-parser, r=varkorGuillaume Gomez-0/+135
Fix two ICEs in the parser This pull request fixes #84104 and fixes #84148. The latter is caused by an invalid `assert_ne!()` in the parser, which I have simply removed because the error is then caught in another part of the parser. #84104 is somewhat more subtle and has to do with a suggestion to remove extraneous `<` characters; for instance: ```rust fn main() { foo::<Ty<<<i32>(); } ``` currently leads to ``` error: unmatched angle brackets --> unmatched-langle.rs:2:10 | 2 | foo::<Ty<<<i32>(); | ^^^ help: remove extra angle brackets ``` which is obviously wrong and stems from the fact that the code for issuing the above suggestion does not consider the possibility that there might be other tokens in between the opening angle brackets. In #84104, this has led to a span being generated that ends in the middle of a multi-byte character (because the code issuing the suggestion thought that it was only skipping over `<`, which are single-byte), causing an ICE.
2021-06-06Add variance-related information to lifetime error messagesAaron Hill-0/+53
2021-06-06Auto merge of #84995 - petrochenkov:tcollect, r=Aaron1011bors-0/+577
parser: Ensure that all nonterminals have tokens after parsing `parse_nonterminal` should always result in something with tokens. This requirement wasn't satisfied in two cases: - `stmt` nonterminal with expression statements (e.g. `0`, or `{}`, or `path + 1`) because `fn parse_stmt_without_recovery` forgot to propagate `force_collect` in some cases. - `expr` nonterminal with expressions with built-in attributes (e.g. `#[allow(warnings)] 0`) due to an incorrect optimization in `fn parse_expr_force_collect`, it assumed that all expressions starting with `#` have their tokens collected during parsing, but that's not true if all the attributes on that expression are built-in and inert. (Discovered when trying to implement eager `cfg` expansion for all attributes https://github.com/rust-lang/rust/pull/83824#issuecomment-817317170.) r? `@Aaron1011`
2021-06-06Auto merge of #86054 - JohnTitor:rollup-j40z7sm, r=JohnTitorbors-14/+36
Rollup of 8 pull requests Successful merges: - #85436 (Avoid cloning cache key) - #85772 (Preserve metadata w/ Solaris-like linkers.) - #85920 (Tweak wasm_base target spec to indicate linker is not GNU and update linker inferring logic for wasm-ld.) - #85930 (Update standard library for IntoIterator implementation of arrays ) - #85972 (Rustdoc html fixes) - #86028 (Drop an `if let` that will always succeed) - #86043 (don't clone attrs) - #86047 (Don't fire `invalid_doc_attributes` on `extern crate` items) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-06-06parser: Ensure that all nonterminals have tokens after parsingVadim Petrochenkov-0/+577
2021-06-06Rollup merge of #86047 - jyn514:doc-attrs, r=petrochenkovYuki Okushi-0/+22
Don't fire `invalid_doc_attributes` on `extern crate` items Fixes https://github.com/rust-lang/rust/issues/86046.
2021-06-06Rollup merge of #85930 - mominul:array_into_iter, r=m-ou-seYuki Okushi-14/+14
Update standard library for IntoIterator implementation of arrays This PR partially resolves issue #84513 of updating the standard library part. I haven't found any remaining doctest examples which are using iterators over e.g. &i32 instead of just i32 in the standard library. Can anyone point me to them if there's remaining any? Thanks! r? ```@m-ou-se```
2021-06-06Auto merge of #84863 - ABouttefeux:libtest, r=m-ou-sebors-2/+38
Show test type during prints Test output can sometimes be confusing. For example doctest with the no_run argument are displayed the same way than test that are run. During #83857 I got the feedback that test output can be confusing. For the moment test output is ``` test $DIR/test-type.rs - f (line 12) ... ignored test $DIR/test-type.rs - f (line 15) ... ok test $DIR/test-type.rs - f (line 21) ... ok test $DIR/test-type.rs - f (line 6) ... ok ``` I propose to change output by indicating the test type as ``` test $DIR/test-type.rs - f (line 12) ... ignored test $DIR/test-type.rs - f (line 15) - compile ... ok test $DIR/test-type.rs - f (line 21) - compile fail ... ok test $DIR/test-type.rs - f (line 6) ... ok ``` by indicating the test type after the test name (and in the case of doctest after the function name and line) and before the "...". ------------ Note: this is a proof of concept, the implementation is probably not optimal as the properties added in `TestDesc` are only use in the display and does not represent actual change of behavior, maybe `TestType::DocTest` could have fields
2021-06-06Don't pass -Z unstable-options by default for UI testsJoshua Nelson-811/+74
- Pass it explicitly where appropriate - Update stderr files and warnings; it turns that unstable-options has far-reaching effects on diagnostics.
2021-06-06Auto merge of #84171 - ricobbe:raw-dylib-via-llvm, r=petrochenkovbors-1/+85
Partial support for raw-dylib linkage First cut of functionality for issue #58713: add support for `#[link(kind = "raw-dylib")]` on `extern` blocks in lib crates compiled to .rlib files. Does not yet support `#[link_name]` attributes on functions, or the `#[link_ordinal]` attribute, or `#[link(kind = "raw-dylib")]` on `extern` blocks in bin crates; I intend to publish subsequent PRs to fill those gaps. It's also not yet clear whether this works for functions in `extern "stdcall"` blocks; I also intend to investigate that shortly and make any necessary changes as a follow-on PR. This implementation calls out to an LLVM function to construct the actual `.idata` sections as temporary `.lib` files on disk and then links those into the generated .rlib.
2021-06-05Don't fire `invalid_doc_attributes` on `extern crate` itemsJoshua Nelson-0/+22
2021-06-06Auto merge of #79608 - alessandrod:bpf, r=nagisabors-1/+2
BPF target support This adds `bpfel-unknown-none` and `bpfeb-unknown-none`, two new no_std targets that generate little and big endian BPF. The approach taken is very similar to the cuda target, where `TargetOptions::obj_is_bitcode` is enabled and code generation is done by the linker. I added the targets to `dist-various-2`. There are [some tests](https://github.com/alessandrod/bpf-linker/tree/main/tests/assembly) in bpf-linker and I'm planning to add more. Those are currently not ran as part of rust CI.
2021-06-05Rollup merge of #85501 - jyn514:invalid-doc-attrs, r=varkorGuillaume Gomez-0/+23
Fix `deny(invalid_doc_attributes)` Fixes https://github.com/rust-lang/rust/issues/85497.
2021-06-05Disallow non-monomorphic calls to `needs_drop` in interpreterTomasz Miąsko-0/+37
otherwise evaluation could change after further substitutions.
2021-06-05Remove `_` from E0121 diagnostic suggestionsDeadbeef-22/+22
2021-06-05Auto merge of #86001 - richkadel:revert-85617-rustin-patch-fix, ↵bors-158/+148
r=Mark-Simulacrum Revert "shrinking the deprecated method span" Reverts rust-lang/rust#85617 Fixes: #86000 r? `@Mark-Simulacrum`
2021-06-05Auto merge of #85919 - workingjubilee:simd-ptrs-are-valid, r=petrochenkovbors-0/+122
Allow raw pointers in SIMD types Closes #85915 by loosening the strictness in typechecking and adding a test to guarantee it passes. This still might be too strict, as references currently do pass monomorphization, but my understanding is that they are not guaranteed to be "scalar" in the same way.
2021-06-05Auto merge of #85457 - jyn514:remove-doc-include, r=GuillaumeGomezbors-93/+0
Remove `doc(include)` This nightly feature is redundant now that `extended_key_value_attributes` is stable (https://github.com/rust-lang/rust/pull/83366). `@rust-lang/rustdoc` not sure if you think this needs FCP; there was already an FCP in #82539, but technically it was for deprecating, not removing the feature altogether. This should not be merged before #83366. cc `@petrochenkov`
2021-06-04Add first cut of functionality for #58713: support for #[link(kind = ↵Richard Cobbe-1/+85
"raw-dylib")]. This does not yet support #[link_name] attributes on functions, the #[link_ordinal] attribute, #[link(kind = "raw-dylib")] on extern blocks in bin crates, or stdcall functions on 32-bit x86.
2021-06-05Fix handling of unmatched angle brackets in parserFabian Wolff-0/+73
2021-06-04Added a new test demonstrating the issue requiring revertRich Kadel-0/+18
Note, the `Debug` impl is required.