about summary refs log tree commit diff
path: root/src/tools
AgeCommit message (Collapse)AuthorLines
2023-09-19chore(miri): bump env_logger to 0.10Martin Kröning-1/+1
This reduces the amount of dependencies pulling in atty. ``` Removing env_logger v0.9.3 ``` Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
2023-09-19chore(Cargo.lock): bump colored and tracing-treeMartin Kröning-1/+1
This reduces the amount of dependencies pulling in atty. ``` Updating colored v2.0.0 -> v2.0.4 Updating tracing-tree v0.2.3 -> v0.2.4 ``` Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
2023-09-19Auto merge of #3054 - Vanille-N:spurious-fail, r=RalfJungbors-146/+917
Issue discovered in TB: spurious reads are not (yet) possible in a concurrent setting We discovered a week ago that in general, the current model of TB does not allow spurious reads because although reads provably never invalidate other reads, they migh invalidate writes. Consider the code ```rs fn f1(x: &u8) {} fn f2(y: &mut u8) -> &mut u8 { &mut *y } let mut data = 0; let _ = thread::spawn(|| { f1(&mut data) }; let _ = thread::spawn(|| { let y = f2(&mut data); *y = 42; }); ``` of which one possible interleaving is ```rs 1: retag x (&, protect) // x: [P]Frozen 2: retag y (&mut, protect) // y: [P]Reserved, x: [P]Frozen 1: return f1 // x: [P]Frozen -> Frozen, y: [P]Reserved 2: return f2 // x: Frozen, y: [P]Reserved -> Reserved 2: write y // x: Disabled, y: Active ``` that does not have UB. Assume enough barriers to force this specific interleaving, and consider that the compiler could choose to insert a spurious read throug `x` during the call to `f1` which would produce ```rs 1: retag x (&, protect) // x: [P]Frozen 2: retag y (&mut, protect) // y: [P]Reserved, x: [P]Frozen 1: spurious read x // x: [P]Frozen, y: [P]Reserved -> [P]Frozen 1: return f1 // x: [P]Frozen -> Frozen, y: [P]Frozen 2: return f2 // x: Frozen, y: [P]Frozen -> Frozen 2: write y // UB ``` Thus the target of the optimization (with a spurious read) has UB when the source did not. This is bad. SB is not affected because the code would be UB as early as `retag y`, this happens because we're trying to be a bit more subtle than that, and because the effects of a foreign read on a protected `&mut` bleed outside of the boundaries of the protector. Fortunately we have a fix planned, but in the meantime here are some `#[should_panic]` exhaustive tests to illustrate the issue. The error message printed by the `#[should_panic]` tests flags the present issue in slightly more general terms: it says that the sequence `retag x (&, protect); retag y (&mut, protect);` produces the configuration `C_source := x: [P]Frozen, x: [P]Reserved`, and that inserting a spurious read through `x` turns it into `C_target := x: [P]Frozen, y: [P]Reserved`. It then says that `C_source` is distinguishable from `C_target`, which means that there exists a sequence of instructions applied to both that triggers UB in `C_target` but not in `C_source`. It happens that one such sequence is `1: return f1; 2: return f2; 2: write y;` as shown above, but it is not the only one, as for example the interleaving `1: return f1; 2: write y;` is also problematic.
2023-09-19Issue of the current model: spurious reads are not possibleNeven Villani-146/+917
This occurs because in some interleavings, inserting a spurious read turns a Reserved into Frozen. We show here an exhaustive test (including arbitrary unknown code in two different threads) that makes this issue observable.
2023-09-19Auto merge of #115865 - RalfJung:mir-mod, r=oli-obkbors-2/+2
move things out of mir/mod.rs This moves a bunch of things out of `mir/mod.rs`: - all const-related stuff to a new file consts.rs - all statement/place/operand-related stuff to a new file statement.rs - all pretty-printing related stuff to pretty.rs `mod.rs` started out with 3100 lines and ends up with 1600. :) Also there was some pretty-printing stuff in terminator.rs, that also got moved to pretty.rs, and I reordered things in pretty.rs so that it can be grouped by functionality. Only the commit "use pretty_print_const_value from MIR constant 'extra' printing" has any behavior changes; it resolves the issue of having a fancy and a very crude pretty-printer for `ConstValue`. r? `@oli-obk`
2023-09-19Rollup merge of #112725 - notriddle:notriddle/advanced-search, r=GuillaumeGomezGuillaume Gomez-1/+3
rustdoc-search: add support for type parameters r? `@GuillaumeGomez` ## Preview * https://notriddle.com/rustdoc-html-demo-4/advanced-search/rustdoc/read-documentation/search.html * https://notriddle.com/rustdoc-html-demo-4/advanced-search/std/index.html?search=option%3Coption%3CT%3E%3E%20-%3E%20option%3CT%3E * https://notriddle.com/rustdoc-html-demo-4/advanced-search/std/index.html?search=option%3CT%3E,%20E%20-%3E%20result%3CT,%20E%3E * https://notriddle.com/rustdoc-html-demo-4/advanced-search/std/index.html?search=-%3E%20option%3CT%3E ## Description When writing a type-driven search query in rustdoc, specifically one with more than one query element, non-existent types become generic parameters instead of auto-correcting (which is currently only done for single-element queries) or giving no result. You can also force a generic type parameter by writing `generic:T` (and can force it to not use a generic type parameter with something like `struct:T` or whatever, though if this happens it means the thing you're looking for doesn't exist and will give you no results). There is no syntax provided for specifying type constraints for generic type parameters. When you have a generic type parameter in a search query, it will only match up with generic type parameters in the actual function, not concrete types that match, not concrete types that implement a trait. It also strictly matches based on when they're the same or different, so `option<T>, option<U> -> option<U>` matches `Option::and`, but not `Option::or`. Similarly, `option<T>, option<T> -> option<T>` matches `Option::or`, but not `Option::and`. ## Motivation This feature is motivated by the many "combinitor"-type functions found in generic libraries, such as Option, Future, Iterator, and Entry. These highly-generic functions have names that are almost completely arbitrary, and a type signature that tells you what it actually does. This PR is a major step towards[^closure] being able to easily search for generic functions by their type signature instead of by name. Some examples of combinators that can be found using this PR (try them out in the preview): * `option<option<T>> -> option<T>` returns Option::flatten * `option<T> -> result<T>` returns Option::ok_or * `option<result<T>> -> result<option<T>>` returns Option::transpose * `entry<K, V>, FnOnce -> V` returns `Entry::or_insert_with` (and `or_insert_with_key`, since there's no way to specify the generics on FnOnce) [^closure]: For this feature to be as useful as it ought to be, you should be able to search for *trait-associated types* and *closures*. This PR does not implement either of these: they are **Future possibilities**. Trait-associated types would allow queries like `option<T> -> iterator<item=T>` to return `Option::iter`. We should also allow `option<T> -> iterator<T>` to match the associated type version. Closures would make a good way to query for things like `Option::map`. Closure support needs associated types to be represented in the search index, since `FnOnce() -> i32` desugars to `FnOnce<Output=i32, ()>`, so associated trait types should be implemented first. Also, we'd want to expose an easy way to query closures without specifying which of the three traits you want.
2023-09-19move ConstValue into mirRalf Jung-2/+2
this way we have mir::ConstValue and ty::ValTree as reasonably parallel
2023-09-19Merge from rustcThe Miri Conjob Bot-3065/+6264
2023-09-19Preparing for merge from rustcThe Miri Conjob Bot-1/+1
2023-09-19Auto merge of #115644 - danakj:catalyst-asan, r=cjgillot,thomccbors-0/+5
Enable ASAN/LSAN/TSAN for *-apple-ios-macabi The -macabi targets are iOS running on MacOS, and they use the runtime libraries for MacOS, thus they have the same sanitizers available as the *-apple-darwin targets. This is based on the work of https://github.com/rust-lang/rust/commit/aacf3213b142f074999429eab767ef7b53c3a1a5. Closes #113935.
2023-09-19Rollup merge of #115943 - ehuss:compiletest-errors, r=compiler-errorsMatthias Krüger-8/+8
compiletest: Don't swallow some error messages. This updates some error handling in compiletest to display the underlying error rather than discarding it. There have been cases where the lack of error information makes it difficult to understand what went wrong.
2023-09-19Rollup merge of #115869 - ferrocene:pa-fix-tests-cargo-remap, r=compiler-errorsMatthias Krüger-0/+10
Avoid blessing cargo deps's source code in ui tests Before this PR, the source code of dependencies was included in UI test error messages whenever possible. Unfortunately, "whenever possible" means in some cases the source code wouldn't be injected, resulting in a test failure. One such case is when `$CARGO_HOME` is remapped to something that is not present on disk [^1]. As the remapped path doesn't exist on disk, the source code wouldn't be showed in `tests/ui/issues/issue-21763.rs`: ```diff = note: required for `hashbrown::raw::RawTable<(Rc<()>, Rc<()>)>` to implement `Send` note: required because it appears within the type `HashMap<Rc<()>, Rc<()>, RandomState>` --> $HASHBROWN_SRC_LOCATION - | -LL | pub struct HashMap<K, V, S = DefaultHashBuilder, A: Allocator + Clone = Global> { - | ^^^^^^^ note: required because it appears within the type `HashMap<Rc<()>, Rc<()>>` --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL note: required by a bound in `foo` ``` This PR fixes the problem by always hiding dependencies source code in the error messages generated during UI tests. This is implemented with a new internal flag, `-Z ignore-directory-in-diagnostics-source-blocks=$path`, which compiletest passes during UI tests. Once this is merged, remapping the Cargo home will be supported. This PR is best reviewed commit-by-commit. [^1]: After being puzzled for a bit, I discovered why this never impacted `rust-lang/rust`: we don't remap `$CARGO_HOME` :sweat_smile:. Instead, we set `$CARGO_HOME` to `/cargo` in CI, which sort-of-but-not-really achieves the same effect.
2023-09-18Auto merge of #115940 - matthiaskrgr:rollup-5ps9ln1, r=matthiaskrgrbors-19/+0
Rollup of 6 pull requests Successful merges: - #109409 (Add `minmax{,_by,_by_key}` functions to `core::cmp`) - #115494 (get rid of duplicate primitive_docs) - #115663 (ci: actions/checkout@v3 to actions/checkout@v4) - #115762 (Explain revealing of opaque types in layout_of ParamEnv) - #115891 (simplify inject_impl_of_structural_trait) - #115932 (Expand infra-ci reviewer list) r? `@ghost` `@rustbot` modify labels: rollup
2023-09-18Auto merge of #115748 - RalfJung:post-mono, r=oli-obkbors-11/+10
move required_consts check to general post-mono-check function This factors some code that is common between the interpreter and the codegen backends into shared helper functions. Also as a side-effect the interpreter now uses the same `eval` functions as everyone else to get the evaluated MIR constants. Also this is in preparation for another post-mono check that will be needed for (the current hackfix for) https://github.com/rust-lang/rust/issues/115709: ensuring that all locals are dynamically sized. I didn't expect this to change diagnostics, but it's just cycle errors that change. r? `@oli-obk`
2023-09-18compiletest: Don't swallow some error messages.Eric Huss-8/+8
2023-09-18Rollup merge of #115494 - RalfJung:primitive_docs, r=Mark-SimulacrumMatthias Krüger-19/+0
get rid of duplicate primitive_docs Having this duplicate makes editing that file very annoying. And at least locally the generated docs still look perfectly fine...
2023-09-18Auto merge of #115927 - lnicola:sync-from-ra, r=lnicolabors-2740/+5763
:arrow_up: `rust-analyzer` r? `@ghost`
2023-09-18Prototype using const generic for simd_shuffle IDX arrayOli Scherer-2/+36
2023-09-18Auto merge of #115795 - Kobzol:opt-dist-custom, r=Mark-Simulacrumbors-270/+348
Refactor `opt-dist` to simplify local building This PR refactors the `opt-dist` tool to make it easier to invoke it locally, outside of CI, and thus simplify building PGO/BOLT optimized `rustc` builds e.g. for distro maintainers. It should also make it easier to run the PGO/BOLT workflow locally e.g. to profile performance or debug issues (looking at you, https://github.com/rust-lang/rust/pull/115554).
2023-09-18Enable ASAN/LSAN/TSAN for *-apple-ios-macabidanakj-0/+5
The -macabi targets are iOS running on MacOS, and they use the runtime libraries for MacOS, thus they have the same sanitizers available as the *-apple-darwin targets.
2023-09-18Fix build on WindowsJakub Beránek-0/+1
2023-09-18Merge commit '258b15c506a2d3ad862fd17ae24eaf272443f477' into sync-from-raLaurențiu Nicola-2740/+5763
2023-09-18get rid of duplicate primitive_docsRalf Jung-19/+0
2023-09-18Update cargoWeihang Lo-0/+0
2023-09-17Rollup merge of #115477 - kellerkindt:stabilized_int_impl, r=dtolnayDylan DPC-1/+1
Stabilize the `Saturating` type Closes #87920 Closes #92354 Stabilization report https://github.com/rust-lang/rust/issues/87920#issuecomment-1652346124 FCP https://github.com/rust-lang/rust/issues/87920#issuecomment-1676438885
2023-09-16miri: reduce code duplication in SSE2 pmulh.w and pmulhu.wEduardo Sánchez Muñoz-27/+27
Not really a saving in terms of lines of code, but at least the logic is de-duplicated
2023-09-16miri: reduce code duplication in SSE2 pavg.b and pavg.wEduardo Sánchez Muñoz-40/+54
2023-09-16miri: fix commentEduardo Sánchez Muñoz-1/+1
2023-09-16miri: reduce code duplication in SSE2 cvtpd2ps/cvtps2pdEduardo Sánchez Muñoz-35/+14
2023-09-16miri: reduce code duplication in SSE/SSE2 cvt{,t}s{s,d}2si{,64}Eduardo Sánchez Muñoz-62/+14
2023-09-16miri: use `copy_op` in `unary_op_ss`Eduardo Sánchez Muñoz-4/+5
2023-09-16miri: reduce code duplication in SSE cvtsi2ss/cvtsi642ssEduardo Sánchez Muñoz-37/+12
2023-09-16miri: reduce code duplication in SSE/SSE2 bin_op_* functionsEduardo Sánchez Muñoz-306/+186
2023-09-16triagebot exclude_labels -> exclude_titlesPeter Jaszkowiak-4/+4
2023-09-16Auto merge of #115829 - notriddle:notriddle/rustdoc-theme-css-merge, ↵bors-16/+129
r=GuillaumeGomez rustdoc: merge theme css into rustdoc.css Based on https://github.com/rust-lang/rust/pull/115812#issuecomment-1717960119 Having them in separate files used to make more sense, before the migration to CSS variables made the theme files as small as they are nowadays. This is already how docs.rs and mdBook do it. WebPageTest comparison page: https://www.webpagetest.org/video/compare.php?tests=230913_AiDc3F_B9E,230913_AiDc7G_B9B Filmstrip comparison: ![image](https://github.com/rust-lang/rust/assets/1593513/7ccad27b-7497-47ee-94c0-1a701b69c0c2) Old waterfall: ![image](https://github.com/rust-lang/rust/assets/1593513/7a6e4375-226d-4205-8871-a4d775a70748) New waterfall: ![image](https://github.com/rust-lang/rust/assets/1593513/e29112e3-84f7-417d-a250-cd6c10fa50f5)
2023-09-16Update cargoWeihang Lo-0/+0
2023-09-15rustdoc: merge theme css into rustdoc.cssMichael Howell-16/+129
Based on https://github.com/rust-lang/rust/pull/115812#issuecomment-1717960119 Having them in separate files used to make more sense, before the migration to CSS variables made the theme files as small as they are nowadays. This is already how docs.rs and mdBook do it.
2023-09-15avoid blessing cargo deps's source code in ui testsPietro Albini-0/+10
2023-09-15Auto merge of #115851 - Alexendoo:clippy-doc-hidden-headers, r=flip1995bors-1/+20
Ignore `#[doc(hidden)]` functions in clippy doc lints Fixes https://github.com/rust-lang/rust-clippy/issues/11501 The implementation before #115689 had a check for unsugared doc comments that also happened to catch `#[doc(hidden)]`, this adds the check back in more explicitly https://github.com/rust-lang/rust/blob/852bf4e51bf260550cd1a280d2146f1c0641b1e8/src/tools/clippy/clippy_lints/src/doc.rs#L526-L529 r? `@flip1995`
2023-09-15Merge from rustcThe Miri Conjob Bot-1772/+4847
2023-09-15Preparing for merge from rustcThe Miri Conjob Bot-1/+1
2023-09-14don't point at const usage site for resolution-time errorsRalf Jung-6/+6
also share the code that emits the actual error
2023-09-14move required_consts check to general post-mono-check functionRalf Jung-5/+4
2023-09-14Auto merge of #115677 - matthewjasper:let-expr-recovery, r=b-naberbors-4/+4
Improve invalid let expression handling - Move all of the checks for valid let expression positions to parsing. - Add a field to ExprKind::Let in AST/HIR to mark whether it's in a valid location. - Suppress some later errors and MIR construction for invalid let expressions. - Fix a (drop) scope issue that was also responsible for #104172. Fixes #104172 Fixes #104868
2023-09-14Ignore `#[doc(hidden)]` functions in clippy doc lintsAlex Macleod-1/+20
2023-09-14Auto merge of #115817 - fee1-dead-contrib:fix-codegen, r=oli-obkbors-1/+1
treat host effect params as erased in codegen This fixes the changes brought to codegen tests when effect params are added to libcore, by not attempting to monomorphize functions that get the host param by being `const fn`. r? `@oli-obk`
2023-09-14fix clippy (and MIR printing) handling of ConstValue::Indirect slicesRalf Jung-13/+4
2023-09-14treat host effect params as erased generics in codegenDeadbeef-1/+1
This fixes the changes brought to codegen tests when effect params are added to libcore, by not attempting to monomorphize functions that get the host param by being `const fn`.
2023-09-14make it more clear which functions create fresh AllocIdRalf Jung-6/+6
2023-09-14cleanup op_to_const a bit; rename ConstValue::ByRef → IndirectRalf Jung-2/+2