about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2021-02-28Support LLVM 12 in rustcNikita Popov-43/+49
2021-02-28Apply lint restrictions from renamed lintsJoshua Nelson-0/+37
Previously, if you denied the old name of a renamed lint, it would warn about using the new name, but otherwise do nothing. Now, it will behave the same as if you'd used the new name.
2021-02-28Use -O in try_identity test that requires storage markersTomasz Miąsko-1/+1
2021-02-28Remove storage markers if they won't be used during code generationTomasz Miąsko-2/+126
The storage markers constitute a substantial portion of all MIR statements. At the same time, for builds without any optimizations, the storage markers have no further use during and after MIR optimization phase. If storage markers are not necessary for code generation, remove them.
2021-02-28Update rustdoc test to make it work with newly added rustc passesGuillaume Gomez-0/+2
2021-02-28Add test for rustdoc new check passGuillaume Gomez-0/+13
2021-02-27Rollup merge of #82563 - lucas-deangelis:issue-82209-fix, r=jyn514Dylan DPC-0/+11
Fix intra-doc handling of `Self` in enum Fixes #82209
2021-02-27Rollup merge of #81856 - Smittyvb:utf16-warn, r=matthewjasperDylan DPC-0/+0
Suggest character encoding is incorrect when encountering random null bytes This adds a note whenever null bytes are seen at the start of a token unexpectedly, since those tend to come from UTF-16 encoded files without a [BOM](https://en.wikipedia.org/wiki/Byte_order_mark) (if a UTF-16 BOM appears it won't be valid UTF-8, but if there is no BOM it be both valid UTF-16 and valid but garbled UTF-8). This approach was suggested in https://github.com/rust-lang/rust/issues/73979#issuecomment-653976451. Closes #73979.
2021-02-27Enable report_in_external_macro in unaligned_referencesTaiki Endo-0/+68
2021-02-27Recover from X<Y,Z> when parsing const exprÖmer Sinan Ağacan-3/+69
This adds recovery when in array type syntax user writes [X; Y<Z, ...>] instead of [X; Y::<Z, ...>] Fixes #82566 Note that whenever we parse an expression and know that the next token cannot be `,`, we should be calling check_mistyped_turbofish_with_multiple_type_params for this recovery. Previously we only did this for statement parsing (e.g. `let x = f<a, b>;`). We now also do it when parsing the length field in array type syntax.
2021-02-27Fix turbofish recovery with multiple generic argsÖmer Sinan Ağacan-0/+56
check_mistyped_turbofish_with_multiple_type_params was previously expecting type arguments between angle brackets, which is not right, as we can also see const expressions. We now use generic argument parser instead of type parser. Test with one, two, and three generic arguments added to check consistentcy between 1. check_no_chained_comparison: Called after parsing a nested binop application like `x < A > ...` where angle brackets are interpreted as binary operators and `A` is an expression. 2. check_mistyped_turbofish_with_multiple_type_params: called by `parse_full_stmt` when we expect to see a semicolon after parsing an expression but don't see it. (In `T2<1, 2>::C;`, the expression is `T2 < 1`)
2021-02-27Rollup merge of #82494 - estebank:issue-82455, r=petrochenkovDylan DPC-2/+32
Substitute erased lifetimes on bad placeholder type Fix #82455.
2021-02-27Rollup merge of #82442 - Aaron1011:fix/closure-mut-crash, r=matthewjasperDylan DPC-0/+40
Skip emitting closure diagnostic when closure_kind_origins has no entry Fixes #82438 This map is not guarnateed to have an entry for a closure.
2021-02-27Rollup merge of #82419 - petrochenkov:inertord, r=Aaron1011Dylan DPC-38/+112
expand: Preserve order of inert attributes during expansion Fixes https://github.com/rust-lang/rust/issues/67839 Fixes https://github.com/rust-lang/rust/issues/81871 r? `````@Aaron1011`````
2021-02-27Rollup merge of #82404 - nagisa:nagisa/hexagon-enums-llvm-comps, r=petrochenkovDylan DPC-5/+6
Test hexagon-enum only when llvm target is present See https://github.com/rust-lang/rust/pull/82379#issuecomment-783439754 r? ``````@petrochenkov`````` ``````@bors`````` rollup
2021-02-27Rollup merge of #82370 - ↵Dylan DPC-103/+88
0yoyoyo:update-issue-81650-point-anonymous-lifetime, r=estebank Improve anonymous lifetime note to indicate the target span Improvement for #81650 Cc #81995 Message after this improvement: (Improve note in the middle) ``` error[E0311]: the parameter type `T` may not live long enough --> src/main.rs:25:11 | 24 | fn play_with<T: Animal + Send>(scope: &Scope, animal: T) { | -- help: consider adding an explicit lifetime bound...: `T: 'a +` 25 | scope.spawn(move |_| { | ^^^^^ | note: the parameter type `T` must be valid for the anonymous lifetime defined on the function body at 24:40... --> src/main.rs:24:40 | 24 | fn play_with<T: Animal + Send>(scope: &Scope, animal: T) { | ^^^^^ note: ...so that the type `[closure@src/main.rs:25:17: 27:6]` will meet its required lifetime bounds --> src/main.rs:25:11 | 25 | scope.spawn(move |_| { | ^^^^^ ``` r? ``````@estebank``````
2021-02-27Move test file, add test of generated linkLucas De Angelis-0/+3
2021-02-26Fix intra-doc handling of `Self` in enumLucas De Angelis-0/+8
Fixes #82209
2021-02-26Auto merge of #82552 - GuillaumeGomez:rollup-8dn1ztn, r=GuillaumeGomezbors-20/+84
Rollup of 8 pull requests Successful merges: - #81940 (Stabilize str_split_once) - #82165 (Reword labels on E0308 involving async fn return type) - #82456 (Replaced some unwrap_or and map_or with lazy variants) - #82491 (Consider inexpensive inlining criteria first) - #82506 (Properly account for non-shorthand pattern field in unused variable lint) - #82535 (Set codegen thread names) - #82545 (rustdoc: add optional woff2 versions of FiraSans.) - #82549 (Revert "Update normalize.css to 8.0.1") Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-02-26Rollup merge of #82506 - estebank:unused_variable_lint, r=lcnrGuillaume Gomez-0/+46
Properly account for non-shorthand pattern field in unused variable lint Fix #82488
2021-02-26Rollup merge of #82165 - nellshamrell:nell/fix-80658-B, r=estebankGuillaume Gomez-20/+38
Reword labels on E0308 involving async fn return type Fix for #80658. When someone writes code like this: ```rust fn foo() -> u8 { async fn async_fn() -> () {} async_fn() } ``` And they try to compile it, they will see an error that looks like this: ```bash error[E0308]: mismatched types --> test.rs:4:5 | 1 | fn foo() -> u8 { | -- expected `u8` because of return type 2 | async fn async_fn() -> () {} | -- checked the `Output` of this `async fn`, found opaque type 3 | 4 | async_fn() | ^^^^^^^^^^ expected `u8`, found opaque type | = note: while checking the return type of this `async fn` = note: expected type `u8` found opaque type `impl Future` ```
2021-02-26Auto merge of #81458 - estebank:match-stmt-remove-semi, r=oli-obkbors-0/+81
Detect match statement intended to be tail expression CC #24157
2021-02-25Rollup merge of #82431 - Aaron1011:fix/bug-env, r=jyn514Aaron Hill-2/+4
Set RUST_BACKTRACE=0 when running `treat-err-as-bug` tests These ensure that these tests pass regardless of what RUST_BACKTRACE is set to in the user's shell.
2021-02-25Auto merge of #82447 - Amanieu:legacy_const_generics, r=oli-obkbors-0/+185
Add #[rustc_legacy_const_generics] This is the first step towards removing `#[rustc_args_required_const]`: a new attribute is added which rewrites function calls of the form `func(a, b, c)` to `func::<{b}>(a, c)`. This allows previously stabilized functions in `stdarch` which use `rustc_args_required_const` to use const generics instead. This new attribute is not intended to ever be stabilized, it is only intended for use in `stdarch` as a replacement for `#[rustc_args_required_const]`. ```rust #[rustc_legacy_const_generics(1)] pub fn foo<const Y: usize>(x: usize, z: usize) -> [usize; 3] { [x, Y, z] } fn main() { assert_eq!(foo(0 + 0, 1 + 1, 2 + 2), [0, 2, 4]); assert_eq!(foo::<{1 + 1}>(0 + 0, 2 + 2), [0, 2, 4]); } ``` r? `@oli-obk`
2021-02-25Detect match statement intended to be tail expressionEsteban Küber-0/+81
CC #24157
2021-02-25Rollup merge of #82364 - osa1:issue82361, r=estebankDylan DPC-0/+96
Improve error msgs when found type is deref of expected This improves help messages in two cases: - When expected type is `T` and found type is `&T`, we now look through blocks and suggest dereferencing the expression of the block, rather than the whole block. - In the above case, if the expression is an `&`, we not suggest removing the `&` instead of adding `*`. Both of these are demonstrated in the regression test. Before this patch the first error in the test would be: error[E0308]: `if` and `else` have incompatible types --> test.rs:8:9 | 5 | / if true { 6 | | a | | - expected because of this 7 | | } else { 8 | | b | | ^ expected `usize`, found `&usize` 9 | | }; | |_____- `if` and `else` have incompatible types | help: consider dereferencing the borrow | 7 | } else *{ 8 | b 9 | }; | Now: error[E0308]: `if` and `else` have incompatible types --> test.rs:8:9 | 5 | / if true { 6 | | a | | - expected because of this 7 | | } else { 8 | | b | | ^ | | | | | expected `usize`, found `&usize` | | help: consider dereferencing the borrow: `*b` 9 | | }; | |_____- `if` and `else` have incompatible types The second error: error[E0308]: `if` and `else` have incompatible types --> test.rs:14:9 | 11 | / if true { 12 | | 1 | | - expected because of this 13 | | } else { 14 | | &1 | | ^^ expected integer, found `&{integer}` 15 | | }; | |_____- `if` and `else` have incompatible types | help: consider dereferencing the borrow | 13 | } else *{ 14 | &1 15 | }; | now: error[E0308]: `if` and `else` have incompatible types --> test.rs:14:9 | 11 | / if true { 12 | | 1 | | - expected because of this 13 | | } else { 14 | | &1 | | ^- | | || | | |help: consider removing the `&`: `1` | | expected integer, found `&{integer}` 15 | | }; | |_____- `if` and `else` have incompatible types Fixes #82361 --- r? ````@estebank````
2021-02-25Rollup merge of #82220 - henryboisdequin:fixes-80853, r=varkorDylan DPC-7/+46
fix the false 'defined here' messages Closes #80853. Take this code: ```rust struct S; fn repro_ref(thing: S) { thing(); } ``` Previously, the error message would be this: ``` error[E0618]: expected function, found `S` --> src/lib.rs:4:5 | 3 | fn repro_ref(thing: S) { | ----- `S` defined here 4 | thing(); | ^^^^^-- | | | call expression requires function error: aborting due to previous error ``` This is incorrect as `S` is not defined in the function arguments, `thing` is defined there. With this change, the following is emitted: ``` error[E0618]: expected function, found `S` --> $DIR/80853.rs:4:5 | LL | fn repro_ref(thing: S) { | ----- is of type `S` LL | thing(); | ^^^^^-- | | | call expression requires function | = note: local variable `S` is not a function error: aborting due to previous error ``` As you can see, this error message points out that `thing` is of type `S` and later in a note, that `S` is not a function. This change does seem like a downside for some error messages. Take this example: ``` LL | struct Empty2; | -------------- is of type `Empty2` ``` As you can see, the error message shows that the definition of `Empty2` is of type `Empty2`. Although this isn't wrong, it would be more helpful if it would say something like this (which was there previously): ``` LL | struct Empty2; | -------------- `Empty2` defined here ``` If there is a better way of doing this, where the `Empty2` example would stay the same as without this change, please inform me. **Update: This is now fixed** CC `@camelid`
2021-02-25Rollup merge of #82090 - notriddle:consider-using-a-semicolon-here, r=estebankDylan DPC-0/+71
Do not consider using a semicolon inside of a different-crate macro Fixes #81943
2021-02-25Rollup merge of #82087 - estebank:abolish-ice, r=oli-obkDylan DPC-0/+25
Fix ICE caused by suggestion with no code substitutions Change suggestion logic to filter and checking _before_ creating specific resolution suggestion. Assert earlier that suggestions contain code substitions to make it easier in the future to debug invalid uses. If we find this becomes too noisy in the wild, we can always make the emitter resilient to these cases and remove the assertions. Fix #78651.
2021-02-25Rollup merge of #81713 - estebank:unstable-assoc-item-lint, r=oli-obkDylan DPC-7/+28
Account for associated consts in the "unstable assoc item name colission" lint Fix #81663.
2021-02-25Add feature gate for inherent associate types.Olivier FAURE-18/+71
2021-02-25Update test/pretty output for edition preludes.Mara Bos-6/+6
2021-02-25Update test output for edition preludes.Mara Bos-11/+11
2021-02-25add helpful error notes and fix the false 'defined here' messagesHenry Boisdequin-7/+46
2021-02-25Improve checking for attributeAmanieu d'Antras-16/+29
2021-02-24clarifies error when finding mismatched returned types for async functionsNell Shamrell-20/+38
Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
2021-02-24Properly account for non-shorthand pattern field in unused variable lintEsteban Küber-0/+46
Fix #82488
2021-02-25Fix testsAmanieu d'Antras-4/+12
2021-02-25Address review commentsAmanieu d'Antras-0/+3
2021-02-24Account for associated consts in the "unstable assoc item name colission" lintEsteban Küber-7/+28
Fix #81663.
2021-02-24Auto merge of #82159 - BoxyUwU:uwu, r=varkorbors-0/+47
Use correct param_env in conservative_is_privately_uninhabited cc `@lcnr` r? `@varkor` since this is your FIXME that was removed ^^
2021-02-24Substitute erased lifetimes on bad placeholder typeEsteban Küber-2/+32
Fix #82455.
2021-02-24Auto merge of #80914 - GuillaumeGomez:remove-is_spotlight, r=jyn514bors-0/+24
Remove is_spotlight field from `Trait` Small PR, only the last commit is relevant here. The rest is coming from #80883 because I need the `TyCtxt` stored inside `Cache`. The point is to make ItemKind looks as close as possible to the compiler type so that it makes the switch simpler (which is why I make all these "small" PRs). r? `@jyn514`
2021-02-24Auto merge of #80475 - simonvandel:fix-77355, r=oli-obkbors-355/+482
New mir-opt pass to simplify gotos with const values (reopening #77486) Reopening PR #77486 Fixes #77355 This pass optimizes the following sequence ```rust bb2: { _2 = const true; goto -> bb3; } bb3: { switchInt(_2) -> [false: bb4, otherwise: bb5]; } ``` into ```rust bb2: { _2 = const true; goto -> bb5; } ```
2021-02-24Add suggestion for iterators in iteratorsKevin Per-0/+32
2021-02-24Properly reject non-const argumentsAmanieu d'Antras-0/+36
2021-02-24TODO -> FIXMEAmanieu d'Antras-1/+1
2021-02-23yeetEllen-0/+47
2021-02-23* Fix some typoGuillaume Gomez-0/+24
* Improve documentation * Add a test to ensure that spotlighted traits from dependencies are taken into account as expected
2021-02-23Do not consider using a semicolon inside of a different-crate macroMichael Howell-0/+71
Fixes #81943