Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 17 pull requests #93138

Merged
merged 88 commits into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
aa523a9
Fix errors on blanket impls by ignoring the children of their generat…
CraftSpider Jan 13, 2022
74f0e58
Fix typo in test
CraftSpider Jan 13, 2022
a6aa3cb
inline ItemId method, clarify comments a bit
CraftSpider Jan 13, 2022
aafcbf1
Update comment to make it a FIXME
CraftSpider Jan 13, 2022
474e091
Move FIXME to if statement
CraftSpider Jan 13, 2022
4be32f8
Add test case for #57478
eholk Oct 8, 2021
f712df8
Track drop points in generator_interior
eholk Oct 20, 2021
c4dee40
Track drops across multiple yields
eholk Oct 22, 2021
f664cfc
Make generator and async-await tests pass
eholk Oct 22, 2021
f246c0b
Attribute drop to parent expression of the consume point
eholk Oct 26, 2021
aa029d4
Support conditional drops
eholk Oct 28, 2021
9611770
Support reinitialization of variables
eholk Nov 3, 2021
298ca2f
Basic loop support
eholk Nov 4, 2021
4574152
Handle more cases with conditionally initialized/dropped values
eholk Nov 4, 2021
ba7d127
More tracing and tests
eholk Nov 5, 2021
ff0e8f4
Revamped DropRange data structure
eholk Nov 11, 2021
c7afaa1
Handle break and continue. Change fixpoint computation to handle unre…
eholk Nov 17, 2021
b39fb9b
Fix control flow handling in generator_interior
eholk Nov 18, 2021
904c270
More comments and small cleanups
eholk Nov 19, 2021
5feb4d0
Refactor code to keep most drop range analysis in drop_ranges.rs
eholk Nov 19, 2021
46760b4
Update async-fn-nonsend.stderr
eholk Nov 22, 2021
006f547
Add more comments
eholk Dec 6, 2021
30e1b1e
Address code review comments
eholk Dec 13, 2021
f5f98d7
Refactor drop_ranges
eholk Dec 13, 2021
9347bf4
Additional cleanup
eholk Dec 13, 2021
6a28afb
Fixing formatting
eholk Dec 14, 2021
7d82e4f
Update stderr files
eholk Dec 15, 2021
2af02cf
More comments and refactoring
eholk Dec 16, 2021
4a70de7
Handle reinits in match guards
eholk Dec 16, 2021
6e281a7
Explicitly list all ExprKinds in cfg_build
eholk Dec 16, 2021
a7df4e8
Handle empty loops better
eholk Dec 16, 2021
7d11b33
Remove clones and most allocations from propagate_to_fixpoint
eholk Dec 16, 2021
f730bd0
Track changed bitsets in CFG propagation
eholk Dec 17, 2021
787f4cb
Handle uninhabited return types
eholk Dec 17, 2021
887e843
Update async-fn-nonsend.rs
eholk Dec 17, 2021
78c5644
drop_ranges: Add TrackedValue enum
eholk Dec 20, 2021
32930d9
Safely handle partial drops
eholk Jan 5, 2022
e0a5370
Respond to code review comments
eholk Jan 15, 2022
d840d0c
Use .. patterns in cfg_build.rs
eholk Jan 18, 2022
76f6b57
Fix build after rebase
eholk Jan 18, 2022
2938be6
Correctly handle starts in block doc comments
GuillaumeGomez Jan 18, 2022
06b00ad
Add test for block doc comments
GuillaumeGomez Jan 18, 2022
017747f
Only suggest adding `!` to expressions that can be macro invocation
estebank Jan 19, 2022
10858d2
Fix test directives; comment out calls broken on windows-gnu
ricobbe Nov 29, 2021
f491a9f
Add tests to ensure that let_chains works with if_let_guard
c410-f3r Jan 19, 2022
8d27c28
⬆ chalk to 0.76.0
pierwill Jan 19, 2022
801ac0e
Fix scroll offset when jumping to internal id
jsha Jan 19, 2022
ab239cc
src/test/rustdoc-json: Check for `struct_field`s in `variant_tuple_st…
Enselic Jan 19, 2022
70d36a0
Show a more informative panic message when `DefPathHash` does not exist
Aaron1011 Jan 19, 2022
eec6016
Delete unused Display for pretty printer Token
dtolnay Jan 20, 2022
d81740e
Grow scan_stack in the conventional direction
dtolnay Jan 20, 2022
d981c5b
Eliminate a token clone from advance_left
dtolnay Jan 20, 2022
351011e
Simplify left_total tracking
dtolnay Jan 20, 2022
d2eb46c
Simplify advance_left
dtolnay Jan 20, 2022
ae75ba6
Inline print into advance_left
dtolnay Jan 20, 2022
ea23a1f
Combine advance_left matches
dtolnay Jan 20, 2022
d5f15a8
Replace all single character variable names
dtolnay Jan 20, 2022
65dd670
Touch up print_string
dtolnay Jan 20, 2022
9e794d7
Eliminate offset number from Fits frames
dtolnay Jan 20, 2022
224536f
Inline indent function
dtolnay Jan 20, 2022
51eeb82
Inline print_newline function
dtolnay Jan 20, 2022
21c1571
Deduplicate branches of print_break implementation
dtolnay Jan 20, 2022
dcb0721
Support --bless for pp-exact pretty printer tests
dtolnay Jan 20, 2022
4e17170
rustdoc: auto create output directory when "--output-format json"
tomkris Jan 19, 2022
c29b637
update comments
lcnr Jan 20, 2022
855c176
add script to prevent point releases with same number as existing ones
pietroalbini Jan 20, 2022
682ef4d
Exclude "test" from doc_auto_cfg rendering
GuillaumeGomez Jan 13, 2022
fd005f5
Update doc_auto_cfg test
GuillaumeGomez Jan 13, 2022
caec4a2
Extra cfg_hide a bit to handle inner cfgs
GuillaumeGomez Jan 16, 2022
b0df765
More clean up
GuillaumeGomez Jan 20, 2022
028a3e7
backport the 1.58.1 relnotes to master
pietroalbini Jan 20, 2022
3d10c64
Rollup merge of #91032 - eholk:generator-drop-tracking, r=nikomatsakis
matthiaskrgr Jan 20, 2022
10a7204
Rollup merge of #92856 - GuillaumeGomez:exclude-test-doc_auto_cfg, r=…
matthiaskrgr Jan 20, 2022
530c884
Rollup merge of #92860 - CraftSpider:rustdoc-json-impl-ice, r=jsha
matthiaskrgr Jan 20, 2022
aa7f452
Rollup merge of #93038 - GuillaumeGomez:block-doc-comments, r=notriddle
matthiaskrgr Jan 20, 2022
dc393b2
Rollup merge of #93061 - estebank:macr-suggestion, r=cjgillot
matthiaskrgr Jan 20, 2022
35a53b2
Rollup merge of #93067 - jsha:fix-scroll-padding-top, r=GuillaumeGomez
matthiaskrgr Jan 20, 2022
0a9aaec
Rollup merge of #93086 - c410-f3r:let-guard, r=Mark-Simulacrum
matthiaskrgr Jan 20, 2022
894a867
Rollup merge of #93087 - ricobbe:alt-calling-convention-test-fix, r=M…
matthiaskrgr Jan 20, 2022
b1a405d
Rollup merge of #93091 - pierwill:chalk-0.76, r=jackh726
matthiaskrgr Jan 20, 2022
6cdd2e5
Rollup merge of #93094 - Enselic:check-for-enum-tuple-struct-fields, …
matthiaskrgr Jan 20, 2022
e901b24
Rollup merge of #93098 - Aaron1011:def-path-hash-debug, r=oli-obk
matthiaskrgr Jan 20, 2022
51fd48f
Rollup merge of #93099 - tomkris:rustdoc-fix, r=jsha
matthiaskrgr Jan 20, 2022
d4ec464
Rollup merge of #93102 - dtolnay:ringbuffer, r=lcnr
matthiaskrgr Jan 20, 2022
5e46f7d
Rollup merge of #93104 - dtolnay:ppbless, r=Mark-Simulacrum
matthiaskrgr Jan 20, 2022
b8df581
Rollup merge of #93114 - lcnr:mk_array, r=RalfJung
matthiaskrgr Jan 20, 2022
9ea966a
Rollup merge of #93128 - pietroalbini:pa-verify-stable-version-number…
matthiaskrgr Jan 20, 2022
dd16431
Rollup merge of #93136 - pietroalbini:pa-1.58.1-relnotes-master, r=pi…
matthiaskrgr Jan 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ jobs:
- name: ensure backported commits are in upstream branches
run: src/ci/scripts/verify-backported-commits.sh
if: success() && !env.SKIP_JOB
- name: ensure the stable version number is correct
run: src/ci/scripts/verify-stable-version-number.sh
if: success() && !env.SKIP_JOB
- name: run the build
run: src/ci/scripts/run-build-from-ci.sh
env:
Expand Down Expand Up @@ -502,6 +505,9 @@ jobs:
- name: ensure backported commits are in upstream branches
run: src/ci/scripts/verify-backported-commits.sh
if: success() && !env.SKIP_JOB
- name: ensure the stable version number is correct
run: src/ci/scripts/verify-stable-version-number.sh
if: success() && !env.SKIP_JOB
- name: run the build
run: src/ci/scripts/run-build-from-ci.sh
env:
Expand Down Expand Up @@ -612,6 +618,9 @@ jobs:
- name: ensure backported commits are in upstream branches
run: src/ci/scripts/verify-backported-commits.sh
if: success() && !env.SKIP_JOB
- name: ensure the stable version number is correct
run: src/ci/scripts/verify-stable-version-number.sh
if: success() && !env.SKIP_JOB
- name: run the build
run: src/ci/scripts/run-build-from-ci.sh
env:
Expand Down
19 changes: 11 additions & 8 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"

[[package]]
name = "chalk-derive"
version = "0.75.0"
version = "0.76.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d54e3b5f9e3425e6b119ff07568d8d006bfa5a8d6f78a9cbc3530b1e962e316c"
checksum = "58c24b8052ea1e3adbb6f9ab7ba5fcc18b9d12591c042de4c833f709ce81e0e0"
dependencies = [
"proc-macro2",
"quote",
Expand All @@ -556,9 +556,9 @@ dependencies = [

[[package]]
name = "chalk-engine"
version = "0.75.0"
version = "0.76.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdc891073396b167163db77123b0a3c00088edc00466cecc5531f33e3e989523"
checksum = "0eca186b6ea9af798312f4b568fd094c82e7946ac08be5dc5fea22decc6d2ed8"
dependencies = [
"chalk-derive",
"chalk-ir",
Expand All @@ -569,9 +569,9 @@ dependencies = [

[[package]]
name = "chalk-ir"
version = "0.75.0"
version = "0.76.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b79e5a1d04b79311e90c69356a2c62027853906a7e33b3e070b93c055fc3e8a"
checksum = "f3cad5c3f1edd4b4a2c9bda24ae558ceb4f88336f88f944c2e35d0bfeb13c818"
dependencies = [
"bitflags",
"chalk-derive",
Expand All @@ -580,13 +580,14 @@ dependencies = [

[[package]]
name = "chalk-solve"
version = "0.75.0"
version = "0.76.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5d2a1db6605aba70a58820bd80ac422b218913a510f1a40beef9efc5371ea1d"
checksum = "94533188d3452bc72cbd5618d166f45fc7646b674ad3fe9667d557bc25236dee"
dependencies = [
"chalk-derive",
"chalk-ir",
"ena",
"indexmap",
"itertools 0.10.1",
"petgraph",
"rustc-hash",
Expand Down Expand Up @@ -4413,13 +4414,15 @@ dependencies = [
"rustc_attr",
"rustc_data_structures",
"rustc_errors",
"rustc_graphviz",
"rustc_hir",
"rustc_hir_pretty",
"rustc_index",
"rustc_infer",
"rustc_lint",
"rustc_macros",
"rustc_middle",
"rustc_serialize",
"rustc_session",
"rustc_span",
"rustc_target",
Expand Down
15 changes: 15 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
Version 1.58.1 (2022-01-19)
===========================

* Fix race condition in `std::fs::remove_dir_all` ([CVE-2022-21658])
* [Handle captured arguments in the `useless_format` Clippy lint][clippy/8295]
* [Move `non_send_fields_in_send_ty` Clippy lint to nursery][clippy/8075]
* [Fix wrong error message displayed when some imports are missing][91254]
* [Fix rustfmt not formatting generated files from stdin][92912]

[CVE-2022-21658]: https://www.cve.org/CVERecord?id=CVE-2022-21658]
[91254]: https://github.com/rust-lang/rust/pull/91254
[92912]: https://github.com/rust-lang/rust/pull/92912
[clippy/8075]: https://github.com/rust-lang/rust-clippy/pull/8075
[clippy/8295]: https://github.com/rust-lang/rust-clippy/pull/8295

Version 1.58.0 (2022-01-13)
==========================

Expand Down
11 changes: 11 additions & 0 deletions compiler/rustc_ast/src/attr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,17 @@ impl Attribute {
}
}

pub fn doc_str_and_comment_kind(&self) -> Option<(Symbol, CommentKind)> {
match self.kind {
AttrKind::DocComment(kind, data) => Some((data, kind)),
AttrKind::Normal(ref item, _) if item.path == sym::doc => item
.meta_kind()
.and_then(|kind| kind.value_str())
.map(|data| (data, CommentKind::Line)),
_ => None,
}
}

pub fn doc_str(&self) -> Option<Symbol> {
match self.kind {
AttrKind::DocComment(.., data) => Some(data),
Expand Down
29 changes: 25 additions & 4 deletions compiler/rustc_ast/src/util/comments.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::token::CommentKind;
use rustc_span::source_map::SourceMap;
use rustc_span::{BytePos, CharPos, FileName, Pos, Symbol};

Expand Down Expand Up @@ -25,7 +26,7 @@ pub struct Comment {

/// Makes a doc string more presentable to users.
/// Used by rustdoc and perhaps other tools, but not by rustc.
pub fn beautify_doc_string(data: Symbol) -> Symbol {
pub fn beautify_doc_string(data: Symbol, kind: CommentKind) -> Symbol {
fn get_vertical_trim(lines: &[&str]) -> Option<(usize, usize)> {
let mut i = 0;
let mut j = lines.len();
Expand All @@ -42,10 +43,28 @@ pub fn beautify_doc_string(data: Symbol) -> Symbol {
if i != 0 || j != lines.len() { Some((i, j)) } else { None }
}

fn get_horizontal_trim(lines: &[&str]) -> Option<usize> {
fn get_horizontal_trim(lines: &[&str], kind: CommentKind) -> Option<usize> {
let mut i = usize::MAX;
let mut first = true;

// In case we have doc comments like `/**` or `/*!`, we want to remove stars if they are
// present. However, we first need to strip the empty lines so they don't get in the middle
// when we try to compute the "horizontal trim".
let lines = if kind == CommentKind::Block {
let mut i = 0;
let mut j = lines.len();

while i < j && lines[i].trim().is_empty() {
i += 1;
}
while j > i && lines[j - 1].trim().is_empty() {
j -= 1;
}
&lines[i..j]
} else {
lines
};

for line in lines {
for (j, c) in line.chars().enumerate() {
if j > i || !"* \t".contains(c) {
Expand Down Expand Up @@ -79,11 +98,13 @@ pub fn beautify_doc_string(data: Symbol) -> Symbol {
} else {
&mut lines
};
if let Some(horizontal) = get_horizontal_trim(&lines) {
if let Some(horizontal) = get_horizontal_trim(&lines, kind) {
changes = true;
// remove a "[ \t]*\*" block from each line, if possible
for line in lines.iter_mut() {
*line = &line[horizontal + 1..];
if horizontal + 1 < line.len() {
*line = &line[horizontal + 1..];
}
}
}
if changes {
Expand Down
14 changes: 7 additions & 7 deletions compiler/rustc_ast/src/util/comments/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use rustc_span::create_default_session_globals_then;
fn test_block_doc_comment_1() {
create_default_session_globals_then(|| {
let comment = "\n * Test \n ** Test\n * Test\n";
let stripped = beautify_doc_string(Symbol::intern(comment));
let stripped = beautify_doc_string(Symbol::intern(comment), CommentKind::Block);
assert_eq!(stripped.as_str(), " Test \n* Test\n Test");
})
}
Expand All @@ -14,7 +14,7 @@ fn test_block_doc_comment_1() {
fn test_block_doc_comment_2() {
create_default_session_globals_then(|| {
let comment = "\n * Test\n * Test\n";
let stripped = beautify_doc_string(Symbol::intern(comment));
let stripped = beautify_doc_string(Symbol::intern(comment), CommentKind::Block);
assert_eq!(stripped.as_str(), " Test\n Test");
})
}
Expand All @@ -23,21 +23,21 @@ fn test_block_doc_comment_2() {
fn test_block_doc_comment_3() {
create_default_session_globals_then(|| {
let comment = "\n let a: *i32;\n *a = 5;\n";
let stripped = beautify_doc_string(Symbol::intern(comment));
let stripped = beautify_doc_string(Symbol::intern(comment), CommentKind::Block);
assert_eq!(stripped.as_str(), " let a: *i32;\n *a = 5;");
})
}

#[test]
fn test_line_doc_comment() {
create_default_session_globals_then(|| {
let stripped = beautify_doc_string(Symbol::intern(" test"));
let stripped = beautify_doc_string(Symbol::intern(" test"), CommentKind::Line);
assert_eq!(stripped.as_str(), " test");
let stripped = beautify_doc_string(Symbol::intern("! test"));
let stripped = beautify_doc_string(Symbol::intern("! test"), CommentKind::Line);
assert_eq!(stripped.as_str(), "! test");
let stripped = beautify_doc_string(Symbol::intern("test"));
let stripped = beautify_doc_string(Symbol::intern("test"), CommentKind::Line);
assert_eq!(stripped.as_str(), "test");
let stripped = beautify_doc_string(Symbol::intern("!test"));
let stripped = beautify_doc_string(Symbol::intern("!test"), CommentKind::Line);
assert_eq!(stripped.as_str(), "!test");
})
}
Loading