about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-03-30Auto merge of #109224 - oli-obk:smir, r=pnkfelixbors-4/+27
Stable MIR: Add basic MIR body datastructures At this point it will panic on most useful MIR, but you can do basic assignments r? `@pnkfelix`
2023-03-29Rollup merge of #109726 - GuillaumeGomez:doc-hidden-crate, r=notriddleMatthias Krüger-0/+8
rustdoc: Don't strip crate module Until we decide something for https://github.com/rust-lang/rust/issues/109695, rustdoc won't crash anymore because the crate folder doesn't exist. r? `@notriddle`
2023-03-29Rollup merge of #109700 - clubby789:tidy-fluent-escape, r=compiler-errorsMatthias Krüger-2/+36
Lint against escape sequences in Fluent files Fixes #109686 by checking for `\n`, `\"` and `\'` in Fluent files. It might be useful to have a way to opt out of this check, but all messages with violations currently do seem to be incorrect.
2023-03-29Rollup merge of #109675 - compiler-errors:object-heck, r=lcnrMatthias Krüger-6/+21
Do not consider elaborated projection predicates for objects in new solver Object types have projection bounds which are elaborated during astconv. There's no need to do it again for projection goals, since that'll give us duplicate projection candidatesd that are distinct up to regions due to the fact that we canonicalize every region to a separate variable. See quick example below the break for a better explanation. Discussed this with lcnr, and adding a stop-gap until we get something like intersection region constraints (or modify canonicalization to canonicalize identical regions to the same canonical regions) -- after which, this will hopefully not matter and may be removed. r? `@lcnr` --- See `tests/ui/traits/new-solver/more-object-bound.rs`: Consider a goal: `<dyn Iter<'a, ()> as Iterator>::Item = &'a ()`. After canonicalization: `<dyn Iter<'!0r, (), Item = '!1r ()> as Iterator>::Item == &!'2r ()` * First object candidate comes from the item bound in the dyn's bounds itself, giving us `<dyn Iter<'!0r, (), Item = '?!r ()> as Iterator>::Item == &!'1r ()`. This gives us one region constraint: `!'1r == !'2r`. * Second object candidate comes from elaborating the principal trait ref, gives us `<dyn Iter<'!0r, (), Item = '!1r ()> as Iterator>::Item == &!'0r ()`. This gives us one region constraint: `!'0r == !'2r`. * Oops! Ambiguity!
2023-03-29Rollup merge of #109554 - MU001999:master, r=WaffleLapkinMatthias Krüger-0/+35
Suggest ..= when someone tries to create an overflowing range Fixes #109529
2023-03-29Check for escape sequences in Fluent resourcesclubby789-2/+36
2023-03-29Auto merge of #108089 - Zoxc:windows-tls, r=bjorn3bors-0/+51
Support TLS access into dylibs on Windows This allows access to `#[thread_local]` in upstream dylibs on Windows by introducing a MIR shim to return the address of the thread local. Accesses that go into an upstream dylib will call the MIR shim to get the address of it. `convert_tls_rvalues` is introduced in `rustc_codegen_ssa` which rewrites MIR TLS accesses to dummy calls which are replaced with calls to the MIR shims when the dummy calls are lowered to backend calls. A new `dll_tls_export` target option enables this behavior with a `false` value which is set for Windows platforms. This fixes https://github.com/rust-lang/rust/issues/84933.
2023-03-29Do not consider elaborated projection predicates for objects in new solverMichael Goulet-6/+21
2023-03-29Add regression test for #109695Guillaume Gomez-0/+8
2023-03-29Use #[cfg(target_thread_local)] on itemsJohn Kåre Alsaker-2/+4
2023-03-29Auto merge of #109670 - lqd:init-mask, r=oli-obkbors-2/+2
Make init mask lazy for fully initialized/uninitialized const allocations There are a few optimization opportunities in the `InitMask` and related const `Allocation`s (e.g. by taking advantage of the fact that it's a bitset that represents initialization, which is often entirely initialized or uninitialized in a single call, or gradually built up, etc). There's a few overwrites to the same state, multiple writes in a row to the same indices, the RLE scheme for `memcpy` doesn't always compress, etc. Here, we start with: - avoiding materializing the bitset's blocks if the allocation is fully initialized/uninitialized - dealloc blocks when fully overwriting, including when participating in `memcpy`s - take care of the fixme about allocating blocks of 0s before overwriting them to the expected value - expanding unit test coverage of the init mask This should be most visible on benchmarks and crates where const allocations dominate the runtime (like `ctfe-stress-5` of course), but I was especially looking at the worst cases from #93215. This first change allows the majority of `set_range` calls to stay with a lazy init mask when bootstrapping rustc (not that the init mask is a big part of the process in cpu time or memory usage). r? `@oli-obk` I have another in-progress branch where I'll switch the singular initialized/uninitialized value to a watermark, recording the point after which everything is uninitialized. That will take care of cases where full initialization is monotonic and done in multiple steps (e.g. an array of a type without padding), which should then allow the vast majority of const allocations' init masks to stay lazy during bootstrapping (though interestingly I've seen such gradual initialization in both left-to-right and right-to-left directions, and I don't think a single watermark can handle both).
2023-03-29Rollup merge of #109683 - compiler-errors:self-ty-overflow, r=lcnrDylan DPC-0/+52
Check for overflow in `assemble_candidates_after_normalizing_self_ty` Prevents a stack overflow (:warning: :exclamation:) in the new solver when we have param-env candidates that look like: `T: Trait<Assoc = <T as Trait>::Assoc>` The current error message looks bad, but that's because we don't distinguish overflow and other ambiguity errors. I'll break that out into a separate PR since the fix may be controversial. r? `@lcnr`
2023-03-29Rollup merge of #109664 - m-ou-se:format-args-placeholder-span, r=oli-obkDylan DPC-37/+110
Use span of placeholders in format_args!() expansion. `format_args!("{}", x)` expands to something that contains `Argument::new_display(&x)`. That entire expression was generated with the span of `x`. After this PR, `&x` uses the span of `x`, but the `new_display` call uses the span of the `{}` placeholder within the format string. If an implicitly captured argument was used like in `format_args!("{x}")`, both use the span of the `{x}` placeholder. This fixes https://github.com/rust-lang/rust/issues/109576, and also allows for more improvements to similar diagnostics in the future, since the usage of `x` can now be traced to the exact `{}` placeholder that required it to be `Display` (or `Debug` etc.)
2023-03-29Rollup merge of #109534 - petrochenkov:noprimuse, r=GuillaumeGomezDylan DPC-1/+1
rustdoc: Unsupport importing `doc(primitive)` and `doc(keyword)` modules These are internal features used for a specific purpose, and modules without imports are enough for that purpose.
2023-03-29Rollup merge of #108335 - compiler-errors:non_lifetime_binders-rustdoc, ↵Dylan DPC-0/+33
r=GuillaumeGomez rustdoc + rustdoc-json support for `feature(non_lifetime_binders)` Makes `for<T> T: Trait` and `for<const N: usize> ..` in where clause operate correctly. Fixes #108158
2023-03-29Auto merge of #109714 - matthiaskrgr:rollup-wipns5h, r=matthiaskrgrbors-5/+165
Rollup of 6 pull requests Successful merges: - #109149 (Improve error message when writer is forgotten in write and writeln macro) - #109367 (Streamline fast rejection) - #109548 (AnnotationColumn struct to fix hard tab column numbers in errors) - #109694 (do not panic on failure to acquire jobserver token) - #109705 (new solver: check for intercrate mode when accessing the cache) - #109708 (Specialization involving RPITITs is broken so ignore the diagnostic differences) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-29Rollup merge of #109708 - spastorino:new-rpitit-20, r=compiler-errorsMatthias Krüger-2/+38
Specialization involving RPITITs is broken so ignore the diagnostic differences Just bless the corresponding test for `-Zlower-impl-trait-in-trait-to-assoc-ty` r? `@compiler-errors`
2023-03-29Rollup merge of #109694 - BelovDV:fix-panic-jobserver-token, r=bjorn3Matthias Krüger-0/+12
do not panic on failure to acquire jobserver token Purpose: remove `panic`. Rust fails to acquire token if an error in build system occurs - environment variable contains incorrect `jobserver-auth`. It isn't ice so compiler shouldn't panic on such error. Related issue: #46981
2023-03-29Rollup merge of #109548 - pommicket:better-column-numbers-with-hard-tabs, ↵Matthias Krüger-0/+32
r=petrochenkov AnnotationColumn struct to fix hard tab column numbers in errors Fixes #109537 i don't know if this is the best way of fixing this but it works
2023-03-29Rollup merge of #109149 - mj10021:issue-108713-fix, ↵Matthias Krüger-3/+83
r=compiler-errors,WaffleLapkin Improve error message when writer is forgotten in write and writeln macro Modified write! macro error message when writer is forgotten as in issue #108713 Fixes #108713 r? ``@WaffleLapkin``
2023-03-29Test that TLS access works outside of the dylib it's defined inJohn Kåre Alsaker-0/+49
2023-03-29add run-rustfixMu42-2/+10
2023-03-28Simplify transmutes in MIR InstCombineScott McMurray-0/+290
Thanks to the combination of #108246 and #108442 it could already remove identity transmutes. With this PR, it can also simplify them to `IntToInt` casts, `Discriminant` reads, or `Field` projections.
2023-03-28Specialization involving RPITITs is broken so ignore the diagnostic ↵Santiago Pastorino-2/+38
differences for them
2023-03-28Check for overflow in assemble_candidates_after_normalizing_self_tyMichael Goulet-0/+52
2023-03-28rustdoc + rustdoc-json support for non_lifetime_bindersMichael Goulet-0/+33
2023-03-28Auto merge of #109692 - Nilstrieb:rollup-hq65rps, r=Nilstriebbors-4/+179
Rollup of 8 pull requests Successful merges: - #91793 (socket ancillary data implementation for FreeBSD (from 13 and above).) - #92284 (Change advance(_back)_by to return the remainder instead of the number of processed elements) - #102472 (stop special-casing `'static` in evaluation) - #108480 (Use Rayon's TLV directly) - #109321 (Erase impl regions when checking for impossible to eagerly monomorphize items) - #109470 (Correctly substitute GAT's type used in `normalize_param_env` in `check_type_bounds`) - #109562 (Update ar_archive_writer to 0.1.3) - #109629 (remove obsolete `givens` from regionck) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-28[fix] don't panic on failure to acquire jobserver tokenDaniil Belov-0/+12
2023-03-28rustdoc: Unsupport importing `doc(primitive)` and `doc(keyword)` modulesVadim Petrochenkov-1/+1
These are internal features used for a specific purpose, and modules without imports are enough for that purpose.
2023-03-28Create AnnotationColumn struct to fix hard tab column numbers in errorspommicket-0/+32
2023-03-28Auto merge of #108080 - oli-obk:FnPtr-trait, r=lcnrbors-20/+9
Add a builtin `FnPtr` trait that is implemented for all function pointers r? `@ghost` Rebased version of https://github.com/rust-lang/rust/pull/99531 (plus adjustments mentioned in the PR). If perf is happy with this version, I would like to land it, even if the diagnostics fix in 9df8e1befb5031a5bf9d8dfe25170620642d3c59 only works for `FnPtr` specifically, and does not generally improve blanket impls.
2023-03-28Rollup merge of #109629 - aliemjay:remove-givens, r=lcnrnils-0/+82
remove obsolete `givens` from regionck Revives #107376. The only change is the last commit (https://github.com/rust-lang/rust/pull/109629/commits/2a3177a8bcc4c5a5285dc2908a0f1ce98e9a6377) which should fix the regression. Fixes https://github.com/rust-lang/rust/issues/106567 r? `@lcnr`
2023-03-28Rollup merge of #109470 - compiler-errors:gat-normalize-bound, r=jackh726nils-0/+17
Correctly substitute GAT's type used in `normalize_param_env` in `check_type_bounds` Given: ```rust trait Foo { type Assoc<T>: PartialEq<Self::Assoc<i32>>; } impl Foo for () { type Assoc<T> = Wrapper<T>; } struct Wrapper<T>(T); impl<T> PartialEq<Wrapper<i32>> for Wrapper<T> { } ``` We add an additional predicate in the `normalize_param_env` in `check_type_bounds` that is used to normalize the GAT's bounds to check them in the impl. Problematically, though, that predicate is constructed to be `for<^0> <() as Foo>::Assoc<^0> => Wrapper<T>`, instead of `for<^0> <() as Foo>::Assoc<^0> => Wrapper<^0>`. That means `Self::Assoc<i32>` in the bounds that we're checking normalizes to `Wrapper<T>`, instead of `Wrapper<i32>`, and so the bound `Self::Assoc<T>: PartialEq<Self::Assoc<i32>>` normalizes to `Wrapper<T>: PartialEq<Wrapper<T>>`, which does not hold. Fixes this by properly substituting the RHS of that normalizes predicate that we add to the `normalize_param_env`. That means the bound is properly normalized to `Wrapper<T>: PartialEq<Wrapper<i32>>`, which *does* hold. --- The second commit in this PR just cleans up some substs stuff and some naming. r? `@jackh726` cc #87900
2023-03-28Rollup merge of #109321 - compiler-errors:illegal-mono-w-regions, r=cjgillotnils-0/+19
Erase impl regions when checking for impossible to eagerly monomorphize items We were inserting `ReErased` for method substs, but not for impl substs, leading to the call for `subst_and_check_impossible_predicates` being a bit weaker than it should be (since it ignores predicates that need substitution -- incl early-bound regions). Fixes #109297
2023-03-28Rollup merge of #102472 - lcnr:static-in-eval, r=jackh726nils-4/+61
stop special-casing `'static` in evaluation fixes #102360 I have no idea whether this actually removed all places where `'static` matters. Without canonicalization it's very easy to accidentally rely on `'static` again. Blocked on changing the `order_dependent_trait_objects` future-compat lint to a hard error r? `@nikomatsakis`
2023-03-28Auto merge of #109557 - fee1-dead-contrib:mv-const-traits, r=oli-obkbors-259/+397
Move const trait bounds checks to MIR constck Fixes #109543. When checking paths in HIR typeck, we don't want to check for const predicates since all we want might just be a function pointer. Therefore we move this to MIR constck and check that bounds are met during MIR constck. r? `@oli-obk`
2023-03-28fix long lineDeadbeef-23/+25
2023-03-28Move const trait bounds checks to MIR constckDeadbeef-259/+395
Fixes #109543. When checking paths in HIR typeck, we don't want to check for const predicates since all we want might just be a function pointer. Therefore we move this to MIR constck and check that bounds are met during MIR constck.
2023-03-28Rollup merge of #109661 - ↵Matthias Krüger-7/+7
fortanix:raoul/EDP-107-fix_lvi_mitigation_tests_llvm_16, r=cuviper Fix LVI test post LLVM 16 update #109474 updated LLVM to 16. This causes the LVI mitigation tests for the `x86_64-fortanix-unknown-sgx` platform to fail. This PR fixes those tests again. cc: `@jethrogb`
2023-03-28Rollup merge of #108548 - jamen:master, r=compiler-errorsMatthias Krüger-10/+156
Clarify the 'use a constant in a pattern' error message ```rs use std::borrow::Cow; const ERROR_CODE: Cow<'_, str> = Cow::Borrowed("23505"); fn main() { let x = Cow::from("23505"); match x { ERROR_CODE => {} } } ``` ``` error: to use a constant of type `Cow` in a pattern, `Cow` must be annotated with `#[derive(PartialEq, Eq)]` --> src/main.rs:9:9 | 9 | ERROR_CODE => {} | ^^^^^^^^^^ error: could not compile `playground` due to previous error ``` It seems helpful to link to StructuralEq in this message. I was a little confused, because `Cow<'_, str>` implements PartialEq and Eq, but they're not derived, which I learned is necessary for structural equality and using constants in patterns (thanks to the Rust community Discord server) For tests, should I update every occurrence of this message? I see tests where this is still a warning and I'm not sure if I should update those.
2023-03-28Erase impl regions when checking for impossible to eagerly monomorphize itemsMichael Goulet-0/+19
2023-03-27check for write macro and write_fmt with err msgJames Dietz-3/+83
added ui test blessed stderrs fixed typo reblessed
2023-03-27Auto merge of #109440 - WaffleLapkin:make_tidy_slower, r=jyn514bors-2/+1
Don't skip all directories when tidy-checking This fixes a regression from https://github.com/rust-lang/rust/pull/108772 which basically made it that tidy style checks only `README.md` and `COMPILER_TESTS.md`.
2023-03-27Bless tidyMaybe Waffle-2/+1
2023-03-27update codegen test expectationsRémy Rakic-2/+2
Changing the layout of the InitMask changed the const allocations' hashes.
2023-03-27Rollup merge of #109637 - bjorn3:add_test_annotation, r=tmiaskoGuillaume Gomez-0/+1
Add missing needs-asm-support annotation to ui/simple_global_asm.rs
2023-03-27Rollup merge of #109330 - ↵Guillaume Gomez-0/+14
GuillaumeGomez:intermediate-reexport-intra-doc-ice, r=petrochenkov rustdoc: Fix ICE for intra-doc link on intermediate re-export Fixes https://github.com/rust-lang/rust/issues/109282. This PR is based on #109266 as it includes its commit to make this work. `@petrochenkov:` It was exactly as you predicted, adding the `DefId` to the attributes fixed the error for intermediate re-exports as well. Thanks a lot! r? `@petrochenkov`
2023-03-27Add notes to non-structural const in pattern error messageJamen Marz-10/+156
2023-03-27Add test for span of implicit format args captures.Mara Bos-0/+73
2023-03-27Bless mir-opt tests.Mara Bos-22/+22
(Only the lifetime spans changed.)