about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-09-23Auto merge of #125645 - RalfJung:unclear_local_imports, r=nnethercotebors-0/+71
add unqualified_local_imports lint This lint helps deal with https://github.com/rust-lang/rustfmt/issues/4709 by having the compiler detect imports of local items that are not syntactically distinguishable from imports from other cates. Making them syntactically distinguishable ensures rustfmt can consistently apply the desired import grouping.
2024-09-23Rollup merge of #130721 - GrigorenkoPV:block-no-opening-brace, r=jieyouxuJubilee-12/+48
Add more test cases for block-no-opening-brace Also add FIXME's for #80931 & #78168
2024-09-23Rollup merge of #130657 - arttet:fix/fuchsia, r=jieyouxuJubilee-6/+0
Remove x86_64-fuchsia and aarch64-fuchsia target aliases Closes #106649.
2024-09-23Rollup merge of #130551 - nnethercote:fix-break-last-token, r=petrochenkovJubilee-0/+16
Fix `break_last_token`. It currently doesn't handle the three-char tokens `>>=` and `<<=` correctly. These can be broken twice, resulting in three individual tokens. This is a latent bug that currently doesn't cause any problems, but does cause problems for #124141, because that PR increases the usage of lazy token streams. r? `@petrochenkov`
2024-09-23add unqualified_local_imports lintRalf Jung-0/+71
2024-09-23Auto merge of #129047 - DianQK:early_otherwise_branch_scalar, r=cjgillotbors-0/+247
Apply `EarlyOtherwiseBranch` to scalar value In the future, I'm thinking of hoisting discriminant via GVN so that we only need to write very little code here. r? `@cjgillot`
2024-09-23Rollup merge of #130726 - workingjubilee:put-the-spurs-to-this-test, r=BoxyUwUMatthias Krüger-22/+0
tests: Remove spuriously failing vec-tryinto-array codegen test This has failed more than a couple of times now. It costs real time, money, and energy to deal with this, far more than this test is saving us.
2024-09-23Rollup merge of #130714 - compiler-errors:try-structurally-resolve-const, ↵Matthias Krüger-2/+2
r=BoxyUwU Introduce `structurally_normalize_const`, use it in `rustc_hir_typeck` Introduces `structurally_normalize_const` to typecking to separate the "eval a const" step from the "try to turn a valtree into a target usize" in HIR typeck, where we may still have infer vars and stuff around. I also changed `check_expr_repeat` to move a double evaluation of a const into a single one. I'll leave inline comments. r? ```@BoxyUwU``` I hesitated to really test this on the new solver where it probably matters for unevaluated consts. If you're worried about the side-effects, I'd be happy to craft some more tests 😄
2024-09-23Rollup merge of #130712 - compiler-errors:const-eval-error-reporting, r=BoxyUwUMatthias Krüger-158/+158
Don't call `ty::Const::normalize` in error reporting We do this to ensure that trait refs with unevaluated consts have those consts simplified to their evaluated forms. Instead, use `try_normalize_erasing_regions`. **NOTE:** This has the side-effect of erasing regions from all of our trait refs. If this is too much to review or you think it's too opinionated of a diagnostics change, then I could split out the effective change (i.e. erasing regions from this impl suggestion) into another PR and have someone else review it.
2024-09-23Rollup merge of #130705 - compiler-errors:rtn-complete, r=jackh726Matthias Krüger-429/+76
No longer mark RTN as incomplete The RFC is accepted and the feature is basically fully implemented. This doesn't mean it's necesarily *ready* for stabiliation; there's probably some diagnostic improvements to be made, and as always, users uncover the most creative bugs. But marking this feature as incomplete no longer serves any purpose, so let's fix that.
2024-09-23Rollup merge of #130344 - Jaic1:fix-116306, r=BoxyUwUMatthias Krüger-0/+24
Handle unsized consts with type `str` in v0 symbol mangling This PR fixes #116303 by handling consts with type `str` in v0 symbol mangling as partial support for unsized consts. This PR is related to `#![feature(adt_const_params)]` (#95174) and `#![feature(unsized_const_params)]` (#128028). r? ``@BoxyUwU``
2024-09-23Rollup merge of #129550 - kornelski:boxasstr, r=joshtriplett,dtolnayMatthias Krüger-48/+0
Add str.as_str() for easy Deref to string slices Working with `Box<str>` is cumbersome, because in places like `iter.filter()` it can end up being `&Box<str>` or even `&&Box<str>`, and such type doesn't always get auto-dereferenced as expected. Dereferencing such box to `&str` requires ugly syntax like `&**boxed_str` or `&***boxed_str`, with the exact amount of `*`s. `Box<str>` is [not easily comparable with other string types](https://github.com/rust-lang/rust/pull/129852) via `PartialEq`. `Box<str>` won't work for lookups in types like `HashSet<String>`, because `Borrow<String>` won't take types like `&Box<str>`. OTOH `set.contains(s.as_str())` works nicely regardless of levels of indirection. `String` has a simple solution for this: the `as_str()` method, and `Box<str>` should too.
2024-09-22Fix hard-coded stderr in run-make testMichael Goulet-6/+6
2024-09-22Bless rustdoc-js-std testMichael Goulet-5/+5
2024-09-22tests: Remove spuriously failing vec-tryinto-array codegen testJubilee Young-22/+0
2024-09-23Fix `break_last_token`.Nicholas Nethercote-0/+16
It currently doesn't handle the three-char tokens `>>=` and `<<=` correctly. These can be broken twice, resulting in three individual tokens. This is a latent bug that currently doesn't cause any problems, but does cause problems for #124141, because that PR increases the usage of lazy token streams.
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-26/+26
2024-09-22Add more test cases for block-no-opening-bracePavel Grigorenko-12/+48
2024-09-22Don't call const normalize in error reportingMichael Goulet-158/+158
2024-09-22Introduce structurally_normalize_const, use it in hir_typeckMichael Goulet-2/+2
2024-09-22No longer mark RTN as incompleteMichael Goulet-429/+76
2024-09-22Auto merge of #130689 - RalfJung:rustc_nonnull_optimization_guaranteed, ↵bors-2/+3
r=jieyouxu fix rustc_nonnull_optimization_guaranteed docs As far as I can tell, even back when this was [added](https://github.com/rust-lang/rust/pull/60300) it never *enabled* any optimizations. It just indicates that the FFI compat lint should accept those types for NPO.
2024-09-22fix rustc_nonnull_optimization_guaranteed docsRalf Jung-2/+3
2024-09-21Rollup merge of #130669 - workingjubilee:slicing-fnptr-tests-finely, ↵Jubilee-0/+25
r=compiler-errors tests: Test that `extern "C" fn` ptrs lint on slices This seems to have slipped past the `improper_ctypes_definitions` lint at some point. I found similar tests but not one with this exact combination, so test the semi-unique combination.
2024-09-21Rollup merge of #130665 - veera-sivarajan:fix-118612, r=compiler-errorsJubilee-0/+116
Prevent Deduplication of `LongRunningWarn` Fixes #118612 As mention in the issue, `LongRunningWarn` is meant to be repeated multiple times. Therefore, this PR stores a unique number in every instance of `LongRunningWarn` so that it's not hashed into the same value and omitted by the deduplication mechanism.
2024-09-21Rollup merge of #130664 - GuillaumeGomez:generate-line-numbers-on-non-rust, ↵Jubilee-7/+60
r=notriddle Generate line numbers for non-rust code examples as well Currently, the "enable line numbers" setting only generated it for rust code examples. Found this limitation a bit strange so I decided to remove it. You can test it [here](https://rustdoc.crud.net/imperio/generate-line-number-non-rust/doc/lib2/sub_mod/struct.Foo.html). r? ``@notriddle``
2024-09-22Auto merge of #130246 - dianne:issue-97589-fix, r=petrochenkovbors-0/+20
rustc_expand: remember module `#[path]`s during expansion During invocation collection, if a module item parsed from a `#[path]` attribute needed a second pass after parsing, its path wouldn't get added to the file path stack, so cycle detection broke. This checks the `#[path]` in such cases, so that it gets added appropriately. I think it should work identically to the case for external modules that don't need a second pass, but I'm not 100% sure. Fixes #97589
2024-09-22Auto merge of #130337 - BoxyUwU:anon_const_macro_call, r=camelidbors-0/+108
Fix anon const def-creation when macros are involved take 2 Fixes #130321 There were two cases that #129137 did not handle correctly: - Given a const argument `Foo<{ bar!() }>` in which `bar!()` expands to `N`, we would visit the anon const and then visit the `{ bar() }` expression instead of visiting the macro call. This meant that we would build a def for the anon const as `{ bar!() }` is not a trivial const argument as `bar!()` is not a path. - Given a const argument `Foo<{ bar!() }>` is which `bar!()` expands to `{ qux!() }` in which `qux!()` expands to `N`, it should not be considered a trivial const argument as `{{ N }}` has two pairs of braces. If we only looked at `qux`'s expansion it would *look* like a trivial const argument even though it is not. We have to track whether we have "unwrapped" a brace already when recursing into the expansions of `bar`/`qux`/any macro r? `@camelid`
2024-09-22Add GUI regression test for non-rust code blocks line numbersGuillaume Gomez-7/+60
2024-09-21Handle macro calls in anon const def creation take 2Boxy-0/+108
2024-09-21Rollup merge of #130673 - GrigorenkoPV:path-triple-colon, r=compiler-errorsMichael Goulet-0/+318
Parser: recover from `:::` to `::` Closes #130613
2024-09-21Rollup merge of #130667 - workingjubilee:she-is-c-c-c-cold, r=compiler-errorsMichael Goulet-0/+14
compiler: Accept "improper" ctypes in extern "rust-cold" fn
2024-09-21Rollup merge of #130666 - compiler-errors:super-bounds, r=fee1-dead,fmeaseMichael Goulet-14/+1
Assert that `explicit_super_predicates_of` and `explicit_item_super_predicates` truly only contains bounds for the type itself We distinguish _implied_ predicates (anything that is implied from elaborating a trait bound) from _super_ predicates, which are are the subset of implied predicates that share the same self type as the trait predicate we're elaborating. This was originally done in #107614, which fixed a large class of ICEs and strange errors where the compiler expected the self type of a trait predicate not to change when elaborating super predicates. Specifically, super predicates are special for various reasons: they're the valid candidates for trait upcasting, are the only predicates we elaborate when doing closure signature inference, etc. So making sure that we get this list correct and don't accidentally "leak" any other predicates into this list is quite important. This PR adds some debug assertions that we're in fact not doing so, and it fixes an oversight in the effect desugaring rework.
2024-09-21Rollup merge of #129629 - compiler-errors:rtn-in-path, r=jackh726Michael Goulet-76/+803
Implement Return Type Notation (RTN)'s path form in where clauses Implement return type notation (RTN) in path position for where clauses. We already had RTN in associated type position ([e.g.](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=627a4fb8e2cb334863fbd08ed3722c09)), but per [the RFC](https://rust-lang.github.io/rfcs/3654-return-type-notation.html#where-rtn-can-be-used-for-now): > As a standalone type, RTN can only be used as the Self type of a where-clause [...] Specifically, in order to enable code like: ```rust trait Foo { fn bar() -> impl Sized; } fn is_send(_: impl Send) {} fn test<T>() where T: Foo, T::bar(..): Send, { is_send(T::bar()); } ``` * In the resolver, when we see a `TyKind::Path` whose final segment is `GenericArgs::ParenthesizedElided` (i.e. `(..)`), resolve that path in the *value* namespace, since we're looking for a method. * When lowering where clauses in HIR lowering, we first try to intercept an RTN self type via `lower_ty_maybe_return_type_notation`. If we find an RTN type, we lower it manually in a way that respects its higher-ranked-ness (see below) and resolves to the corresponding RPITIT. Anywhere else, we'll emit the same "return type notation not allowed in this position yet" error we do when writing RTN in every other position. * In `resolve_bound_vars`, we add some special treatment for RTN types in where clauses. Specifically, we need to add new lifetime variables to our binders for the early- and late-bound vars we encounter on the method. This implements the higher-ranked desugaring [laid out in the RFC](https://rust-lang.github.io/rfcs/3654-return-type-notation.html#converting-to-higher-ranked-trait-bounds). This PR also adds a bunch of tests, mostly negative ones (testing error messages). In a follow-up PR, I'm going to mark RTN as no longer incomplete, since this PR basically finishes the impl surface that we should initially stabilize, and the RFC was accepted. cc [RFC 3654](https://github.com/rust-lang/rfcs/pull/3654) and https://github.com/rust-lang/rust/issues/109417
2024-09-21Rollup merge of #127766 - folkertdev:c-cmse-nonsecure-entry, r=jackh726Michael Goulet-108/+126
add `extern "C-cmse-nonsecure-entry" fn` tracking issue #75835 in https://github.com/rust-lang/rust/issues/75835#issuecomment-1183517255 it was decided that using an abi, rather than an attribute, was the right way to go for this feature. This PR adds that ABI and removes the `#[cmse_nonsecure_entry]` attribute. All relevant tests have been updated, some are now obsolete and have been removed. Error 0775 is no longer generated. It contains the list of targets that support the CMSE feature, and maybe we want to still use this? right now a generic "this abi is not supported on this platform" error is returned when this abi is used on an unsupported platform. On the other hand, users of this abi are likely to be experienced rust users, so maybe the generic error is good enough.
2024-09-21Parser: recover from `:::` to `::` in delegationsPavel Grigorenko-0/+126
2024-09-21Parser: recover from `:::` to `::`Pavel Grigorenko-0/+192
2024-09-21tests: Test that `extern "C" fn` ptrs lint on slicesJubilee Young-0/+25
2024-09-21Don't elaborate effects predicates into bounds list unless we're actually ↵Michael Goulet-14/+1
collecting implied bounds, not super bounds
2024-09-21Auto merge of #127546 - workingjubilee:5-level-paging-exists, r=saethlinbors-104/+91
Correct outdated object size limit The comment here about 48 bit addresses being enough was written in 2016 but was made incorrect in 2019 by 5-level paging, and then persisted for another 5 years before being noticed and corrected. The bolding of the "exclusive" part is merely to call attention to something I missed when reading it and doublechecking the math. try-job: i686-msvc try-job: test-various
2024-09-21compiler: Accept "improper" ctypes in extern "rust-cold" fnJubilee Young-0/+14
2024-09-21Prevent Deduplication of `LongRunningWarn`Veera-1/+73
2024-09-21Update TestsVeera-0/+44
2024-09-21More tests and tweak commentsMichael Goulet-7/+283
2024-09-21Auto merge of #129283 - saethlin:unreachable-allocas, r=scottmcmbors-8/+33
Don't alloca for unused locals We already have a concept of mono-unreachable basic blocks; this is primarily useful for ensuring that we do not compile code under an `if false`. But since we never gave locals the same analysis, a large local only used under an `if false` will still have stack space allocated for it. There are 3 places we traverse MIR during monomorphization: Inside the collector, `non_ssa_locals`, and the walk to generate code. Unfortunately, https://github.com/rust-lang/rust/pull/129283#issuecomment-2297925578 indicates that we cannot afford the expense of tracking reachable locals during the collector's traversal, so we do need at least two mono-reachable traversals. And of course caching is of no help here because the benchmarks that regress are incr-unchanged; they don't do any codegen. This fixes the second problem in https://github.com/rust-lang/rust/issues/129282, and brings us anther step toward `const if` at home.
2024-09-21Auto merge of #130599 - jieyouxu:snake_case_binary_cleanup, r=petrochenkovbors-100/+65
Explain why `non_snake_case` is skipped for binary crates and cleanup tests - Explain `non_snake_case` lint is skipped for bin crate names because binaries are not intended to be distributed or consumed like library crates (#45127). - Coalesce the bunch of tests into a single one but with revisions, which is easier to compare the differences for `non_snake_case` behavior with respect to crate types. Follow-up to #121749 with some more comments and test cleanup. cc `@saethlin` who bumped into one of the tests and was confused why it was `only-x86_64-unknown-linux-gnu`. try-job: dist-i586-gnu-i586-i686-musl
2024-09-21disallow cmse ABIs on unsupported platformsFolkert-4/+37
2024-09-21Add assembly test for the cmse unstable featuresFolkert-0/+26
verifies that the correct return instructions are emitted. Co-authored-by: Tamme Dittrich <tamme@tweedegolf.com>
2024-09-21add test that accepts a `C-cmse-nonsecure-call` function pointerFolkert-0/+20
2024-09-21remove `#[cmse_nonsecure_entry]`Folkert-100/+38