about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2023-09-21fmtThe Miri Conjob Bot-4/+1
2023-09-21Merge from rustcThe Miri Conjob Bot-1353/+1653
2023-09-21Preparing for merge from rustcThe Miri Conjob Bot-1/+1
2023-09-21try to avoid some layout_of callsRalf Jung-34/+33
2023-09-20Delete obsolete --disable-per-crate-search rustdoc flagDavid Tolnay-7/+0
2023-09-21Make ui-fulldeps --stage=1 builds in CIMichael Goulet-9/+12
2023-09-21Fix ui-fulldeps --stage=1 with -Zignore-directory-in-diagnostics-source-blocksMichael Goulet-8/+11
2023-09-21Rollup merge of #116011 - GuillaumeGomez:update-browser-ui, r=notriddleMatthias Krüger-1/+1
Update browser-ui-test version to 0.16.10 Following https://github.com/GuillaumeGomez/browser-UI-test/pull/539, it contains generated JS improvements and also a fix in a diagnostic. r? `@notriddle`
2023-09-21Rollup merge of #114394 - joshtriplett:style-guide-as, r=calebcartwrightMatthias Krüger-8/+20
style-guide: Document formatting of `as` casts (mostly like a binary operator) `as` casts currently get formatted like a binary operator, except that the second line can stack several `as` casts rather than breaking them each onto their own line. Document this. As far as I can tell (cc `@calebcartwright` for verification), this is not a 2024 edition change, it just documents current behavior.
2023-09-20Update browser-ui-test version to 0.16.10Guillaume Gomez-1/+1
2023-09-20interpret: more consistently use ImmTy in operators and castsRalf Jung-65/+65
2023-09-20Bugfix/comment duplication (#5913)GambitingMan-1/+1
* Fix #5871 * Only idempotence test is necessary * Update src/expr.rs Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com> --------- Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
2023-09-20Auto merge of #115870 - RalfJung:const-value-slice, r=oli-obkbors-1/+1
adjust ConstValue::Slice to work for arbitrary slice types valtrees have already been assuming that this works; this PR makes it a reality. Also further restrict `ConstValue::Slice` to what it is actually used for; this even shrinks `ConstValue` from 32 to 24 bytes which is a nice win. :) The alternative to this approach is to make `ConstValue::Slice` work really only for `&str`/`&[u8]` literals, and never return it in `op_to_const`. That would make `op_to_const` very clean. We could then even remove the `meta` field; the length would always be `data.inner().len()`. We could *almost* just use a `Symbol` instead of a `ConstAllocation`, but we have to support byte strings and there doesn't seem to be an interned representation of them (or rather, `ConstAllocation` *is* their interned representation). In this world, valtrees of slice reference types would then become noticeably more expensive to turn into a `ConstValue` -- but does that matter? Specifically for `&str`/`&[u8]` we could still use the optimized representation if we wanted. If byte strings were already interned somewhere I'd gravitate towards the alternative, but the way things stand, we need a `ConstAllocation` case anyway to support byte strings, and then we might as well support arbitrary slices. (Or we say that byte strings don't get an optimized representation at all. Such a performance cliff between `str` and byte strings is probably unexpected, though due to the lack of interning for byte strings I think there might already be a performance cliff there.)
2023-09-20Auto merge of #116006 - GuillaumeGomez:rollup-elrbjd4, r=GuillaumeGomezbors-7/+21
Rollup of 5 pull requests Successful merges: - #115566 (clean up unneeded `ToPredicate` impls) - #115962 (coverage: Remove debug code from the instrumentor) - #115988 (rustdoc: add test cases, and fix, search tabs layout jank) - #115991 (Ensure `build/tmp` exists in `rustdoc_themes::get_themes`) - #115997 (RELEASES.md: Add missing patch releases) r? `@ghost` `@rustbot` modify labels: rollup
2023-09-20Rollup merge of #115991 - ferrocene:rustdoc-themes, r=pietroalbiniGuillaume Gomez-1/+2
Ensure `build/tmp` exists in `rustdoc_themes::get_themes` This causes failures in ferrocene's CI as `build/tmp` might not exist at this point, causing the following expect to fail here https://github.com/rust-lang/rust/blob/4b91288484569dd59c9a996ae45e08ae9527abc1/src/tools/rustdoc-themes/main.rs#L24
2023-09-20Rollup merge of #115988 - notriddle:notriddle/search-tab-layout, ↵Guillaume Gomez-6/+19
r=GuillaumeGomez rustdoc: add test cases, and fix, search tabs layout jank ## Before ### Resizing https://github.com/rust-lang/rust/assets/1593513/24bb5f2b-f6bd-4ed8-91e1-f9ff63d1acee ### Typing https://github.com/rust-lang/rust/assets/1593513/145f53e1-42eb-4b2a-adba-7c9ab44b0aa4 ## After ### Resizing https://github.com/rust-lang/rust/assets/1593513/acc10a55-e83e-43e6-8604-5dfcb9ae3141 ### Typing https://github.com/rust-lang/rust/assets/1593513/09d6d389-e24f-428f-933f-83d9075f15a2
2023-09-20rustdoc: add comment about numeric spacingMichael Howell-0/+4
2023-09-20Auto merge of #115975 - mkroening:reduce-atty, r=davidtwcobors-2/+2
dependencies: reduce the amount of crates pulling in atty It would be nice to have only one `hermit-abi` in `Cargo.lock` (https://github.com/rust-lang/rust/pull/107405#issuecomment-1427116590). The only crate pulling in the old `hermit-abi` version is `atty`, which is unmaintained. This PR upgrades three dependencies, which then no longer depend on `atty`: * `Cargo.lock`: `colored v2.0.0 -> v2.0.4` * `Cargo.lock`: `tracing-tree v0.2.3 -> v0.2.4` * Miri: `env_logger 0.9.3 -> 0.10.0` The only dependency chain left that pulls in `hermit-abi 0.1.19` is: `hermit-abi 0.1.19` -> `atty 0.2.14` -> `env_logger 0.7.1` -> `jsonpath_lib 0.2.6` -> `jsondocck 0.1.0` (src/tools/jsondocck) Replacing jsondocck with jsondocckng is tracked in https://github.com/rust-lang/rust/issues/94140.
2023-09-20Auto merge of #115827 - eduardosm:miri-sse-reduce-code-dup, r=RalfJungbors-521/+318
miri: reduce code duplication in some SSE/SSE2 intrinsics Reduces code duplication in the Miri implementation of some SSE and SSE2 using generics and rustc_const_eval helper functions. There are also some other minor changes. r? `@RalfJung`
2023-09-20Ensure `build/tmp` exists in `rustdoc_themes::get_themes`Lukas Wirth-1/+2
2023-09-19rustdoc: add test cases, and fix, search tabsMichael Howell-6/+15
2023-09-20ignore host effect params in rustdocDeadbeef-0/+1
2023-09-20Auto merge of #115959 - nikic:update-llvm-13, r=cuviperbors-0/+0
Update to LLVM 17.0.0 This rebases our LLVM fork to 17.0.0. Fixes #115681.
2023-09-19Auto merge of #113955 - cjgillot:name-apit, r=WaffleLapkinbors-1/+1
Pretty-print argument-position impl trait to name it. This removes a corner case. RPIT and TAIT keep having no name, and it would be wrong to use the one in HIR (Ident::empty), so I make this case ICE.
2023-09-19Document type field in json diagnostics.Jeremy Fitzhardinge-3/+11
2023-09-19Rollup merge of #115957 - cuishuang:master, r=GuillaumeGomezGuillaume Gomez-1/+1
fix mismatched symbols
2023-09-19Rollup merge of #115947 - ↵Guillaume Gomez-117/+185
GuillaumeGomez:custom_code_classes_in_docs-warning, r=notriddle Custom code classes in docs warning Fixes https://github.com/rust-lang/rust/issues/115938. This PR does two things: 1. Unless the `custom_code_classes_in_docs` feature is enabled, it will use the old codeblock tag parser. 2. If there is a codeblock tag that starts with a `.`, it will emit a behaviour change warning. Hopefully this is the last missing part for this feature until stabilization. Follow-up of https://github.com/rust-lang/rust/pull/110800. r? `@notriddle`
2023-09-19Rollup merge of #113383 - joshtriplett:style-bugs, r=compiler-errorsGuillaume Gomez-0/+13
style-guide: Add section on bugs, and resolving bugs
2023-09-19adjust constValue::Slice to work for arbitrary slice typesRalf Jung-1/+1
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-19Allow more characters in custom classesGuillaume Gomez-12/+45
2023-09-19Auto merge of #115865 - RalfJung:mir-mod, r=oli-obkbors-7/+6
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-19Return early in `check_custom_code_classes` check if the feature is enabledGuillaume Gomez-1/+5
2023-09-19fix mismatched symbolscui fliter-1/+1
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-09-19Rollup merge of #112725 - notriddle:notriddle/advanced-search, r=GuillaumeGomezGuillaume Gomez-460/+882
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-19Update to LLVM 17.0.0Nikita Popov-0/+0
This rebases our LLVM fork to 17.0.0. Fixes #115681.
2023-09-19move ConstValue into mirRalf Jung-7/+6
this way we have mir::ConstValue and ty::ValTree as reasonably parallel
2023-09-19Auto merge of #104101 - betrusted-io:xous-libstd-initial, r=bjorn3bors-1/+4
Add initial libstd support for Xous This patchset adds some minimal support to the tier-3 target `riscv32imac-unknown-xous-elf`. The following features are supported: * alloc * thread creation and joining * thread sleeping * thread_local * panic_abort * mutex * condvar * stdout Additionally, internal support for the various Xous primitives surrounding IPC have been added as part of the Xous FFI. These may be exposed as part of `std::os::xous::ffi` in the future, however for now they are not public. This represents the minimum viable product. A future patchset will add support for networking and filesystem support.
2023-09-19Merge from rustcThe Miri Conjob Bot-3704/+7861
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/+10
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 #115949 - GuillaumeGomez:update-browser-ui-test, r=notriddleMatthias Krüger-1/+1
Update browser-ui-test version It includes the fix from `@notriddle` (https://github.com/GuillaumeGomez/browser-UI-test/pull/537). r? `@notriddle`
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 #115931 - GuillaumeGomez:remove-empty-h2, r=notriddleMatthias Krüger-5/+6
Move mobile topbar title creation entirely into JS I was looking at potential size improvements and saw that we had an empty `h2` tag for the mobile topbar title that was filled with JS. So at this point, I think it's fine to just completely generate it from JS, like that the w3c HTML validator will emit one less warning. r? `@notriddle`
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-21/+2
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-18Update browser-ui-test versionGuillaume Gomez-1/+1