- 28 5月, 2022 29 次提交
-
-
由 bors 提交于
Try to cache region_scope_tree as a query This PR will attempt to restore `region_scope_tree` as a query so that caching works again. It seems that `region_scope_tree` could be re-computed for nested items after all, which could explain the performance regression introduced by #95563. cc `@Mark-Simulacrum` `@pnkfelix` I will try to trigger a perf run here.
-
由 bors 提交于
Split dead store elimination off dest prop This splits off a part of #96451 . I've added this in as its own pass for now, so that it actually runs, can be tested, etc. In the dest prop PR, I'll stop invoking this as its own pass, so that it doesn't get invoked twice. r? `@tmiasko`
-
由 bors 提交于
Rollup of 5 pull requests Successful merges: - #94640 (Partially stabilize `(const_)slice_ptr_len` feature by stabilizing `NonNull::len`) - #97034 (Implement `Hash` for `core::alloc::Layout`) - #97327 (macros: introduce `fluent_messages` macro ) - #97448 (docs: Don't imply that OsStr on Unix is always UTF-8) - #97466 ([bootstrap] Move `sanitize_sh` from `dist` to `install`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
-
由 Dylan DPC 提交于
[bootstrap] Move `sanitize_sh` from `dist` to `install` This is the only place it's used, so there's no need for it to be public in another module. In general, `dist` shouldn't ever touch shell scripts.
-
由 Dylan DPC 提交于
docs: Don't imply that OsStr on Unix is always UTF-8 The methods in `OsStrExt` consume and return `&[u8]` and don't perform any UTF-8 checks.
-
由 Dylan DPC 提交于
macros: introduce `fluent_messages` macro Adds a new `fluent_messages` macro which performs compile-time validation of the compiler's Fluent resources (i.e. that the resources parse and don't multiply define the same messages) and generates constants that make using those messages in diagnostics more ergonomic. For example, given the following invocation of the macro.. ```rust fluent_messages! { typeck => "./typeck.ftl", } ``` ..where `typeck.ftl` has the following contents.. ```fluent typeck-field-multiply-specified-in-initializer = field `{$ident}` specified more than once .label = used more than once .label-previous-use = first use of `{$ident}` ``` ...then the macro parse the Fluent resource, emitting a diagnostic if it fails to do so... ```text error: could not parse Fluent resource --> $DIR/test.rs:35:28 | LL | missing_message => "./missing-message.ftl", | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: see additional errors emitted error: expected a message field for "missing-message" --> ./missing-message.ftl:1:1 | 1 | missing-message = | ^^^^^^^^^^^^^^^^^^ | ``` ...or generating the following code if it succeeds: ```rust pub static DEFAULT_LOCALE_RESOURCES: &'static [&'static str] = &[ include_str!("./typeck.ftl"), ]; mod fluent_generated { mod typeck { pub const field_multiply_specified_in_initializer: DiagnosticMessage = DiagnosticMessage::fluent("typeck-field-multiply-specified-in-initializer"); pub const field_multiply_specified_in_initializer_label_previous_use: DiagnosticMessage = DiagnosticMessage::fluent_attr( "typeck-field-multiply-specified-in-initializer", "previous-use-label" ); } } ``` When emitting a diagnostic, the generated constants can be used as follows: ```rust let mut err = sess.struct_span_err( span, fluent::typeck::field_multiply_specified_in_initializer ); err.span_label( span, fluent::typeck::field_multiply_specified_in_initializer_label ); err.span_label( previous_use_span, fluent::typeck::field_multiply_specified_in_initializer_label_previous_use ); err.emit(); ``` I'd like to reduce the verbosity of referring to labels/notes/helps with this scheme (though it wasn't much better before), but I'll leave that for a follow-up. r? `@oli-obk` cc `@pvdrz` `@compiler-errors`
-
由 Dylan DPC 提交于
Implement `Hash` for `core::alloc::Layout` This was brought up on [reddit](https://www.reddit.com/r/rust/comments/uoypui/the_standard_library_types_are_good_except_when/), and I don't see why Layout shouldn't implement `Hash`. Feel free to comment if I am wrong though :)
-
由 Dylan DPC 提交于
Partially stabilize `(const_)slice_ptr_len` feature by stabilizing `NonNull::len` This PR partially stabilizes features `const_slice_ptr_len` and `slice_ptr_len` by only stabilizing `NonNull::len`. This partial stabilization is tracked under features `slice_ptr_len_nonnull` and `const_slice_ptr_len_nonnull`, for which this PR can serve as the tracking issue. To summarize the discussion from #71146 leading up to this partial stabilization request: It's currently a bit footgunny to obtain the length of a raw slice pointer, stabilization of `NonNull:len` will help with removing these footguns. Some example footguns are: ```rust /// # Safety /// The caller must ensure that `ptr`: /// 1. does not point to memory that was previously allocated but is now deallocated; /// 2. is within the bounds of a single allocated object; /// 3. does not to point to a slice for which the length exceeds `isize::MAX` bytes; /// 4. points to a properly aligned address; /// 5. does not point to uninitialized memory; /// 6. does not point to a mutably borrowed memory location. pub unsafe fn ptr_len<T>(ptr: core::ptr::NonNull<[T]>) -> usize { (&*ptr.as_ptr()).len() } ``` A slightly less complicated version (but still more complicated than it needs to be): ```rust /// # Safety /// The caller must ensure that the start of `ptr`: /// 1. does not point to memory that was previously allocated but is now deallocated; /// 2. must be within the bounds of a single allocated object. pub unsafe fn ptr_len<T>(ptr: NonNull<[T]>) -> usize { (&*(ptr.as_ptr() as *const [()])).len() } ``` This PR does not stabilize `<*const [T]>::len` and `<*mut [T]>::len` because the tracking issue #71146 list a potential blocker for these methods, but this blocker [does not apply](https://github.com/rust-lang/rust/issues/71146#issuecomment-808735714) to `NonNull::len`. We should probably also ping the [Constant Evaluation WG](https://github.com/rust-lang/const-eval) since this PR includes a `#[rustc_allow_const_fn_unstable(const_slice_ptr_len)]`. My instinct here is that this will probably be okay because the pointer is not actually dereferenced and `len()` does not touch the address component of the pointer, but would be best to double check :) One potential down-side was raised that stabilizing `NonNull::len` could lead to encouragement of coding patterns like: ``` pub fn ptr_len<T>(ptr: *mut [T]) -> usize { NonNull::new(ptr).unwrap().len() } ``` which unnecessarily assert non-nullness. However, these are much less of a footgun than the above examples and this should be resolved when `slice_ptr_len` fully stabilizes eventually.
-
由 bors 提交于
Fix `x dist --stage 1 src/tools/rust-analyzer` Previously, this would break because the submodule wasn't checked out. Fixes https://github.com/rust-lang/rust/issues/97464.
-
由 bors 提交于
Add suggestion for relaxing static lifetime bounds on dyn trait impls in NLL This PR introduces suggestions for relaxing static lifetime bounds on impls of dyn trait items for NLL similar to what is already available in lexical region diagnostics. Fixes https://github.com/rust-lang/rust/issues/95701 r? `@estebank`
-
由 bors 提交于
Pass Context as a &mut to allow to remove RefCell fields Fixes #90323. r? `@notriddle`
-
由 Jakob Degen 提交于
-
由 bors 提交于
Rollup of 6 pull requests Successful merges: - #95214 (Remove impossible panic note from `Vec::append`) - #97411 (Print stderr consistently) - #97453 (rename `TyKind` to `RegionKind` in comment in rustc_middle) - #97457 (Add regression test for #81899) - #97458 (Modify `derive(Debug)` to use `Self` in struct literal to avoid redundant error) - #97462 (Add more eslint rules) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
-
由 Matthias Krüger 提交于
Add more eslint rules The last one is the most useful of this batch. :) Here are the links for the eslint rules: * [arrow-parens](https://eslint.org/docs/rules/arrow-parens) * [no-unused-vars](https://eslint.org/docs/rules/no-unused-vars) * [eqeqeq](https://eslint.org/docs/rules/eqeqeq) r? `@notriddle`
-
由 Matthias Krüger 提交于
Modify `derive(Debug)` to use `Self` in struct literal to avoid redundant error Reduce verbosity in #97343.
-
由 Matthias Krüger 提交于
Add regression test for #81899 Closes #81899 r? `@compiler-errors`
-
由 Matthias Krüger 提交于
rename `TyKind` to `RegionKind` in comment in rustc_middle
-
由 Matthias Krüger 提交于
Print stderr consistently Solves https://github.com/rust-lang/rust/issues/96712 I tried to follow what I perceived as the general consensus for error messages in boostrap i.e messages that were .. * resulting from an Err(...) => * literally called as "Error: ...." * by the end of the block scope forced to run a panic! or process::exit with a guaranteed non-zero error code.
-
由 Matthias Krüger 提交于
Remove impossible panic note from `Vec::append` Neither the number of elements in a vector can overflow a `usize`, nor can the amount of elements in two vectors.
-
由 Joshua Nelson 提交于
This is the only place it's used, so there's no need for it to be public in another module. In general, `dist` shouldn't ever touch shell scripts.
-
由 Joshua Nelson 提交于
Previously, this would break because the submodule wasn't checked out.
-
由 Guillaume Gomez 提交于
-
由 Guillaume Gomez 提交于
-
由 Guillaume Gomez 提交于
-
由 Guillaume Gomez 提交于
-
由 bors 提交于
Update jemalloc to v5.3 Now that `jemalloc` version 5.3 has been released, this PR updates `tikv-jemalloc-sys` to the corresponding release. The crates.io publishing issue seems to have been resolved for the `jemalloc-sys` package, and version 5.3.0 is now also available under the historical name (and should become the preferred crate to be used). Therefore, this PR also switches back to using `jemalloc-sys` instead of `tikv-jemalloc-sys`.
-
由 Esteban Küber 提交于
#97343
-
由 Esteban Küber 提交于
-
由 Yuki Okushi 提交于
-
- 27 5月, 2022 11 次提交
-
-
由 lcnr 提交于
-
由 bors 提交于
Move various checks to typeck so them failing causes the typeck result to get tainted Fixes #69487 fixes #79047 cc `@RalfJung` this gets rid of the `Transmute` invalid program error variant
-
由 Xiretza 提交于
The methods in `OsStrExt` consume and return `&[u8]` and don't perform any UTF-8 checks.
-
由 Oli Scherer 提交于
-
由 bors 提交于
Fix multiline attributes processing in doctest Fixes #97440. It seems like the call to `check_if_attr_is_complete` is not provided with the correct argument: the pending attribute should be passed, while the current line is actually being passed. This causes any attribute with more than 2 lines to fail and produces ICE when running through doctest.
-
由 Nicholas Nethercote 提交于
The part of it dealing with types obfuscates and makes the code less concise. This commit removes that part.
-
由 Nicholas Nethercote 提交于
-
由 Nicholas Nethercote 提交于
Because it's easy to confuse with `bridge`.
-
由 Nicholas Nethercote 提交于
There is some non-obvious information required to understand them.
-
由 Nicholas Nethercote 提交于
`reverse_encode` isn't necessary to please the borrow checker, it's to match the ordering done by `reverse_decode`.
-