- 14 12月, 2020 8 次提交
-
-
由 Guillaume Gomez 提交于
doc(array,vec): add notes about side effects when empty-initializing Copying some context from a conversation in the Rust discord: * Both `vec![T; 0]` and `[T; 0]` are syntactically valid, and produce empty containers of their respective types * Both *also* have side effects: ```rust fn side_effect() -> String { println!("side effect!"); "foo".into() } fn main() { println!("before!"); let x = vec![side_effect(); 0]; let y = [side_effect(); 0]; println!("{:?}, {:?}", x, y); } ``` produces: ``` before! side effect! side effect! [], [] ``` This PR just adds two small notes to each's documentation, warning users that side effects can occur. I've also submitted a clippy proposal: https://github.com/rust-lang/rust-clippy/issues/6439
-
由 bors 提交于
Check the number of entries in UI test on tidy This helps #73494 to be resolved. r? `@petrochenkov`
-
由 bors 提交于
Improve error handling in `symbols` proc-macro This improves how the `symbols` proc-macro handles errors. If it finds an error in its input, the macro does not panic. Instead, it still produces an output token stream. That token stream will contain `compile_error!(...)` macro invocations. This will still cause compilation to fail (which is what we want), but it will prevent meaningless errors caused by the output not containing symbols that the macro normally generates. This solves a small (but annoying) problem. When you're editing rustc_span/src/symbol.rs, and you get something wrong (dup symbol name, misordered symbol), you want to get only the errors that are relevant, not a burst of errors that are irrelevant. This change also uses the correct Span when reporting errors, so you get errors that point to the correct place in rustc_span/src/symbol.rs where something is wrong. This also adds several unit tests which test the `symbols` proc-macro. This commit also makes it easy to run the `symbols` proc-macro as an ordinary Cargo test. Just run `cargo test`. This makes it easier to do development on the macro itself, such as running it under a debugger. This commit also uses the `Punctuated` type in `syn` for parsing comma-separated lists, rather than doing it manually. The output of the macro is not changed at all by this commit, so rustc should be completely unchanged. This just improves quality of life during development.
-
由 Yuki Okushi 提交于
-
由 bors 提交于
BTreeMap: declare clear_parent_link directly on the root it needs r? `@Mark-Simulacrum`
-
由 Arlie Davis 提交于
-
由 bors 提交于
Properly capture trailing 'unglued' token If we try to capture the `Vec<u8>` in `Option<Vec<u8>>`, we'll need to capture a `>` token which was 'unglued' from a `>>` token. The processing of unglueing a token for parsing purposes bypasses the usual capturing infrastructure, so we currently lose the trailing `>`. As a result, we fall back to the reparsed `TokenStream`, causing us to lose spans. This commit makes token capturing keep track of a trailing 'unglued' token. Note that we don't need to care about unglueing except at the end of the captured tokens - if we capture both the first and second unglued tokens, then we'll end up capturing the full 'glued' token, which already works correctly.
-
由 bors 提交于
BTreeMap: detect bulk_steal's count-1 underflow in release builds too r? `@Mark-Simulacrum`
-
- 13 12月, 2020 32 次提交
-
-
由 bors 提交于
BTreeMap: clarify comments and panics around choose_parent_kv Fixes a lie in recent code: `unreachable!("empty non-root node")` should shout "empty internal node", but it might as well be good and keep quiet r? `@Mark-Simulacrum`
-
由 bors 提交于
Recover on `const impl<> X for Y` `@leonardo-m` mentioned that `const impl Foo for Bar` could be recovered from in #79287. I'm not sure about the error strings as they are, I think it should probably be something like the error that `expected_one_of_not_found` makes + the suggestion to flip the keywords, but I'm not sure how exactly to do that. Also, I decided not to try to handle `const unsafe impl` or `unsafe const impl` cause I figured that `unsafe impl const` would be pretty rare anyway (if it's even valid?), and it wouldn't be worth making the code more messy.
-
由 Stein Somers 提交于
-
由 bors 提交于
Resolve enum field visibility correctly Fixes #79593.
🎉 Previously, this code treated enum fields' visibility as if they were struct fields. However, that's not correct because the visibility of a struct field with `ast::VisibilityKind::Inherited` is private to the module it's defined in, whereas the visibility of an *enum* field with `ast::VisibilityKind::Inherited` is the visibility of the enum it belongs to. -
由 bors 提交于
Rollup of 12 pull requests Successful merges: - #79360 (std::iter: document iteration over `&T` and `&mut T`) - #79398 (Link loop/for keyword) - #79834 (Remove deprecated linked_list_extras methods.) - #79845 (Fix rustup support in default_build_triple for python3) - #79940 (fix more clippy::complexity findings) - #79942 (Add post-init hook for static memory for miri.) - #79954 (Fix building compiler docs with stage 0) - #79963 (Fix typo in `DebruijnIndex` documentation) - #79970 (Misc rustbuild improvements when the LLVM backend isn't used) - #79973 (rustdoc light theme: Fix CSS for selected buttons) - #79984 (Remove an unused dependency that made `rustdoc` crash) - #79985 (Fixes submit event of the search input) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
-
由 Yuki Okushi 提交于
Fixes submit event of the search input Fixes https://github.com/rust-lang/rust/issues/79960 It's a very funny corner case: In HTML, when a button follows an input (in a `form`), if the enter keep is pressed on the input, instead of sending the submit event to the input, it'll create a click event on the button following it, which in this case made the help popup show up whenever "enter" was pressed. cc `@camelid` r? `@jyn514`
-
由 Yuki Okushi 提交于
Remove an unused dependency that made `rustdoc` crash Whilst struggling with https://github.com/rust-lang/rust/issues/79980 I discovered that this dependency was unused, and that made rustdoc crash. This PR removes it.
-
由 Yuki Okushi 提交于
rustdoc light theme: Fix CSS for selected buttons Fixes #79961. The background was dark before, which made the text impossible to read. Now the button doesn't override the background, and the only thing it does is add a light-blue top border. Ultimately, the search results tabs now look very similar to how they used to look. r? `@GuillaumeGomez`
-
由 Yuki Okushi 提交于
Misc rustbuild improvements when the LLVM backend isn't used * Don't checkout llvm-project * Don't require cmake and ninja Fixes #78564
-
由 Yuki Okushi 提交于
Fix typo in `DebruijnIndex` documentation Suggested in https://github.com/rust-lang/rust/pull/79169#discussion_r541564114. r? ``@lqd``
-
由 Yuki Okushi 提交于
Fix building compiler docs with stage 0 This regressed in https://github.com/rust-lang/rust/pull/79525 (see https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Can't.20document.20single.20crate). r? `@Mark-Simulacrum`
-
由 Yuki Okushi 提交于
Add post-init hook for static memory for miri. Adds a post-initialization hook to treat memory initialized using the interpreter as if it was initialized in a static context. See: https://github.com/rust-lang/miri/pull/1644 & https://github.com/rust-lang/miri/issues/1643
-
由 Yuki Okushi 提交于
fix more clippy::complexity findings fix clippy::unnecessary_filter_map use if let Some(x) = .. instead of ...map(|x|) to conditionally run fns that return () (clippy::option_map_unit_fn) fix clippy::{needless_bool, manual_unwrap_or} don't clone types that are copy (clippy::clone_on_copy) don't convert types into identical types with .into() (clippy::useless_conversion) use strip_prefix over slicing (clippy::manual_strip) r? ``@Dylan-DPC``
-
由 Yuki Okushi 提交于
Fix rustup support in default_build_triple for python3 bootstrap completely ignores all errors when detecting a rustup version, so this wasn't noticed before. Fixes the following error: ``` rustup not detected: a bytes-like object is required, not 'str' falling back to auto-detect ``` This also takes the opportunity to only call rustup and other external commands only once during startup. Follow-up to https://github.com/rust-lang/rust/pull/78513.
-
由 Yuki Okushi 提交于
Remove deprecated linked_list_extras methods. https://github.com/rust-lang/rust/issues/27794#issuecomment-667524201: > I'd say give it about 2 weeks then remove them. It's been 18 weeks. Time to remove them. :) Closes #27794.
-
由 Yuki Okushi 提交于
Link loop/for keyword Even though the reference already have all of these, I am just adding related keywords in the see also to let others easily click on the related keyword.
-
由 Yuki Okushi 提交于
std::iter: document iteration over `&T` and `&mut T` A colleague of mine is new to Rust, and mentioned that it was “slightly confusing” to figure out what `&mut` does in iterating over `&mut foo`: ```rust for value in &mut self.my_vec { // ... } ``` My colleague had read the `std::iter` docs and not found the answer there. There is a brief section at the top about “the three forms of iteration”, which mentions `iter_mut`, but it doesn’t cover the purpose of `&mut coll` for a collection `coll`. This patch adds an explanatory section to the docs. I opted to create a new section so that it can appear after the note that `impl<I: Iterator> IntoIterator for I`, and it’s nice for the existing “three forms of iteration” to appear near the top. Test Plan: Ran `./x.py doc library/core`, and the result looked good, including links. Manually copy-pasted the two doctests into the playground and ran them. wchargin-branch: doc-iter-by-reference
-
由 bors 提交于
BTreeMap: capture a recurring use pattern as replace_kv r? `@Mark-Simulacrum`
-
由 Stein Somers 提交于
-
由 Stein Somers 提交于
-
由 Arlie Davis 提交于
This improves how the `symbols` proc-macro handles errors. If it finds an error in its input, the macro does not panic. Instead, it still produces an output token stream. That token stream will contain `compile_error!(...)` macro invocations. This will still cause compilation to fail (which is what we want), but it will prevent meaningless errors caused by the output not containing symbols that the macro normally generates. This solves a small (but annoying) problem. When you're editing rustc_span/src/symbol.rs, and you get something wrong (dup symbol name, misordered symbol), you want to get only the errors that are relevant, not a burst of errors that are irrelevant. This change also uses the correct Span when reporting errors, so you get errors that point to the correct place in rustc_span/src/symbol.rs where something is wrong. This also adds several unit tests which test the `symbols` proc-macro. This commit also makes it easy to run the `symbols` proc-macro as an ordinary Cargo test. Just run `cargo test`. This makes it easier to do development on the macro itself, such as running it under a debugger. This commit also uses the `Punctuated` type in `syn` for parsing comma-separated lists, rather than doing it manually. The output of the macro is not changed at all by this commit, so rustc should be completely unchanged. This just improves quality of life during development.
-
由 Guillaume Gomez 提交于
In HTML, when a button follows an input, if the enter keep is pressed on the input, instead of sending the submit event to the input, it'll create a click event on the button following it, which in this case made the help popup show up whenever "enter" was pressed.
-
由 bors 提交于
Remove incorrect assert Fixes an assertion failure when resolving `::std` (or any other crate that uses the `::` style, see https://github.com/rust-lang/rust/pull/79809/files#r541776478, https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Perf.20failing). Unblocks https://github.com/rust-lang/rustc-perf/pull/806. r? `@ghost` - this is a trivial fix and breaking rustc-perf so I'm going to approve it unilaterally. cc `@Mark-Simulacrum` `@Eric-Arellano`
-
由 Joshua Nelson 提交于
-
由 Nadrieril 提交于
-
由 Camelid 提交于
Previously, this code treated enum fields' visibility as if they were struct fields. However, that's not correct because the visibility of a struct field with `ast::VisibilityKind::Inherited` is private to the module it's defined in, whereas the visibility of an *enum* field with `ast::VisibilityKind::Inherited` is the visibility of the enum it belongs to.
-
由 Aaron Hill 提交于
If we try to capture the `Vec<u8>` in `Option<Vec<u8>>`, we'll need to capture a `>` token which was 'unglued' from a `>>` token. The processing of unglueing a token for parsing purposes bypasses the usual capturing infrastructure, so we currently lose the trailing `>`. As a result, we fall back to the reparsed `TokenStream`, causing us to lose spans. This commit makes token capturing keep track of a trailing 'unglued' token. Note that we don't need to care about unglueing except at the end of the captured tokens - if we capture both the first and second unglued tokens, then we'll end up capturing the full 'glued' token, which already works correctly.
-
由 Noah 提交于
-
由 Joshua Nelson 提交于
-
由 Camelid 提交于
The background was dark before, which made the text impossible to read. Now the background is white, which is how selected `div`s are rendered. As a result, the search results tabs now look identical to how they used to look (before #79896).
-
由 bors 提交于
[rustdoc] Calculate span information on demand instead of storing it ahead of time This brings `size_of<clean::types::Span>()` down from over 100 bytes (!!) to only 12, the same as rustc. It brings `Item` down even more, from `784` to `680`. ~~TODO: I need to figure out how to do this for the JSON backend too. That uses `From` impls everywhere, which don't allow passing in the `Session` as an argument. `@P1n3appl3,` `@tmandry,` maybe one of you have ideas?~~ Figured it out, fortunately only two functions needed to be changed. I like the `convert_x()` format better than `From` everywhere but I'm open to feedback. Helps with #79103
-
由 Stein Somers 提交于
-