- 15 9月, 2021 1 次提交
-
-
由 bors 提交于
Rename "--display-warnings" to "--display-doctest-warnings" Fixes #41574. cc `@ollie27` r? `@kinnison`
-
- 14 9月, 2021 14 次提交
-
-
由 Guillaume Gomez 提交于
-
由 Guillaume Gomez 提交于
-
由 bors 提交于
Rollup of 7 pull requests Successful merges: - #88033 (Add links for primitives in "jump to definition" feature) - #88722 (Make `UnsafeCell::get_mut` const) - #88851 (Fix duplicate bounds for const_trait_impl) - #88859 (interpreter PointerArithmetic: use new Size helper methods) - #88885 (Fix jump def background) - #88894 (Improve error message for missing trait in trait impl) - #88896 (Reduce possibility of flaky tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
-
由 bors 提交于
Enum should prefer discriminant zero for niche Given an enum with unassigned zero-discriminant, rust should prefer it for niche selection. Zero as discriminant for `Option<Enum>` makes it possible for LLVM to optimize resulting asm. - Eliminate branch when expected value coincides. - Use smaller instruction `test eax, eax` instead of `cmp eax, ?` - Possible interaction with zeroed memory? Example: ```rust pub enum Size { One = 1, Two = 2, Three = 3, } pub fn handle(x: Option<Size>) -> u8 { match x { None => {0} Some(size) => {size as u8} } } ``` In this case discriminant zero is available as a niche. Above example on nightly: ```asm mov eax, edi cmp al, 4 jne .LBB0_2 xor eax, eax .LBB0_2: ret ``` PR: ```asm mov eax, edi ret ``` I created this PR because I had a performance regression when I tried to use an enum to represent legal grapheme byte-length for utf8. Using an enum instead of `NonZeroU8` [here](https://github.com/bonega/yore/blob/d683304f5dfe2e99f769e6ab8adf8d60a0d1d9b3/src/internal/decoder_incomplete.rs#L90) resulted in a performance regression of about 5%. I consider this to be a somewhat realistic benchmark. Thanks to `@ogoffart` for pointing me in the right direction! Edit: Updated description
-
由 Andreas Liljeqvist 提交于
-
由 Guillaume Gomez 提交于
Reduce possibility of flaky tests As asked in https://github.com/rust-lang/rust/pull/88885. r? ``@camelid``
-
由 Guillaume Gomez 提交于
Improve error message for missing trait in trait impl Fixes #88818. For the following example: ```rust struct S { } impl for S { } ``` the current output is: ``` error: missing trait in a trait impl --> t1.rs:2:5 | 2 | impl for S { } | ^ ``` With my changes, I get: ``` error: missing trait in a trait impl --> t1.rs:2:5 | 2 | impl for S { } | ^ | help: add a trait here | 2 | impl Trait for S { } | +++++ help: for an inherent impl, drop this `for` | 2 - impl for S { } 2 + impl S { } | ```
-
由 Guillaume Gomez 提交于
Fix jump def background Fixes #88870. I somehow badly wrote the color in #88111. r? ``@camelid``
-
由 Guillaume Gomez 提交于
interpreter PointerArithmetic: use new Size helper methods
-
由 Guillaume Gomez 提交于
Fix duplicate bounds for const_trait_impl Fixes #88383. Compare the constness of the candidates before winnowing and removing a `~const` `BoundCandidate`.
-
由 Guillaume Gomez 提交于
Make `UnsafeCell::get_mut` const
-
由 Guillaume Gomez 提交于
Add links for primitives in "jump to definition" feature Follow-up of #84176. I created a function `primitive_from_str` which is code that was originally in `collect_intra_doc_links::resolve_primitive` to prevent code duplication. I also created the `primitive_link_url` function which is somewhat similar to `primitive_link` but too much different to merge both of them. r? ``@jyn514``
-
由 Guillaume Gomez 提交于
* Add test for jump-to-def links background color
-
由 bors 提交于
Use smaller spans for some structured suggestions Use more accurate suggestion spans for * argument parse error * fully qualified path * missing code block type * numeric casts
-
- 13 9月, 2021 13 次提交
-
-
由 Guillaume Gomez 提交于
-
由 Guillaume Gomez 提交于
-
由 bors 提交于
Update cargo 6 commits in 18751dd3f238d94d384a7fe967abfac06cbfe0b9..e515c3277bf0681bfc79a9e763861bfe26bb05db 2021-09-01 14:26:00 +0000 to 2021-09-08 14:32:15 +0000 - Remove log output that may leak tokens (rust-lang/cargo#9873) - rev = "refs/pull/𑑛/head" (rust-lang/cargo#9859) - Update suggestion message on bad project name error (rust-lang/cargo#9877) - clarify what goes into "*-sys" crates (rust-lang/cargo#9871) - Improve error message when unable to initialize git index repo (rust-lang/cargo#9869) - Use serde_json to generate cargo_vcs_info.json (rust-lang/cargo#9865)
-
由 bors 提交于
Allow missing code examples in trait impls. Excludes Trait implementations from the items that need to have doc code examples when using the `rustdoc::missing_doc_code_examples` lint. For details see #88741 fixes #88741 r? `@jyn514`
-
由 bors 提交于
ARMv6K Nintendo 3DS Tier 3 target added Addition of the target specifications to build .elf files for Nintendo 3DS (ARMv6K, Horizon). Requires devkitARM 3DS toolkit for system libraries and arm-none-eabi-gcc linker.
-
由 bors 提交于
Update Clippy dependencies without patch versions Trial run for https://github.com/rust-lang/rust-clippy/pull/7606
-
由 bors 提交于
Introduce NullOp::AlignOf This PR introduces `Rvalue::NullaryOp(NullOp::AlignOf, ty)`, which will be lowered from `align_of`, similar to `size_of` lowering to `Rvalue::NullaryOp(NullOp::SizeOf, ty)`. The changes are originally part of #88700 but since it's not dependent on other changes and could have performance impact on its own, it's separated into its own PR.
-
由 Gary Guo 提交于
-
由 Gary Guo 提交于
-
由 bors 提交于
Add -Z panic-in-drop={unwind,abort} command-line option This PR changes `Drop` to abort if an unwinding panic attempts to escape it, making the process abort instead. This has several benefits: - The current behavior when unwinding out of `Drop` is very unintuitive and easy to miss: unwinding continues, but the remaining drops in scope are simply leaked. - A lot of unsafe code doesn't expect drops to unwind, which can lead to unsoundness: - https://github.com/servo/rust-smallvec/issues/14 - https://github.com/bluss/arrayvec/issues/3 - There is a code size and compilation time cost to this: LLVM needs to generate extra landing pads out of all calls in a drop implementation. This can compound when functions are inlined since unwinding will then continue on to process drops in the callee, which can itself unwind, etc. - Initial measurements show a 3% size reduction and up to 10% compilation time reduction on some crates (`syn`). One thing to note about `-Z panic-in-drop=abort` is that *all* crates must be built with this option for it to be sound since it makes the compiler assume that dropping `Box<dyn Any>` will never unwind. cc https://github.com/rust-lang/lang-team/issues/97
-
由 Guillaume Gomez 提交于
-
由 Fabian Wolff 提交于
-
由 bors 提交于
Use a HashMap for UniverseInfo in mir borrowck Fixes #88446 r? `@nikomatsakis`
-
- 12 9月, 2021 12 次提交
-
-
由 Guillaume Gomez 提交于
-
由 bors 提交于
Rollup of 7 pull requests Successful merges: - #88336 ( Detect stricter constraints on gats where clauses in impls vs trait) - #88677 (rustc: Remove local variable IDs from `Export`s) - #88699 (Remove extra unshallow from cherry-pick checker) - #88709 (generic_const_exprs: use thir for abstract consts instead of mir) - #88711 (Rework DepthFirstSearch API) - #88810 (rustdoc: Cleanup `clean` part 1) - #88813 (explicitly link to external `ena` docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
-
由 Manish Goregaokar 提交于
explicitly link to external `ena` docs we currently do not link to the docs of `ena`: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/struct.InferCtxtInner.html#method.const_unification_table
-
由 Manish Goregaokar 提交于
rustdoc: Cleanup `clean` part 1 Split out from #88379. These commits are completely independent of each other, and each is a fairly small change (the last few are new commits; they are not from #88379): - Remove unnecessary `Cache.*_did` fields - rustdoc: Get symbol for `TyParam` directly - Create a valid `Res` in `external_path()` - Remove unused `hir_id` parameter from `resolve_type` - Fix redundant arguments in `external_path()` - Remove unnecessary `is_trait` argument - rustdoc: Cleanup a pattern match in `external_generic_args()` r? ``@jyn514``
-
由 Manish Goregaokar 提交于
Rework DepthFirstSearch API This expands the API to be more flexible, allowing for more visitation patterns on graphs. This will be useful to avoid extra datasets (and allocations) in cases where the expanded DFS API is sufficient. This also fixes a bug with the previous DFS constructor, which left the start node not marked as visited (even though it was immediately returned). Commit written by ```@nikomatsakis``` originally, cherry picked from several commits in work on never type stabilization, but stands alone.
-
由 Manish Goregaokar 提交于
generic_const_exprs: use thir for abstract consts instead of mir Changes `AbstractConst` building to use `thir` instead of `mir` so that there's less chance of consts unifying when they shouldn't because lowering to mir dropped information (see `abstract-consts-as-cast-5.rs` test) r? `@lcnr`
-
由 Manish Goregaokar 提交于
Remove extra unshallow from cherry-pick checker This is already done by https://github.com/rust-lang/rust/blob/13db8440bbbe42870bc828d4ec3e965b38670277/src/ci/init_repo.sh#L32-L36 on the beta channel, and git throws an error if you attempt to unshallow an already non-shallow repository. r? ```@pietroalbini```
-
由 Manish Goregaokar 提交于
rustc: Remove local variable IDs from `Export`s Local variables can never be exported.
-
由 Manish Goregaokar 提交于
Detect stricter constraints on gats where clauses in impls vs trait I might try to see if I can do a bit more to improve these diagnostics, but any initial feedback is appreciated. I can also do any additional work in a followup PR. r? `@estebank`
-
由 bors 提交于
Update LLVM submodule This merges upstream `release/13.x` changes to our fork. In particular, this includes the bugfix https://reviews.llvm.org/D108608 (see also https://bugs.llvm.org/show_bug.cgi?id=51637). The motivation for this is fixing Rust coverage in Fuchsia: https://fxbug.dev/77427.
-
由 bors 提交于
Fix rustdoc handling of primitive items This is a complicated PR and does a lot of things. I'm willing to split it up a little more if it would help reviewing, but it would be tricky and I'd rather not unless it's necessary. ## What does this do? - Fixes https://github.com/rust-lang/rust/issues/73423. - Fixes https://github.com/rust-lang/rust/issues/79630. I'm not sure how to test this for the standard library explicitly, but you can see from some of the diffs from the `no_std` tests. I also tested it locally and it works correctly: ![image](https://user-images.githubusercontent.com/23638587/125214383-e1fdd000-e284-11eb-8048-76b5df958aad.png) - Fixes https://github.com/rust-lang/rust/issues/83083. ## Why are these changes interconnected? - Allowing anchors (https://github.com/rust-lang/rust/issues/83083) without fixing the online/offline problem (https://github.com/rust-lang/rust/issues/79630) will actually just silently discard the anchors, that's not a fix. The online/offline problem is directly related to the fragment hack; links need to go through `fn href()` to be fixed. - Technically I could fix the online/offline problem without removing the error on anchors; I am willing to separate that out if it would be helpful for reviewing. However I can't fix the anchor problem without adding docs to core, since rustdoc needs all those primitives to have docs to avoid a fallback, and currently `#![no_std]` crates don't have docs for primitives. I also can't fix the online/offline problem without removing the fragment hack, since otherwise diffs like this will be wrong for some primitives but not others: ```diff `@@` -385,7 +381,7 `@@` fn resolve_primitive_associated_item( ty::AssocKind::Const => "associatedconstant", ty::AssocKind::Type => "associatedtype", }; - let fragment = format!("{}#{}.{}", prim_ty.as_sym(), out, item_name); + let fragment = format!("{}.{}", out, item_name); (Res::Primitive(prim_ty), fragment, Some((kind.as_def_kind(), item.def_id))) }) }) ``` - Adding primitive docs to core without making any other change will cause links to go to `core` instead of `std`, even for crates with `extern crate std`. See "Breaking changes to doc(primitive)" below for why this is the case. That said, I could add some special casing to rustdoc at the same time that would let me separate this change from the others (it would fix https://github.com/rust-lang/rust/issues/73423 but still special-case intra-doc links). I'm willing to separate that out if helpful for reviewing. ### Add primitive documentation to libcore This works by reusing the same `include!("primitive_docs.rs")` file in both core and std, and then special-casing links in core to use relative links instead of intra-doc links. This doesn't use purely intra-doc links because some of the primitive docs links to items only in std; this doesn't use purely relative links because that introduces new broken links when the docs are re-exported (e.g. String's `&str` deref impl, or Vec's slice deref impl). Note that this copies the whole file to core, to avoid anyone compiling core to have to set `CARGO_PKG_NAME`. See https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Who.20should.20review.20changes.20to.20linkchecker.3F/near/249939598 for more context. It also adds a tidy check to make sure the two files are kept in sync. ### Fix inconsistent online/offline primitive docs This does four things: - Records modules with `doc(primitive)` in `cache.external_paths`. This is necessary for `href()` to find them later. - Makes `cache.primitive_locations` available to the intra-doc link pass, by refactoring out a `PrimitiveType::primitive_locations` function that only uses `TyCtxt`. - Special cases modules with `doc(primitive)` to be treated as always public for the purpose of links. - Removes the fragment hack. cc `@notriddle,` I know you added some comments about this in the code (thank you for that!) ### Breaking changes to `doc(primitive)` "Breaking" is a little misleading here - these are changes in behavior, none of them will cause code to fail to compile. Let me preface this by saying I think stabilizing `doc(primitive)` was a uniquely terrible idea. As far as I can tell, it was stabilized by oversight; it's been stable since 1.0. No one should have need to use it except the standard library, and a crater run shows that in fact no one is using it: https://github.com/rust-lang/rust/pull/87050#issuecomment-886166706. I hope to actually make `doc(primitive)` a no-op unless you opt-in with a nightly feature, which will keep crates compiling without forcing rustdoc into trying to keep somewhat arbitrary behavior guarantees; but for now, this just subtly changes some of the behavior if you use `doc(primitive)` in a dependency. That said, here are the changes: - Refactoring out `primitive_locations()` is technically a change in behavior, since it no longer looks for primitives in crates that were passed through `--extern`, but not used by the crate; however, that seems like such an unlikely edge case it's not worth dealing with. - The precedence given to primitive locations is no longer just arbitrary, it can also be inconsistent from run to run. Let me explain that more: previously, primitive locations were sorted by the `CrateNum`; the comment on that sort said "Favor linking to as local extern as possible, so iterate all crates in reverse topological order." Unfortunately, that's not actually what CrateNum tracks: it measures the order crates are loaded, not the number of intermediate crates between that dependency and the root crate. It happened to work as intended before because the compiler injects `extern crate std;` at the top of every crate, which ensured it would have the first CrateNum other than the current, but every other CrateNum was completely arbitrary (for example, `core` often had a later CrateNum than `std`). This now removes the sort on CrateNum completely and special-cases core instead. In particular, if you depend on both `std` and a crate which defines a `doc(primitive)` module, it's arbitrary whether rustdoc will use the docs from std or the ones from the other crate. cc `@alexcrichton,` you wrote this originally. cc `@rust-lang/rustdoc` cc `@rust-lang/libs` for the addition to `core` (the commit you're interested in is https://github.com/rust-lang/rust/pull/87073/commits/91346c8293bb5f41d8e1d2ec9336433664652c53)
-