Skip to content

Commit ab10908

Browse files
committed
Auto merge of rust-lang#106409 - matthiaskrgr:rollup-b58z1hz, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang#104552 (warn newer available version of the x tool) - rust-lang#105681 (some fixes/improvements to mir::visit module) - rust-lang#106005 (Test the borrowck behavior of if-let guards) - rust-lang#106356 (clean: Remove `ctor_kind` from `VariantStruct`.) - rust-lang#106365 (Grammar : Missing "is" in format specifier diagnostic) - rust-lang#106388 (rustdoc: remove legacy box-sizing CSS) - rust-lang#106392 (`has_overflow` only if value is *not* within limit) - rust-lang#106402 (Fix dupe word typos) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 312c9a3 + e2f7108 commit ab10908

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+756
-110
lines changed

Cargo.lock

+11-10
Original file line numberDiff line numberDiff line change
@@ -4805,18 +4805,18 @@ checksum = "1ef965a420fe14fdac7dd018862966a4c14094f900e1650bbc71ddd7d580c8af"
48054805

48064806
[[package]]
48074807
name = "semver"
4808-
version = "1.0.12"
4808+
version = "1.0.14"
48094809
source = "registry+https://github.com/rust-lang/crates.io-index"
4810-
checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1"
4810+
checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4"
48114811
dependencies = [
48124812
"serde",
48134813
]
48144814

48154815
[[package]]
48164816
name = "serde"
4817-
version = "1.0.147"
4817+
version = "1.0.152"
48184818
source = "registry+https://github.com/rust-lang/crates.io-index"
4819-
checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965"
4819+
checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
48204820
dependencies = [
48214821
"serde_derive",
48224822
]
@@ -4833,9 +4833,9 @@ dependencies = [
48334833

48344834
[[package]]
48354835
name = "serde_derive"
4836-
version = "1.0.147"
4836+
version = "1.0.152"
48374837
source = "registry+https://github.com/rust-lang/crates.io-index"
4838-
checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852"
4838+
checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
48394839
dependencies = [
48404840
"proc-macro2",
48414841
"quote",
@@ -4853,9 +4853,9 @@ dependencies = [
48534853

48544854
[[package]]
48554855
name = "serde_json"
4856-
version = "1.0.85"
4856+
version = "1.0.91"
48574857
source = "registry+https://github.com/rust-lang/crates.io-index"
4858-
checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44"
4858+
checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883"
48594859
dependencies = [
48604860
"indexmap",
48614861
"itoa",
@@ -5133,9 +5133,9 @@ dependencies = [
51335133

51345134
[[package]]
51355135
name = "syn"
5136-
version = "1.0.102"
5136+
version = "1.0.107"
51375137
source = "registry+https://github.com/rust-lang/crates.io-index"
5138-
checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1"
5138+
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
51395139
dependencies = [
51405140
"proc-macro2",
51415141
"quote",
@@ -5309,6 +5309,7 @@ dependencies = [
53095309
"lazy_static",
53105310
"miropt-test-tools",
53115311
"regex",
5312+
"semver",
53125313
"termcolor",
53135314
"walkdir",
53145315
]

compiler/rustc_builtin_macros/src/format.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ fn report_missing_placeholders(
638638
if show_doc_note {
639639
diag.note(concat!(
640640
stringify!($kind),
641-
" formatting not supported; see the documentation for `std::fmt`",
641+
" formatting is not supported; see the documentation for `std::fmt`",
642642
));
643643
}
644644
if suggestions.len() > 0 {

compiler/rustc_lint/src/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,7 @@ declare_lint! {
13921392
///
13931393
/// The attribute must be used in conjunction with the
13941394
/// [`closure_track_caller` feature flag]. Otherwise, the `#[track_caller]`
1395-
/// annotation will function as as no-op.
1395+
/// annotation will function as a no-op.
13961396
///
13971397
/// [`closure_track_caller` feature flag]: https://doc.rust-lang.org/beta/unstable-book/language-features/closure-track-caller.html
13981398
UNGATED_ASYNC_FN_TRACK_CALLER,

compiler/rustc_lint/src/early.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ macro_rules! lint_callback { ($cx:expr, $f:ident, $($args:expr),*) => ({
2929
$cx.pass.$f(&$cx.context, $($args),*);
3030
}) }
3131

32-
/// Implements the AST traversal for early lint passes. `T` provides the the
32+
/// Implements the AST traversal for early lint passes. `T` provides the
3333
/// `check_*` methods.
3434
pub struct EarlyContextAndPass<'a, T: EarlyLintPass> {
3535
context: EarlyContext<'a>,

compiler/rustc_lint/src/late.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ macro_rules! lint_callback { ($cx:expr, $f:ident, $($args:expr),*) => ({
4040
$cx.pass.$f(&$cx.context, $($args),*);
4141
}) }
4242

43-
/// Implements the AST traversal for late lint passes. `T` provides the the
43+
/// Implements the AST traversal for late lint passes. `T` provides the
4444
/// `check_*` methods.
4545
pub struct LateContextAndPass<'tcx, T: LateLintPass<'tcx>> {
4646
context: LateContext<'tcx>,

compiler/rustc_middle/src/mir/visit.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
//! ## Overview
44
//!
55
//! There are two visitors, one for immutable and one for mutable references,
6-
//! but both are generated by the following macro. The code is written according
7-
//! to the following conventions:
6+
//! but both are generated by the `make_mir_visitor` macro.
7+
//! The code is written according to the following conventions:
88
//!
99
//! - introduce a `visit_foo` and a `super_foo` method for every MIR type
1010
//! - `visit_foo`, by default, calls `super_foo`
1111
//! - `super_foo`, by default, destructures the `foo` and calls `visit_foo`
1212
//!
13-
//! This allows you as a user to override `visit_foo` for types are
14-
//! interested in, and invoke (within that method) call
13+
//! This allows you to override `visit_foo` for types you are
14+
//! interested in, and invoke (within that method call)
1515
//! `self.super_foo` to get the default behavior. Just as in an OO
1616
//! language, you should never call `super` methods ordinarily except
1717
//! in that circumstance.

compiler/rustc_trait_selection/src/solve/overflow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl OverflowData {
3636

3737
#[inline]
3838
pub(super) fn has_overflow(&self, depth: usize) -> bool {
39-
self.current_limit.value_within_limit(depth + self.additional_depth)
39+
!self.current_limit.value_within_limit(depth + self.additional_depth)
4040
}
4141

4242
/// Updating the current limit when hitting overflow.

src/bootstrap/bootstrap.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -934,8 +934,7 @@ def main():
934934
if len(sys.argv) > 1 and sys.argv[1] == 'help':
935935
sys.argv = [sys.argv[0], '-h'] + sys.argv[2:]
936936

937-
help_triggered = (
938-
'-h' in sys.argv) or ('--help' in sys.argv) or (len(sys.argv) == 1)
937+
help_triggered = len(sys.argv) == 1 or any(x in ["-h", "--help", "--version"] for x in sys.argv)
939938
try:
940939
bootstrap(help_triggered)
941940
if not help_triggered:

src/librustdoc/clean/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1960,7 +1960,6 @@ pub(crate) fn clean_variant_def<'tcx>(variant: &ty::VariantDef, cx: &mut DocCont
19601960
variant.fields.iter().map(|field| clean_middle_field(field, cx)).collect(),
19611961
),
19621962
None => VariantKind::Struct(VariantStruct {
1963-
ctor_kind: None,
19641963
fields: variant.fields.iter().map(|field| clean_middle_field(field, cx)).collect(),
19651964
}),
19661965
};
@@ -1985,7 +1984,6 @@ fn clean_variant_data<'tcx>(
19851984

19861985
let kind = match variant {
19871986
hir::VariantData::Struct(..) => VariantKind::Struct(VariantStruct {
1988-
ctor_kind: None,
19891987
fields: variant.fields().iter().map(|x| clean_field(x, cx)).collect(),
19901988
}),
19911989
hir::VariantData::Tuple(..) => {

src/librustdoc/clean/types.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2111,7 +2111,6 @@ impl Union {
21112111
/// only as a variant in an enum.
21122112
#[derive(Clone, Debug)]
21132113
pub(crate) struct VariantStruct {
2114-
pub(crate) ctor_kind: Option<CtorKind>,
21152114
pub(crate) fields: Vec<Item>,
21162115
}
21172116

src/librustdoc/html/render/print_item.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -1229,16 +1229,7 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean::
12291229
w.write_str(")");
12301230
}
12311231
clean::VariantKind::Struct(ref s) => {
1232-
render_struct(
1233-
w,
1234-
v,
1235-
None,
1236-
s.ctor_kind,
1237-
&s.fields,
1238-
" ",
1239-
false,
1240-
cx,
1241-
);
1232+
render_struct(w, v, None, None, &s.fields, " ", false, cx);
12421233
}
12431234
},
12441235
_ => unreachable!(),

src/librustdoc/html/static/css/rustdoc.css

-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@
7676
}
7777

7878
* {
79-
-webkit-box-sizing: border-box;
80-
-moz-box-sizing: border-box;
8179
box-sizing: border-box;
8280
}
8381

src/librustdoc/visit_ast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
410410

411411
/// This method will create a new module and push it onto the "modules stack" then call
412412
/// `visit_mod_contents`. Once done, it'll remove it from the "modules stack" and instead
413-
/// add into into the list of modules of the current module.
413+
/// add into the list of modules of the current module.
414414
fn enter_mod(&mut self, id: hir::HirId, m: &'tcx hir::Mod<'tcx>, name: Symbol) {
415415
self.modules.push(Module::new(name, id, m.spans.inner_span));
416416

src/test/ui/borrowck/borrowck-drop-from-guard.rs

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![feature(if_let_guard)]
2+
13
fn foo(_:String) {}
24

35
fn main()
@@ -8,4 +10,11 @@ fn main()
810
Some(_) => {}
911
None => { foo(my_str); } //~ ERROR [E0382]
1012
}
13+
14+
let my_str = "hello".to_owned();
15+
match Some(42) {
16+
Some(_) if let Some(()) = { drop(my_str); None } => {}
17+
Some(_) => {}
18+
None => { foo(my_str); } //~ ERROR [E0382]
19+
}
1120
}

src/test/ui/borrowck/borrowck-drop-from-guard.stderr

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0382]: use of moved value: `my_str`
2-
--> $DIR/borrowck-drop-from-guard.rs:9:23
2+
--> $DIR/borrowck-drop-from-guard.rs:11:23
33
|
44
LL | let my_str = "hello".to_owned();
55
| ------ move occurs because `my_str` has type `String`, which does not implement the `Copy` trait
@@ -15,6 +15,23 @@ help: consider cloning the value if the performance cost is acceptable
1515
LL | Some(_) if { drop(my_str.clone()); false } => {}
1616
| ++++++++
1717

18-
error: aborting due to previous error
18+
error[E0382]: use of moved value: `my_str`
19+
--> $DIR/borrowck-drop-from-guard.rs:18:23
20+
|
21+
LL | let my_str = "hello".to_owned();
22+
| ------ move occurs because `my_str` has type `String`, which does not implement the `Copy` trait
23+
LL | match Some(42) {
24+
LL | Some(_) if let Some(()) = { drop(my_str); None } => {}
25+
| ------ value moved here
26+
LL | Some(_) => {}
27+
LL | None => { foo(my_str); }
28+
| ^^^^^^ value used here after move
29+
|
30+
help: consider cloning the value if the performance cost is acceptable
31+
|
32+
LL | Some(_) if let Some(()) = { drop(my_str.clone()); None } => {}
33+
| ++++++++
34+
35+
error: aborting due to 2 previous errors
1936

2037
For more information about this error, try `rustc --explain E0382`.

src/test/ui/borrowck/borrowck-mutate-in-guard.rs

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
#![feature(if_let_guard)]
2+
13
enum Enum<'a> {
24
A(&'a isize),
35
B(bool),
46
}
57

6-
fn foo() -> isize {
8+
fn if_guard() -> isize {
79
let mut n = 42;
810
let mut x = Enum::A(&mut n);
911
match x {
@@ -16,6 +18,17 @@ fn foo() -> isize {
1618
}
1719
}
1820

19-
fn main() {
20-
foo();
21+
fn if_let_guard() -> isize {
22+
let mut n = 42;
23+
let mut x = Enum::A(&mut n);
24+
match x {
25+
Enum::A(_) if let Some(()) = { x = Enum::B(false); None } => 1,
26+
//~^ ERROR cannot assign `x` in match guard
27+
Enum::A(_) if let Some(()) = { let y = &mut x; *y = Enum::B(false); None } => 1,
28+
//~^ ERROR cannot mutably borrow `x` in match guard
29+
Enum::A(p) => *p,
30+
Enum::B(_) => 2,
31+
}
2132
}
33+
34+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,37 @@
11
error[E0510]: cannot assign `x` in match guard
2-
--> $DIR/borrowck-mutate-in-guard.rs:10:25
2+
--> $DIR/borrowck-mutate-in-guard.rs:12:25
33
|
44
LL | match x {
55
| - value is immutable in match guard
66
LL | Enum::A(_) if { x = Enum::B(false); false } => 1,
77
| ^^^^^^^^^^^^^^^^^^ cannot assign
88

99
error[E0510]: cannot mutably borrow `x` in match guard
10-
--> $DIR/borrowck-mutate-in-guard.rs:12:33
10+
--> $DIR/borrowck-mutate-in-guard.rs:14:33
1111
|
1212
LL | match x {
1313
| - value is immutable in match guard
1414
...
1515
LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
1616
| ^^^^^^ cannot mutably borrow
1717

18-
error: aborting due to 2 previous errors
18+
error[E0510]: cannot assign `x` in match guard
19+
--> $DIR/borrowck-mutate-in-guard.rs:25:40
20+
|
21+
LL | match x {
22+
| - value is immutable in match guard
23+
LL | Enum::A(_) if let Some(()) = { x = Enum::B(false); None } => 1,
24+
| ^^^^^^^^^^^^^^^^^^ cannot assign
25+
26+
error[E0510]: cannot mutably borrow `x` in match guard
27+
--> $DIR/borrowck-mutate-in-guard.rs:27:48
28+
|
29+
LL | match x {
30+
| - value is immutable in match guard
31+
...
32+
LL | Enum::A(_) if let Some(()) = { let y = &mut x; *y = Enum::B(false); None } => 1,
33+
| ^^^^^^ cannot mutably borrow
34+
35+
error: aborting due to 4 previous errors
1936

2037
For more information about this error, try `rustc --explain E0510`.
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
#![feature(if_let_guard)]
2+
13
fn main() {
24
let a = Some("...".to_owned());
35
let b = match a {
46
Some(_) if { drop(a); false } => None,
57
x => x, //~ ERROR use of moved value: `a`
68
};
7-
println!("{:?}", b);
9+
10+
let a = Some("...".to_owned());
11+
let b = match a {
12+
Some(_) if let Some(()) = { drop(a); None } => None,
13+
x => x, //~ ERROR use of moved value: `a`
14+
};
815
}

src/test/ui/borrowck/issue-31287-drop-in-guard.stderr

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0382]: use of moved value: `a`
2-
--> $DIR/issue-31287-drop-in-guard.rs:5:9
2+
--> $DIR/issue-31287-drop-in-guard.rs:7:9
33
|
44
LL | let a = Some("...".to_owned());
55
| - move occurs because `a` has type `Option<String>`, which does not implement the `Copy` trait
@@ -14,6 +14,22 @@ help: consider cloning the value if the performance cost is acceptable
1414
LL | Some(_) if { drop(a.clone()); false } => None,
1515
| ++++++++
1616

17-
error: aborting due to previous error
17+
error[E0382]: use of moved value: `a`
18+
--> $DIR/issue-31287-drop-in-guard.rs:13:9
19+
|
20+
LL | let a = Some("...".to_owned());
21+
| - move occurs because `a` has type `Option<String>`, which does not implement the `Copy` trait
22+
LL | let b = match a {
23+
LL | Some(_) if let Some(()) = { drop(a); None } => None,
24+
| - value moved here
25+
LL | x => x,
26+
| ^ value used here after move
27+
|
28+
help: consider cloning the value if the performance cost is acceptable
29+
|
30+
LL | Some(_) if let Some(()) = { drop(a.clone()); None } => None,
31+
| ++++++++
32+
33+
error: aborting due to 2 previous errors
1834

1935
For more information about this error, try `rustc --explain E0382`.

src/test/ui/fmt/ifmt-bad-arg.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ LL | format!("foo %s baz", "bar");
170170
| |
171171
| help: format specifiers use curly braces: `{}`
172172
|
173-
= note: printf formatting not supported; see the documentation for `std::fmt`
173+
= note: printf formatting is not supported; see the documentation for `std::fmt`
174174

175175
error: invalid format string: expected `'}'`, found `'t'`
176176
--> $DIR/ifmt-bad-arg.rs:75:1

src/test/ui/fmt/issue-89173.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ fn main() {
1010
//~| NOTE: argument never used
1111
//~| NOTE: argument never used
1212
//~| NOTE: format specifiers use curly braces, and you have to use a positional or named parameter for the width
13-
//~| NOTE: printf formatting not supported
13+
//~| NOTE: printf formatting is not supported
1414
}

src/test/ui/fmt/issue-89173.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ note: format specifiers use curly braces, and you have to use a positional or na
1212
|
1313
LL | print!("%0*x", width, num);
1414
| ^^^^
15-
= note: printf formatting not supported; see the documentation for `std::fmt`
15+
= note: printf formatting is not supported; see the documentation for `std::fmt`
1616

1717
error: aborting due to previous error
1818

0 commit comments

Comments
 (0)