about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-03-14Bless incremental test.Camille GILLOT-2/+2
2023-03-14ICE when checking LocalInfo on runtime MIR.Camille GILLOT-4/+4
2023-03-14Wrap the whole LocalInfo in ClearCrossCrate.Camille GILLOT-6/+2
2023-03-14Auto merge of #106505 - Nilstrieb:format-args-string-literal-episode-2, ↵bors-19/+144
r=petrochenkov Properly allow macro expanded `format_args` invocations to uses captures Originally, this was kinda half-allowed. There were some primitive checks in place that looked at the span to see whether the input was likely a literal. These "source literal" checks are needed because the spans created during `format_args` parsing only make sense when it is indeed a literal that was written in the source code directly. This is orthogonal to the restriction that the first argument must be a "direct literal", not being exanpanded from macros. This restriction was imposed by [RFC 2795] on the basis of being too confusing. But this was only concerned with the argument of the invocation being a literal, not whether it was a source literal (maybe in spirit it meant it being a source literal, this is not clear to me). Since the original check only really cared about source literals (which is good enough to deny the `format_args!(concat!())` example), macros expanding to `format_args` invocations were able to use implicit captures if they spanned the string in a way that lead back to a source string. The "source literal" checks were not strict enough and caused ICEs in certain cases (see #106191). So I tightened it up in #106195 to really only work if it's a direct source literal. This caused the `indoc` crate to break. `indoc` transformed the source literal by removing whitespace, which made it not a "source literal" anymore (which is required to fix the ICE). But since `indoc` spanned the literal in ways that made the old check think that it's a literal, it was able to use implicit captures (which is useful and nice for the users of `indoc`). This commit properly seperates the previously introduced concepts of "source literal" and "direct literal" and therefore allows `indoc` invocations, which don't create "source literals" to use implicit captures again. Fixes #106191 [RFC 2795]: https://rust-lang.github.io/rfcs/2795-format-args-implicit-identifiers.html#macro-hygiene
2023-03-14Properly allow macro expanded `format_args` invocations to uses capturesNilstrieb-19/+144
Originally, this was kinda half-allowed. There were some primitive checks in place that looked at the span to see whether the input was likely a literal. These "source literal" checks are needed because the spans created during `format_args` parsing only make sense when it is indeed a literal that was written in the source code directly. This is orthogonal to the restriction that the first argument must be a "direct literal", not being exanpanded from macros. This restriction was imposed by [RFC 2795] on the basis of being too confusing. But this was only concerned with the argument of the invocation being a literal, not whether it was a source literal (maybe in spirit it meant it being a source literal, this is not clear to me). Since the original check only really cared about source literals (which is good enough to deny the `format_args!(concat!())` example), macros expanding to `format_args` invocations were able to use implicit captures if they spanned the string in a way that lead back to a source string. The "source literal" checks were not strict enough and caused ICEs in certain cases (see # 106191 (the space is intended to avoid spammy backreferences)). So I tightened it up in # 106195 to really only work if it's a direct source literal. This caused the `indoc` crate to break. `indoc` transformed the source literal by removing whitespace, which made it not a "source literal" anymore (which is required to fix the ICE). But since `indoc` spanned the literal in ways that made the old check think that it's a literal, it was able to use implicit captures (which is useful and nice for the users of `indoc`). This commit properly seperates the previously introduced concepts of "source literal" and "direct literal" and therefore allows `indoc` invocations, which don't create "source literals" to use implicit captures again. [RFC 2795]: https://rust-lang.github.io/rfcs/2795-format-args-implicit-identifiers.html#macro-hygiene
2023-03-14Auto merge of #104833 - Swatinem:async-identity-future, r=compiler-errorsbors-273/+109
Remove `identity_future` indirection This was previously needed because the indirection used to hide some unexplained lifetime errors, which it turned out were related to the `min_choice` algorithm. Removing the indirection also solves a couple of cycle errors, large moves and makes async blocks support the `#[track_caller]`annotation. Fixes https://github.com/rust-lang/rust/issues/104826.
2023-03-14Auto merge of #108992 - petrochenkov:qcstore2, r=cjgillotbors-4/+4
resolve: Querify most cstore access methods (subset) A subset of https://github.com/rust-lang/rust/pull/108346 that is not on a hot path in any way.
2023-03-13Rollup merge of #109088 - Nilstrieb:target-feature-on-statics-when, ↵Matthias Krüger-16/+114
r=compiler-errors Gracefully handle `#[target_feature]` on statics The was careful around not calling `fn_sig` on not-functions but well, it wasn't careful enough. This commit makes it a little more careful and also adds tests for a bunch more item kinds. I was sadly not able to fully bless the test locally because I'm on an aarch64 machine but I hope some manual editing made it work 😅 Fix #109079
2023-03-13Rollup merge of #109081 - krasimirgg:llvm-17-simd-wide-sum, r=nikicMatthias Krüger-1/+1
simd-wide-sum test: adapt for LLVM 17 codegen change After https://github.com/llvm/llvm-project/commit/0d4a709bb876824a0afa5f86e138e8ffdcaf7661 LLVM becomes more clever and turns ```@wider_reduce_loop``` into an alias: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/17806#0186da6b-582c-46bf-a227-1565fa0859ac/743-766 This adapts the test to prevent this.
2023-03-13Rollup merge of #108830 - compiler-errors:new-solver-fast-reject-faster, r=lcnrMatthias Krüger-0/+67
Treat projections with infer as placeholder during fast reject in new solver r? ``@lcnr`` Kind of a shame that we need to change all of the call sites for `for_each_relevant_impl`, etc. to pass an extra parameter. I guess I could have the "default" fn which calls a configurable fn?
2023-03-13Gracefully handle `#[target_feature]` on staticsNilstrieb-16/+114
The was careful around not calling `fn_sig` on not-functions but well, it wasn't careful enough. This commit makes it a little more careful and also adds tests for a bunch more item kinds.
2023-03-13Add a test that used to take forever to compileMichael Goulet-0/+43
2023-03-13Treat projections with infer as placeholder during fast reject in new solverMichael Goulet-0/+24
2023-03-13simd-wide-sum test: adapt for LLVM 17 codegen changeKrasimir Georgiev-1/+1
After https://github.com/llvm/llvm-project/commit/0d4a709bb876824a0afa5f86e138e8ffdcaf7661 LLVM becomes more clever and turns `@wider_reduce_loop` into an alias: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/17806#0186da6b-582c-46bf-a227-1565fa0859ac/743-766 This adapts the test to prevent this.
2023-03-13Auto merge of #108623 - scottmcm:try-different-as-slice-impl, r=the8472bors-5/+13
Move `Option::as_slice` to an always-sound implementation This approach depends on CSE to not have any branches or selects when the guessed offset is correct -- which it always will be right now -- but to also be *sound* (just less efficient) if the layout algorithms change such that the guess is incorrect. The codegen test confirms that CSE handles this as expected, leaving the optimal codegen. cc JakobDegen #108545
2023-03-13resolve: Remove `struct_field_names_untracked`Vadim Petrochenkov-4/+4
2023-03-13Auto merge of #108471 - clubby789:unbox-the-syntax, r=Nilstrieb,est31bors-786/+806
Remove `box_syntax` r? `@Nilstrieb` This removes the feature `box_syntax`, which allows the use of `box <expr>` to create a Box, and finalises removing use of the feature from the compiler. `box_patterns` (allowing the use of `box <pat>` in a pattern) is unaffected. It also removes `ast::ExprKind::Box` - the only way to create a 'box' expression now is with the rustc-internal `#[rustc_box]` attribute. As a temporary measure to help users move away, `box <expr>` now parses the inner expression, and emits a `MachineApplicable` lint to replace it with `Box::new` Closes #49733
2023-03-12Auto merge of #108872 - cjgillot:simp-const-prop, r=oli-obkbors-15/+17
Strengthen state tracking in const-prop Some/many of the changes are replicated between both the const-prop lint and the const-prop optimization. Behaviour changes: - const-prop opt does not give a span to propagated values. This was useless as that span's primary purpose is to diagnose evaluation failure in codegen. - we remove the `OnlyPropagateInto` mode. It was only used for function arguments, which are better modeled by a write before entry. - the tracking of assignments and discriminants make clearer that we do nothing in `NoPropagation` mode or on indirect places.
2023-03-12Rollup merge of #109029 - compiler-errors:parse-gating, r=jackh726Matthias Krüger-12/+49
Gate usages of `dyn*` and const closures in macros We silently accepted `dyn*` and const closures in macros as long as they didn't expand to anything containing these experimental features, unlike other gated features such as `for<'a>` binders on closures, etc. Let's not do that, to make sure nobody begins relying on this.
2023-03-12Rollup merge of #109009 - notriddle:notriddle/edit-distance, r=GuillaumeGomezMatthias Krüger-0/+12
rustdoc: use restricted Damerau-Levenshtein distance for search Based on https://github.com/rust-lang/rust/pull/108200, for the same rationale. > This replaces the existing Levenshtein algorithm with the Damerau-Levenshtein algorithm. This means that "ab" to "ba" is one change (a transposition) instead of two (a deletion and insertion). More specifically, this is a restricted implementation, in that "ca" to "abc" cannot be performed as "ca" → "ac" → "abc", as there is an insertion in the middle of a transposition. I believe that errors like that are sufficiently rare that it's not worth taking into account. Before this change, searching [`prinltn!`] listed `print!` first, followed by `println!`. With this change, `println!` matches more closely. [`prinltn!`]: https://doc.rust-lang.org/nightly/std/?search=prinltn!
2023-03-12Forbid the use of `#[target_feature]` on `start`Léo Lanteri Thauvin-0/+20
2023-03-12Forbid the use of `#[target_feature]` on `main`Léo Lanteri Thauvin-1/+18
2023-03-12Add recovery for use of removed `box` syntaxclubby789-10/+77
2023-03-12Remove `box_syntax` from AST and use in toolsclubby789-44/+18
2023-03-12Remove uses of `box_syntax` in rustc and toolsclubby789-742/+721
2023-03-12Rollup merge of #109034 - compiler-errors:lazy-norm-tests, r=jackh726Matthias Krüger-0/+172
Commit some tests for the new solver + lazy norm Also consolidate `typeck/lazy-norm` into `traits/new-solver`, since it's not really useful to maintain a distinction, like when a test really is due to "lazy norm" or "the new solver" (usually both!)
2023-03-12Rollup merge of #108841 - jackh726:issue-90528, r=compiler-errorsMatthias Krüger-0/+400
Add suggestion to diagnostic when user has array but trait wants slice. (rebased) Rebase of #91314, except for change to multipart suggestion Resolves #90528 r? ``@compiler-errors`` since you requested the multipart suggestion
2023-03-11Move `Option::as_slice` to an always-sound implementationScott McMurray-5/+13
This approach depends on CSE to not have any branches or selects when the guessed offset is correct -- which it always will be right now -- but to also be *sound* (just less efficient) if the layout algorithms change such that the guess is incorrect.
2023-03-12Auto merge of #108700 - spastorino:new-rpitit-impl-side-2, r=compiler-errorsbors-0/+17
Make RPITITs simple cases work when using lower_impl_trait_in_trait_to_assoc_ty r? `@compiler-errors` It's probably best reviewed commit by commit.
2023-03-11Commit some tests for the new solver + lazy normMichael Goulet-0/+172
2023-03-11Gate const closures even when they appear in macrosMichael Goulet-3/+20
2023-03-11Gate all usages of dyn*, even in macrosMichael Goulet-9/+29
2023-03-11Auto merge of #109019 - matthiaskrgr:rollup-ihjntil, r=matthiaskrgrbors-25/+99
Rollup of 9 pull requests Successful merges: - #104363 (Make `unused_allocation` lint against `Box::new` too) - #106633 (Stabilize `nonzero_min_max`) - #106844 (allow negative numeric literals in `concat!`) - #108071 (Implement goal caching with the new solver) - #108542 (Force parentheses around `match` expression in binary expression) - #108690 (Place size limits on query keys and values) - #108708 (Prevent overflow through Arc::downgrade) - #108739 (Prevent the `start_bx` basic block in codegen from having two `Builder`s at the same time) - #108806 (Querify register_tools and post-expansion early lints) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-11Rollup merge of #108542 - bwmf2:expanded, r=wesleywiserMatthias Krüger-1/+25
Force parentheses around `match` expression in binary expression This attempts to solve https://github.com/rust-lang/rust/issues/98790.
2023-03-11Rollup merge of #106844 - Ezrashaw:concat-negative-int-lit, r=dtolnayMatthias Krüger-3/+31
allow negative numeric literals in `concat!` Fixes #106837 While *technically* negative numeric literals are implemented as unary operations, users can reasonably expect that negative literals are treated the same as positive literals.
2023-03-11Rollup merge of #104363 - WaffleLapkin:bonk_box_new, r=NilstriebMatthias Krüger-21/+43
Make `unused_allocation` lint against `Box::new` too Previously it only linted against `box` syntax, which likely won't ever be stabilized, which is pretty useless. Even now I'm not sure if it's a meaningful lint, but it's at least something :shrug: This means that code like the following will be linted against: ```rust Box::new([1, 2, 3]).len(); f(&Box::new(1)); // where f : &i32 -> () ``` The lint works by checking if a `Box::new` (or `box`) expression has an a borrow adjustment, meaning that the code that first stores the box in a variable won't be linted against: ```rust let boxed = Box::new([1, 2, 3]); // no lint boxed.len(); ```
2023-03-11Rollup merge of #108988 - adrianheine:crate-reference-block, r=petrochenkovMatthias Krüger-0/+5
rustdoc: Don't crash on `crate` references in blocks This is a regression from #94857.
2023-03-11Rollup merge of #108949 - Urgau:check-cfg-target-json, r=oli-obkMatthias Krüger-0/+46
Honor current target when checking conditional compilation values This is fixed by simply using the currently registered target in the current session. We need to use it because of target json that are not by design included in the rustc list of targets. Fixes https://github.com/rust-lang/rust/issues/108941
2023-03-11Rollup merge of #108927 - Ayush1325:pal-cleanup, r=workingjubileeMatthias Krüger-5/+5
Move __thread_local_inner to sys Move `__thread_local_inner` macro in `crate::thread::local` to `crate::sys`. Initially, I was thinking about removing this macro completely, but I could not find a way to create the generic statics without macros, so in the end, I just moved to code around. This probably will need a rebase once https://github.com/rust-lang/rust/pull/108917 is merged r? ``@workingjubilee``
2023-03-11Rollup merge of #108711 - Nilstrieb:nt-note, r=petrochenkovMatthias Krüger-0/+1
Add note when matching token with nonterminal The current error message is _really_ confusing. The implementation is slightly hacky, but not that much more hacky than all this nonterminal stuff.. r? ``@petrochenkov``
2023-03-11Auto merge of #109001 - matthiaskrgr:rollup-a3agnwp, r=matthiaskrgrbors-260/+148
Rollup of 8 pull requests Successful merges: - #105798 (Relax ordering rules for `asm!` operands) - #105962 (Stabilize path_as_mut_os_str) - #106085 (use problem matchers for tidy CI) - #107711 (Stabilize movbe target feature) - #108017 (Add `--no-undefined-version` link flag and fix associated breakage) - #108891 (Remove an extraneous include) - #108902 (no more do while :<) - #108912 (Document tool lints) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-10rustdoc: use restricted Damerau-Levenshtein distance for searchMichael Howell-0/+12
Based on https://github.com/rust-lang/rust/pull/108200, for the same rationale. > This replaces the existing Levenshtein algorithm with the > Damerau-Levenshtein algorithm. This means that "ab" to "ba" is one change > (a transposition) instead of two (a deletion and insertion). More > specifically, this is a restricted implementation, in that "ca" to "abc" > cannot be performed as "ca" → "ac" → "abc", as there is an insertion in the > middle of a transposition. I believe that errors like that are sufficiently > rare that it's not worth taking into account. Before this change, searching `prinltn!` listed `print!` first, followed by `println!`. With this change, `println!` matches more closely.
2023-03-10Rollup merge of #105798 - Amanieu:relax-asm, r=joshtriplettMatthias Krüger-260/+148
Relax ordering rules for `asm!` operands The `asm!` and `global_asm!` macros require their operands to appear strictly in the following order: - Template strings - Positional operands - Named operands - Explicit register operands - `clobber_abi` - `options` This is overly strict and can be inconvienent when building complex `asm!` statements with macros. This PR relaxes the ordering requirements as follows: - Template strings must still come before all other operands. - Positional operands must still come before named and explicit register operands. - Named and explicit register operands can be freely mixed. - `options` and `clobber_abi` can appear in any position after the template strings. r? ```````@joshtriplett```````
2023-03-10Rollup merge of #108983 - ↵Matthias Krüger-1/+16
LeSeulArtichaut:108646-target-feature-default-impl, r=cjgillot Forbid `#[target_feature]` on safe default implementations Fixes #108646.
2023-03-10Rollup merge of #108947 - compiler-errors:ct-infer-no-shapeshifting, r=BoxyUwUMatthias Krüger-21/+50
Don't even try to combine consts with incompatible types ~I left a more detailed explanation for why this fixes this issue in the UI test, but in general, we should not try to unify const infer vars and rigid consts if they have incompatible types. That's because we don't want something like a `ConstArgHasType` predicate to suddenly go from passing to failing, or vice versa, due to a shallow resolve.~ 1. Use the `type_of` for a parameter in `try_eval_lit_or_param`, instead of the "expected" type from a `WithOptConstParam` def id. 2. Don't combine consts that have incompatible types. Fixes #108781
2023-03-10Rollup merge of #108930 - Ezrashaw:better-error-for-manual-fn-impl, ↵Matthias Krüger-0/+46
r=petrochenkov feat: implement better error for manual impl of `Fn*` traits Fixes #39259 cc `@estebank` (you gave me some advice in the linked issue, would you like to review?)
2023-03-10Rollup merge of #108900 - bvanjoi:issue-108275, r=petrochenkovMatthias Krüger-6/+36
fix(lexer): print whitespace warning for \x0c - close https://github.com/rust-lang/rust/issues/108275 - discussion: https://github.com/rust-lang/rust/pull/108403
2023-03-10Rollup merge of #108834 - compiler-errors:fn-ptr-fn-obl, r=spastorinoMatthias Krüger-0/+33
Do not ICE when we have fn pointer `Fn` obligations with bound vars in the self type We never supported solving `for<'a> fn(&'a ()): Fn(&'a ())` -- I tried to add that support in #104929, but iirc `@lcnr` wanted to support this more generally by eagerly instantiating trait predicate binders with placeholders. That never happened due to blockers in the old solver, but we probably shouldn't ICE in any case. On the bright side, this passes on the new solver :^)
2023-03-10Rollup merge of #108828 - compiler-errors:new-solver-alias-eq-on-num-var, r=lcnrMatthias Krüger-15/+72
Emit alias-eq when equating numeric var and projection This doesn't fix everything having to do with projections and infer vars, but it does fix a common case I saw in HIR typeck. r? `@lcnr`
2023-03-10Moved thread_local implementation to sys::commonAyush Singh-5/+5
This allows removing all the platform-dependent code from `library/std/src/thread/local.rs` and `library/std/src/thread/mod.rs` Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>