about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2021-03-30Rollup merge of #83667 - estebank:cool-bears-hot-tip, r=lcnrDylan DPC-91/+79
Suggest box/pin/arc ing receiver on method calls _Extracted from https://fasterthanli.me/articles/pin-and-suffering_
2021-03-30Rollup merge of #83656 - JohnTitor:resolve-test, r=petrochenkovDylan DPC-0/+34
Add a regression test for issue-82865 Closes #82865 r? `@petrochenkov`
2021-03-29Hide unnecessary reference to traitEsteban Küber-3/+0
When the problem for a method not being found in its receiver is due to arbitrary self-types, we don't want to mention importing or implementing the trait, instead we suggest wrapping.
2021-03-29Suggest box/pin/arc ing receiver on method callsEsteban Küber-91/+82
2021-03-30Add a regression test for issue-82865JohnTitor-0/+34
2021-03-29Prefer 4 spacesJohnTitor-52/+52
2021-03-29Add a regression test for issue-82792JohnTitor-0/+14
2021-03-29Auto merge of #83605 - RalfJung:unaligned, r=petrochenkovbors-23/+63
unaligned_references: align(N) fields in packed(N) structs are fine This removes some false positives from the unaligned_references lint: in a `repr(packed(2))` struct, fields of alignment 2 (and less) are guaranteed to be properly aligned, so we do not have to consider them "disaligned".
2021-03-28adjust old testRalf Jung-16/+31
2021-03-28unaligned_references: align(N) fields in packed(N) structs are fineRalf Jung-7/+32
2021-03-28Remove unnecessary `ignore-cloudabi` flagJohnTitor-1/+0
2021-03-27Auto merge of #83103 - petrochenkov:unilex, r=Aaron1011bors-4/+8
resolve: Partially unify early and late scope-relative identifier resolution Reuse `early_resolve_ident_in_lexical_scope` instead of a chunk of code in `resolve_ident_in_lexical_scope` doing the same job. `early_resolve_ident_in_lexical_scope`/`visit_scopes` had to be slightly extended to be able to 1) start from a specific module instead of the current parent scope and 2) report one deprecation lint. `early_resolve_ident_in_lexical_scope` still doesn't support walking through "ribs", that part is left in `resolve_ident_in_lexical_scope` (moreover, I'm pretty sure it's buggy, but that's a separate issue, cc https://github.com/rust-lang/rust/issues/52389 at least).
2021-03-27resolve: Partially unify early and late scope-relative ident resolutionVadim Petrochenkov-4/+8
2021-03-27Rollup merge of #83548 - Aaron1011:capture-none-delims, r=petrochenkovDylan DPC-13/+58
Always preserve `None`-delimited groups in a captured `TokenStream` Previously, we would silently remove any `None`-delimiters when capturing a `TokenStream`, 'flattenting' them to their inner tokens. This was not normally visible, since we usually have `TokenKind::Interpolated` (which gets converted to a `None`-delimited group during macro invocation) instead of an actual `None`-delimited group. However, there are a couple of cases where this becomes visible to proc-macros: 1. A cross-crate `macro_rules!` macro has a `None`-delimited group stored in its body (as a result of being produced by another `macro_rules!` macro). The cross-crate `macro_rules!` invocation can then expand to an attribute macro invocation, which needs to be able to see the `None`-delimited group. 2. A proc-macro can invoke an attribute proc-macro with its re-collected input. If there are any nonterminals present in the input, they will get re-collected to `None`-delimited groups, which will then get captured as part of the attribute macro invocation. Both of these cases are incredibly obscure, so there hopefully won't be any breakage. This change will allow more agressive 'flattenting' of nonterminals in #82608 without losing `None`-delimited groups.
2021-03-27Rollup merge of #82626 - lcnr:encode_with_shorthandb, r=estebankDylan DPC-23/+28
update array missing `IntoIterator` msg fixes #82602 r? ```@estebank``` do you know whether we can use the expr span in `rustc_on_unimplemented`? The label isn't too great rn
2021-03-27Rollup merge of #82525 - RalfJung:unaligned-ref-warn, r=petrochenkovDylan DPC-212/+160
make unaligned_references future-incompat lint warn-by-default and also remove the safe_packed_borrows lint that it replaces. `std::ptr::addr_of!` has hit beta now and will hit stable in a month, so I propose we start fixing https://github.com/rust-lang/rust/issues/27060 for real: creating a reference to a field of a packed struct needs to eventually become a hard error; this PR makes it a warn-by-default future-incompat lint. (The lint already existed, this just raises its default level.) At the same time I removed the corresponding code from unsafety checking; really there's no reason an `unsafe` block should make any difference here. For references to packed fields outside `unsafe` blocks, this means `unaligned_refereces` replaces the previous `safe_packed_borrows` warning with a link to https://github.com/rust-lang/rust/issues/82523 (and no more talk about unsafe blocks making any difference). So behavior barely changes, the warning is just worded differently. For references to packed fields inside `unsafe` blocks, this PR shows a new future-incompat warning. Closes https://github.com/rust-lang/rust/issues/46043 because that lint no longer exists.
2021-03-27Rollup merge of #81351 - lcnr:big-money-big-prices, r=oli-obkDylan DPC-9/+85
combine: stop eagerly evaluating consts `super_relate_consts` eagerly evaluates constants which doesn't seem too great. I now also finally understand why all of the unused substs test passed. The reason being that we just evaluated the constants in `super_relate_consts` :laughing: While this change isn't strictly necessary as evaluating consts here doesn't hurt, it still feels a lot cleaner to do it this way r? `@oli-obk` `@nikomatsakis`
2021-03-28Rollup merge of #83569 - sjakobi:issue56445-regression-test, r=jackh726Yuki Okushi-3/+48
Add regression tests for #56445 Closes #56445.
2021-03-28Rollup merge of #83348 - osa1:issue83344, r=jackh726Yuki Okushi-0/+14
format macro argument parsing fix When the character next to `{}` is "shifted" (when mapping a byte index in the format string to span) we should avoid shifting the span end index, so first map the index of `}` to span, then bump the span, instead of first mapping the next byte index to a span (which causes bumping the end span too much). Regression test added. Fixes #83344 --- r? ```@estebank```
2021-03-27make unaligned_refereces future-incompat lint warn-by-default, and remove ↵Ralf Jung-212/+160
the safe_packed_borrows lint that it replaces
2021-03-27update testslcnr-8/+8
2021-03-27combine: stop eagerly evaluating constsBastian Kauschke-9/+85
2021-03-27Add regression tests for #56445Simon Jakobi-3/+48
Closes #56445.
2021-03-27format macro argument parsing fixÖmer Sinan Ağacan-0/+14
When the character next to `{}` is "shifted" (when mapping a byte index in the format string to span) we should avoid shifting the span end index, so first map the index of `}` to span, then bump the span, instead of first mapping the next byte index to a span (which causes bumping the end span too much). Regression test added. Fixes #83344
2021-03-27Rollup merge of #83343 - osa1:issue83340, r=jackh726Yuki Okushi-0/+16
Simplify and fix byte skipping in format! string parser Fixes '\\' handling in format strings. Fixes #83340
2021-03-27Rollup merge of #83328 - tmiasko:asm-test, r=joshtriplettYuki Okushi-2/+2
Fixes to inline assmebly tests * Join test thread to make assertion effective in sym.rs test case * Use a single codegen unit to reduce non-determinism in srcloc.rs test #82886
2021-03-26Always preserve `None`-delimited groups in a captured `TokenStream`Aaron Hill-13/+58
Previously, we would silently remove any `None`-delimiters when capturing a `TokenStream`, 'flattenting' them to their inner tokens. This was not normally visible, since we usually have `TokenKind::Interpolated` (which gets converted to a `None`-delimited group during macro invocation) instead of an actual `None`-delimited group. However, there are a couple of cases where this becomes visible to proc-macros: 1. A cross-crate `macro_rules!` macro has a `None`-delimited group stored in its body (as a result of being produced by another `macro_rules!` macro). The cross-crate `macro_rules!` invocation can then expand to an attribute macro invocation, which needs to be able to see the `None`-delimited group. 2. A proc-macro can invoke an attribute proc-macro with its re-collected input. If there are any nonterminals present in the input, they will get re-collected to `None`-delimited groups, which will then get captured as part of the attribute macro invocation. Both of these cases are incredibly obscure, so there hopefully won't be any breakage. This change will allow more agressive 'flattenting' of nonterminals in #82608 without losing `None`-delimited groups.
2021-03-26fix rustc_on_implemented `_Self` pathslcnr-15/+20
2021-03-26update array missing `IntoIterator` msglcnr-18/+18
2021-03-26Auto merge of #83488 - Aaron1011:ban-expr-inner-attrs, r=petrochenkovbors-143/+212
Ban custom inner attributes in expressions and statements Split out from https://github.com/rust-lang/rust/pull/82608 Custom inner attributes are unstable, so this won't break any stable users. This allows us to speed up token collection, and avoid a redundant call to `collect_tokens_no_attrs` when parsing an `Expr` that has outer attributes. r? `@petrochenkov`
2021-03-26Update char::escape_debug_ext to handle different escapes in strings vs. charsÖmer Sinan Ağacan-2/+2
Fixes #83046 The program fn main() { println!("{:?}", '"'); println!("{:?}", "'"); } would previously print '\"' "\'" With this patch it now prints: '"' "'"
2021-03-26Rollup merge of #83486 - Aaron1011:fix/global-alloc-error, r=petrochenkovDylan DPC-0/+18
Don't ICE when using `#[global_alloc]` on a non-item statement Fixes #83469 We need to return an `Annotatable::Stmt` if we were passed an `Annotatable::Stmt`
2021-03-26Rollup merge of #83485 - Amanieu:asm_llvm10, r=joshtriplettDylan DPC-3/+3
Mark asm tests as requiring LLVM 10.0.1
2021-03-26Rollup merge of #83437 - Amanieu:asm_syntax, r=petrochenkovDylan DPC-46/+103
Refactor #82270 as lint instead of an error This PR fixes several issues with #82270 which generated an error when `.intel_syntax` or `.att_syntax` was used in inline assembly: - It is now a warn-by-default lint instead of an error. - The lint only triggers on x86. `.intel_syntax` and `.att_syntax` are only valid on x86. - The lint no longer provides machine-applicable suggestions for two reasons: - These changes should not be made automatically since changes to assembly code can be very subtle. - The template string is not always just a string: it can contain macro invocation (`concat!`), raw strings, escape characters, etc. cc ``@asquared31415``
2021-03-25Ban custom inner attributes in expressions and statementsAaron Hill-143/+212
2021-03-25Mark inline asm tests as requiring LLVM 10.0.1Amanieu d'Antras-3/+3
2021-03-25Don't ICE when using `#[global_alloc]` on a non-item statementAaron Hill-0/+18
Fixes #83469 We need to return an `Annotatable::Stmt` if we were passed an `Annotatable::Stmt`
2021-03-25Auto merge of #82743 - jackh726:resolve-refactor, r=nikomatsakisbors-432/+230
Refactor rustc_resolve::late::lifetimes to resolve per-item There are some changes to tests that I'd like some feedback on; so this is still WIP. The reason behind this change will (hopefully) allow us to (as part of #76814) be able to essentially use the lifetime resolve code to resolve *all* late bound vars (including those of super traits). Currently, it only resolves those that are *syntactically* in scope. In #76814, I'm essentially finding that I would essentially have to redo the passing of bound vars through scopes (i.e. when instantiating a poly trait ref), and that's what this code does anyways. However, to be able to do this (ask super traits what bound vars are in scope), we have to be able to resolve items separately. The first commit is actually partially orthogonal. Essentially removing one use of late bound debruijn indices. Not exactly sure who would be best to review here. Let r? `@nikomatsakis`
2021-03-25Bless nll testJack Huey-84/+3
2021-03-25Refactor #82270 as lint instead of an errorAmanieu d'Antras-46/+103
2021-03-25Auto merge of #83387 - cuviper:min-llvm-10, r=nagisabors-1/+0
Update the minimum external LLVM to 10 r? `@nikic`
2021-03-25Rollup merge of #83349 - m-ou-se:unwrap-none, r=dtolnayYuki Okushi-5/+0
Remove Option::{unwrap_none, expect_none}. This removes `Option::unwrap_none` and `Option::expect_none` since we're not going to stabilize them, see https://github.com/rust-lang/rust/issues/62633. Closes #62633
2021-03-24resolve late lifetimes by itemJack Huey-348/+227
This reverts commit 22ae20733515d710c1134600bc1e29cdd76f6b9b.
2021-03-24Auto merge of #83364 - sexxi-goose:fix-83176, r=nikomatsakisbors-0/+25
2229 migration: Don't try resolve regions before writeback In the analysis use `resolve_vars_if_possible` instead of `fully_resolve`, because we might not have performed regionck yet. Fixes: #83176 r? `@nikomatsakis`
2021-03-24Auto merge of #83050 - osa1:issue83048, r=matthewjasperbors-0/+14
Run analyses before thir-tree dumps Fixes #83048
2021-03-24Auto merge of #75384 - JulianKnodt:cg_def, r=varkor,lcnrbors-42/+276
implement `feature(const_generics_defaults)` Implements const generics defaults `struct Example<const N: usize=3>`, as well as a query for getting the default of a given const-parameter's def id. There are some remaining FIXME's but they were specified as not blocking for merging this PR. This also puts the defaults behind the unstable feature gate `#![feature(const_generics_defaults)]`. ~~This currently creates a field which is always false on `GenericParamDefKind` for future use when consts are permitted to have defaults. I'm not sure if this is exactly what is best for adding default parameters, but I mimicked the style of type defaults, so hopefully this is ok.~~ r? `@lcnr`
2021-03-24Rollup merge of #83313 - cjgillot:assert, r=michaelwoeristerDylan DPC-0/+46
Only enable assert_dep_graph when query-dep-graph is enabled. This is a debugging option. The only effect should be on rustc tests. r? ``@michaelwoerister``
2021-03-23Update to not have extra matchkadmin-0/+75
2021-03-23Update with commentskadmin-3/+33
2021-03-23Update with commentskadmin-0/+53
A bunch of nits fixed, and a new test for pretty printing the AST.