- 26 5月, 2022 1 次提交
-
-
由 bors 提交于
Rollup of 5 pull requests Successful merges: - #97302 (Do writeback of Closure params before visiting the parent expression) - #97328 (rustc: Fix ICE in native library error reporting) - #97351 (Output correct type responsible for structural match violation) - #97398 (Add regression test for #82830) - #97400 (Fix a typo on Struct `Substructure`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
-
- 25 5月, 2022 39 次提交
-
-
由 Dylan DPC 提交于
Fix a typo on Struct `Substructure`
-
由 Dylan DPC 提交于
Add regression test for #82830 Closes #82830 r? `@compiler-errors`
-
由 Dylan DPC 提交于
Output correct type responsible for structural match violation Previously we included the outermost type that caused a structural match violation in the error message and stated that that type must be annotated with `#[derive(Eq, PartialEq)]` even if it already had that annotation. This PR outputs the correct type in the error message. Fixes https://github.com/rust-lang/rust/issues/97278
-
由 Dylan DPC 提交于
rustc: Fix ICE in native library error reporting Fixes https://github.com/rust-lang/rust/issues/97299
-
由 Dylan DPC 提交于
Do writeback of Closure params before visiting the parent expression This means that given the expression: ``` let x = |a: Vec<_>| {}; ``` We will visit the HIR node for `a` before `x`, and report the ambiguity on the former instead of the latter. This also moves writeback for struct field ids and const blocks before, but the ordering of this and walking the expr doesn't seem to matter.
-
由 bors 提交于
Extend ptr::null and null_mut to all thin (including extern) types Fixes https://github.com/rust-lang/rust/issues/93959 This change was accepted in https://rust-lang.github.io/rfcs/2580-ptr-meta.html Note that this changes the signature of **stable** functions. The change should be backward-compatible, but it is **insta-stable** since it cannot (easily, at all?) be made available only through a `#![feature(…)]` opt-in. The RFC also proposed the same change for `NonNull::dangling`, which makes sense it terms of its signature but not in terms of its implementation. `dangling` uses `align_of()` as an address. But what `align_of()` should be for extern types or whether it should be allowed at all remains an open question. This commit depends on https://github.com/rust-lang/rust/pull/93977, which is not yet part of the bootstrap compiler. So `#[cfg]` is used to only apply the change in stage 1+. As far a I know bounds cannot be made conditional with `#[cfg]`, so the entire functions are duplicated. This is unfortunate but temporary. Since this duplication makes it less obvious in the diff, the new definitions differ in: * More permissive bounds (`Thin` instead of implied `Sized`) * Different implementation * Having `rustc_allow_const_fn_unstable(const_fn_trait_bound)` * Having `rustc_allow_const_fn_unstable(ptr_metadata)`
-
由 Yuki Okushi 提交于
-
由 Yuki Okushi 提交于
-
由 bors 提交于
Rollup of 5 pull requests Successful merges: - #95953 (Modify MIR building to drop repeat expressions with length zero) - #96913 (RFC3239: Implement `cfg(target)` - Part 2) - #97233 ([RFC 2011] Library code) - #97370 (Minor improvement on else-no-if diagnostic) - #97384 (Fix metadata stats.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
-
由 Dylan DPC 提交于
Fix metadata stats. This commit: - Counts some things that weren't being counted previously, and adds an assertion that ensure everything is counted. - Reorders things so the `eprintln`s order matches the code order. - Adds percentages, and makes clear that the zero bytes count is orthogonal to the other measurements. Example of the new output: ``` 55463779 metadata bytes, of which 18054531 bytes (32.6%) are zero preamble: 30 bytes ( 0.0%) dep: 0 bytes ( 0.0%) lib feature: 17458 bytes ( 0.0%) lang item: 337 bytes ( 0.0%) diagnostic item: 1788 bytes ( 0.0%) native lib: 0 bytes ( 0.0%) foreign modules: 5113 bytes ( 0.0%) def-path table: 720180 bytes ( 1.3%) traits: 359 bytes ( 0.0%) impls: 64624 bytes ( 0.1%) incoherent_impls: 130 bytes ( 0.0%) mir: 16137354 bytes (29.1%) item: 23773099 bytes (42.9%) interpret_alloc_index: 599 bytes ( 0.0%) proc-macro-data: 0 bytes ( 0.0%) tables: 10081135 bytes (18.2%) debugger visualizers: 0 bytes ( 0.0%) exported symbols: 5666 bytes ( 0.0%) hygiene: 1539390 bytes ( 2.8%) def-path hashes: 2752564 bytes ( 5.0%) source_map: 363540 bytes ( 0.7%) final: 413 bytes ( 0.0%) ``` r? `@bjorn3`
-
由 Dylan DPC 提交于
Minor improvement on else-no-if diagnostic Don't suggest wrapping in block since it's highly likely to be a missing `if` after `else`. Also rework message a bit (open to further suggestions). cc: https://github.com/rust-lang/rust/pull/97298#discussion_r880933431 r? `@estebank`
-
由 Dylan DPC 提交于
[RFC 2011] Library code CC https://github.com/rust-lang/rust/pull/96496 Based on https://github.com/dtolnay/case-studies/tree/master/autoref-specialization. Basically creates two traits with the same method name. One trait is generic over any `T` and the other is specialized to any `T: Printable`. The compiler will then call the corresponding trait method through auto reference. ```rust fn main() { let mut a = Capture::new(); let mut b = Capture::new(); (&Wrapper(&1i32)).try_capture(&mut a); // `try_capture` from `TryCapturePrintable` (&Wrapper(&vec![1i32])).try_capture(&mut b); // `try_capture` from `TryCaptureGeneric` assert_eq!(format!("{:?}", a), "1"); assert_eq!(format!("{:?}", b), "N/A"); } ``` r? `@scottmcm`
-
由 Dylan DPC 提交于
RFC3239: Implement `cfg(target)` - Part 2 This pull-request implements the compact `cfg(target(..))` part of [RFC 3239](https://github.com/rust-lang/rust/issues/96901). I recommend reviewing this PR on a per commit basics, because of some moving parts. cc `@GuillaumeGomez` r? `@petrochenkov`
-
由 Dylan DPC 提交于
Modify MIR building to drop repeat expressions with length zero Closes #74836 . Previously, when a user wrote `[foo; 0]` we used to simply leak `foo`. The goal is to fix that. This PR changes MIR building to make `[foo; 0]` equivalent to `{ drop(foo); [] }` in all cases. Of course, this is a breaking change (see below). A crater run did not indicate any regressions though, and given that the previous behavior was almost definitely not what any user wanted, it seems unlikely that anyone was relying on this. Note that const generics are in general unaffected by this. Inserting the extra `drop` is only meaningful/necessary when `foo` is of a non-`Copy` type, and array repeat expressions with const generic repetition count must always be `Copy`. Besides the obvious change to behavior associated with the additional drop, there are three categories of examples where this also changes observable behavior. In all of these cases, the new behavior is consistent with what you would get by replacing `[foo; 0]` with `{ drop(foo); [] }`. As such, none of these give the user new powers to express more things. **No longer allowed in const (breaking)**: ```rust const _: [String; 0] = [String::new(); 0]; ``` This compiles on stable today. Because we now introduce the drop of `String`, this no longer compiles as `String` may not be dropped in a const context. **Reduced dataflow (non-breaking)**: ```rust let mut x: i32 = 0; let r = &x; let a = [r; 0]; x = 5; let _b = a; ``` Borrowck rejects this code on stable because it believes there is dataflow between `a` and `r`, and so the lifetime of `r` has to extend to the last statement. This change removes the dataflow and the above code is allowed to compile. **More const promotion (non-breaking)**: ```rust let _v: &'static [String; 0] = &[String::new(); 0]; ``` This does not compile today because `String` having drop glue keeps it from being const promoted (despite that drop glue never being executed). After this change, this is allowed to compile. ### Alternatives A previous attempt at this tried to reduce breakage by various tricks. This is still a possibility, but given that crater showed no regressions it seems unclear why we would want to introduce this complexity. Disallowing `[foo; 0]` completely is also an option, but obviously this is more of a breaking change. I do not know how often this is actually used though. r? `@oli-obk`
-
由 bors 提交于
add a deep fast_reject routine continues the work on #97136. r? `@nnethercote` Actually agree with you on the match structure
😆 let's see how that impacted perf😅 -
由 Nicholas Nethercote 提交于
This commit: - Counts some things that weren't being counted previously, and adds an assertion that ensure everything is counted. - Reorders things so the `eprintln`s order matches the code order. - Adds percentages, and makes clear that the zero bytes count is orthogonal to the other measurements. Example of the new output: ``` 55463779 metadata bytes, of which 18054531 bytes (32.6%) are zero preamble: 30 bytes ( 0.0%) dep: 0 bytes ( 0.0%) lib feature: 17458 bytes ( 0.0%) lang item: 337 bytes ( 0.0%) diagnostic item: 1788 bytes ( 0.0%) native lib: 0 bytes ( 0.0%) foreign modules: 5113 bytes ( 0.0%) def-path table: 720180 bytes ( 1.3%) traits: 359 bytes ( 0.0%) impls: 64624 bytes ( 0.1%) incoherent_impls: 130 bytes ( 0.0%) mir: 16137354 bytes (29.1%) item: 23773099 bytes (42.9%) interpret_alloc_index: 599 bytes ( 0.0%) proc-macro-data: 0 bytes ( 0.0%) tables: 10081135 bytes (18.2%) debugger visualizers: 0 bytes ( 0.0%) exported symbols: 5666 bytes ( 0.0%) hygiene: 1539390 bytes ( 2.8%) def-path hashes: 2752564 bytes ( 5.0%) source_map: 363540 bytes ( 0.7%) final: 413 bytes ( 0.0%) ```
-
由 bors 提交于
Rollup of 5 pull requests Successful merges: - #93604 (Make llvm-libunwind a per-target option) - #97026 (Change orderings of `Debug` for the Atomic types to `Relaxed`.) - #97105 (Add tests for lint on type dependent on consts) - #97323 (Introduce stricter checks for might_permit_raw_init under a debug flag ) - #97379 (Add aliases for `current_dir`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
-
由 lcnr 提交于
`match_impl` has two call sites. For one of them (within `rematch_impl`) the fast reject test isn't necessary, because any rejection would represent a compiler bug. This commit moves the fast reject test to the other `match_impl` call site, in `assemble_candidates_from_impls`. This lets us move the fast reject test outside the `probe` call in that function. This avoids the taking of useless snapshots when the fast reject test succeeds, which gives a performance win when compiling the `bitmaps` and `nalgebra` crates. Co-authored-by: Nname <n.nethercote@gmail.com>
-
由 lcnr 提交于
-
由 Dylan DPC 提交于
Add aliases for `current_dir` Aliases were added for the equivalent C/C++ APIs for POSIX and Windows. Also, I added one for `pwd` which users may be more familiar with, from the command line.
-
由 Dylan DPC 提交于
Introduce stricter checks for might_permit_raw_init under a debug flag This is intended to be a version of the strict checks tried out in #79296, but also checking number validity (under the assumption that `let _ = std::mem::uninitialized::<u32>()` is UB, which seems to be what https://github.com/rust-lang/unsafe-code-guidelines/issues/71 is leaning towards.)
-
由 Dylan DPC 提交于
Add tests for lint on type dependent on consts r? `@lcnr`
-
由 Dylan DPC 提交于
Change orderings of `Debug` for the Atomic types to `Relaxed`. This reduces synchronization between threads when debugging the atomic types. Reducing the synchronization means that executions with and without the debug calls will be more consistent, making it easier to debug. We discussed this on the Rust Community Discord with `@ibraheemdev` before.
-
由 Dylan DPC 提交于
Make llvm-libunwind a per-target option Fuchsia doesn't ship libunwind in its SDK, so we must provide it statically.
-
由 bors 提交于
Make `Lazy*<T>` types in `rustc_metadata` not care about lifetimes until decode This allows us to remove the `'tcx` lifetime from `CrateRoot`. This is necessary because of #97287, which makes the `'tcx` lifetime on `Ty` invariant instead of covariant, so [this hack](https://github.com/rust-lang/rust/blob/0a437b2ca081bc12425a3318cb66aade9824cbae/compiler/rustc_metadata/src/rmeta/decoder.rs#L89-92) no longer holds under that PR. Introduces a trait called `ParameterizedOverTcx` which has a generic associated type that allows a type to be parameterized over that lifetime. This means we can decode, for example, `Lazy<Ty<'static>>` into any `Ty<'tcx>` depending on the `TyCtxt<'tcx>` we pass into the decode function.
-
由 julio 提交于
-
由 bors 提交于
rustdoc: fix few clippy lints Fix few clippy lints: second commit - perf ones, first - other ones.
-
由 Tyler Mandry 提交于
-
由 Michael Goulet 提交于
-
由 bors 提交于
Rollup of 6 pull requests Successful merges: - #93966 (document expectations for Waker::wake) - #97266 (Make weird name lints trigger behind cfg_attr) - #97355 (Remove unused brush image) - #97358 (Update minifier-rs version to 0.1.0) - #97363 (Fix a small mistake in `SliceIndex`'s documentation) - #97364 (Fix weird indentation in continue_keyword docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
-
由 Michael Goulet 提交于
-
由 Yuki Okushi 提交于
Fix weird indentation in continue_keyword docs This format was causing every line in the code examples to have a space at the start.
-
由 Yuki Okushi 提交于
Fix a small mistake in `SliceIndex`'s documentation Originally, it said "`get_(mut_)unchecked`," but the method's actual name is `get_unchecked_mut`.
-
由 Yuki Okushi 提交于
Update minifier-rs version to 0.1.0 It fixes a bug with regex parsing. r? `@notriddle`
-
由 Yuki Okushi 提交于
Remove unused brush image r? `@notriddle`
-
由 Yuki Okushi 提交于
Make weird name lints trigger behind cfg_attr The weird name lints (`unknown_lints`, `renamed_and_removed_lints`), the lints that lint the linting, were previously not firing for lint level declarations behind `cfg_attr`, as they were only running before expansion. Now, this will give a `unknown_lints` warning: ```Rust #[cfg_attr(all(), allow(this_lint_does_not_exist))] fn foo() {} ``` Lint level declarations behind a `cfg_attr` whose condition is not applying are still ignored. So this still won't give a warning: ```Rust #[cfg_attr(any(), allow(this_lint_does_not_exist))] fn foo() {} ``` Furthermore, this PR also makes the weird name lints respect level delcarations for *them* that were hidden by `cfg_attr`, making them consistent to other lints. So this will now not issue a warning: ```Rust #[cfg_attr(all(), allow(unknown_lints))] mod foo { #[allow(does_not_exist)] fn foo() { } } ``` Fixes #97094
-
由 Yuki Okushi 提交于
document expectations for Waker::wake fixes #93961 Opened PR for a discussion on the precise wording.
-
由 Jakob Degen 提交于
-
由 bors 提交于
update Miri Fixes https://github.com/rust-lang/rust/issues/97348 r? `@ghost` Cc `@rust-lang/miri`
-