Skip to content

Commit

Permalink
Auto merge of rust-lang#106409 - matthiaskrgr:rollup-b58z1hz, r=matth…
Browse files Browse the repository at this point in the history
…iaskrgr

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
  • Loading branch information
bors committed Jan 3, 2023
2 parents 312c9a3 + e2f7108 commit ab10908
Show file tree
Hide file tree
Showing 51 changed files with 756 additions and 110 deletions.
21 changes: 11 additions & 10 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4805,18 +4805,18 @@ checksum = "1ef965a420fe14fdac7dd018862966a4c14094f900e1650bbc71ddd7d580c8af"

[[package]]
name = "semver"
version = "1.0.12"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1"
checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4"
dependencies = [
"serde",
]

[[package]]
name = "serde"
version = "1.0.147"
version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965"
checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
dependencies = [
"serde_derive",
]
Expand All @@ -4833,9 +4833,9 @@ dependencies = [

[[package]]
name = "serde_derive"
version = "1.0.147"
version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852"
checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
dependencies = [
"proc-macro2",
"quote",
Expand All @@ -4853,9 +4853,9 @@ dependencies = [

[[package]]
name = "serde_json"
version = "1.0.85"
version = "1.0.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44"
checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883"
dependencies = [
"indexmap",
"itoa",
Expand Down Expand Up @@ -5133,9 +5133,9 @@ dependencies = [

[[package]]
name = "syn"
version = "1.0.102"
version = "1.0.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1"
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
dependencies = [
"proc-macro2",
"quote",
Expand Down Expand Up @@ -5309,6 +5309,7 @@ dependencies = [
"lazy_static",
"miropt-test-tools",
"regex",
"semver",
"termcolor",
"walkdir",
]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ fn report_missing_placeholders(
if show_doc_note {
diag.note(concat!(
stringify!($kind),
" formatting not supported; see the documentation for `std::fmt`",
" formatting is not supported; see the documentation for `std::fmt`",
));
}
if suggestions.len() > 0 {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,7 @@ declare_lint! {
///
/// The attribute must be used in conjunction with the
/// [`closure_track_caller` feature flag]. Otherwise, the `#[track_caller]`
/// annotation will function as as no-op.
/// annotation will function as a no-op.
///
/// [`closure_track_caller` feature flag]: https://doc.rust-lang.org/beta/unstable-book/language-features/closure-track-caller.html
UNGATED_ASYNC_FN_TRACK_CALLER,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/early.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ macro_rules! lint_callback { ($cx:expr, $f:ident, $($args:expr),*) => ({
$cx.pass.$f(&$cx.context, $($args),*);
}) }

/// Implements the AST traversal for early lint passes. `T` provides the the
/// Implements the AST traversal for early lint passes. `T` provides the
/// `check_*` methods.
pub struct EarlyContextAndPass<'a, T: EarlyLintPass> {
context: EarlyContext<'a>,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ macro_rules! lint_callback { ($cx:expr, $f:ident, $($args:expr),*) => ({
$cx.pass.$f(&$cx.context, $($args),*);
}) }

/// Implements the AST traversal for late lint passes. `T` provides the the
/// Implements the AST traversal for late lint passes. `T` provides the
/// `check_*` methods.
pub struct LateContextAndPass<'tcx, T: LateLintPass<'tcx>> {
context: LateContext<'tcx>,
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_middle/src/mir/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
//! ## Overview
//!
//! There are two visitors, one for immutable and one for mutable references,
//! but both are generated by the following macro. The code is written according
//! to the following conventions:
//! but both are generated by the `make_mir_visitor` macro.
//! The code is written according to the following conventions:
//!
//! - introduce a `visit_foo` and a `super_foo` method for every MIR type
//! - `visit_foo`, by default, calls `super_foo`
//! - `super_foo`, by default, destructures the `foo` and calls `visit_foo`
//!
//! This allows you as a user to override `visit_foo` for types are
//! interested in, and invoke (within that method) call
//! This allows you to override `visit_foo` for types you are
//! interested in, and invoke (within that method call)
//! `self.super_foo` to get the default behavior. Just as in an OO
//! language, you should never call `super` methods ordinarily except
//! in that circumstance.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/solve/overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl OverflowData {

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

/// Updating the current limit when hitting overflow.
Expand Down
3 changes: 1 addition & 2 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -934,8 +934,7 @@ def main():
if len(sys.argv) > 1 and sys.argv[1] == 'help':
sys.argv = [sys.argv[0], '-h'] + sys.argv[2:]

help_triggered = (
'-h' in sys.argv) or ('--help' in sys.argv) or (len(sys.argv) == 1)
help_triggered = len(sys.argv) == 1 or any(x in ["-h", "--help", "--version"] for x in sys.argv)
try:
bootstrap(help_triggered)
if not help_triggered:
Expand Down
2 changes: 0 additions & 2 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1960,7 +1960,6 @@ pub(crate) fn clean_variant_def<'tcx>(variant: &ty::VariantDef, cx: &mut DocCont
variant.fields.iter().map(|field| clean_middle_field(field, cx)).collect(),
),
None => VariantKind::Struct(VariantStruct {
ctor_kind: None,
fields: variant.fields.iter().map(|field| clean_middle_field(field, cx)).collect(),
}),
};
Expand All @@ -1985,7 +1984,6 @@ fn clean_variant_data<'tcx>(

let kind = match variant {
hir::VariantData::Struct(..) => VariantKind::Struct(VariantStruct {
ctor_kind: None,
fields: variant.fields().iter().map(|x| clean_field(x, cx)).collect(),
}),
hir::VariantData::Tuple(..) => {
Expand Down
1 change: 0 additions & 1 deletion src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2111,7 +2111,6 @@ impl Union {
/// only as a variant in an enum.
#[derive(Clone, Debug)]
pub(crate) struct VariantStruct {
pub(crate) ctor_kind: Option<CtorKind>,
pub(crate) fields: Vec<Item>,
}

Expand Down
11 changes: 1 addition & 10 deletions src/librustdoc/html/render/print_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1229,16 +1229,7 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean::
w.write_str(")");
}
clean::VariantKind::Struct(ref s) => {
render_struct(
w,
v,
None,
s.ctor_kind,
&s.fields,
" ",
false,
cx,
);
render_struct(w, v, None, None, &s.fields, " ", false, cx);
}
},
_ => unreachable!(),
Expand Down
2 changes: 0 additions & 2 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@
}

* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/visit_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {

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

Expand Down
9 changes: 9 additions & 0 deletions src/test/ui/borrowck/borrowck-drop-from-guard.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![feature(if_let_guard)]

fn foo(_:String) {}

fn main()
Expand All @@ -8,4 +10,11 @@ fn main()
Some(_) => {}
None => { foo(my_str); } //~ ERROR [E0382]
}

let my_str = "hello".to_owned();
match Some(42) {
Some(_) if let Some(()) = { drop(my_str); None } => {}
Some(_) => {}
None => { foo(my_str); } //~ ERROR [E0382]
}
}
21 changes: 19 additions & 2 deletions src/test/ui/borrowck/borrowck-drop-from-guard.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0382]: use of moved value: `my_str`
--> $DIR/borrowck-drop-from-guard.rs:9:23
--> $DIR/borrowck-drop-from-guard.rs:11:23
|
LL | let my_str = "hello".to_owned();
| ------ move occurs because `my_str` has type `String`, which does not implement the `Copy` trait
Expand All @@ -15,6 +15,23 @@ help: consider cloning the value if the performance cost is acceptable
LL | Some(_) if { drop(my_str.clone()); false } => {}
| ++++++++

error: aborting due to previous error
error[E0382]: use of moved value: `my_str`
--> $DIR/borrowck-drop-from-guard.rs:18:23
|
LL | let my_str = "hello".to_owned();
| ------ move occurs because `my_str` has type `String`, which does not implement the `Copy` trait
LL | match Some(42) {
LL | Some(_) if let Some(()) = { drop(my_str); None } => {}
| ------ value moved here
LL | Some(_) => {}
LL | None => { foo(my_str); }
| ^^^^^^ value used here after move
|
help: consider cloning the value if the performance cost is acceptable
|
LL | Some(_) if let Some(()) = { drop(my_str.clone()); None } => {}
| ++++++++

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0382`.
19 changes: 16 additions & 3 deletions src/test/ui/borrowck/borrowck-mutate-in-guard.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#![feature(if_let_guard)]

enum Enum<'a> {
A(&'a isize),
B(bool),
}

fn foo() -> isize {
fn if_guard() -> isize {
let mut n = 42;
let mut x = Enum::A(&mut n);
match x {
Expand All @@ -16,6 +18,17 @@ fn foo() -> isize {
}
}

fn main() {
foo();
fn if_let_guard() -> isize {
let mut n = 42;
let mut x = Enum::A(&mut n);
match x {
Enum::A(_) if let Some(()) = { x = Enum::B(false); None } => 1,
//~^ ERROR cannot assign `x` in match guard
Enum::A(_) if let Some(()) = { let y = &mut x; *y = Enum::B(false); None } => 1,
//~^ ERROR cannot mutably borrow `x` in match guard
Enum::A(p) => *p,
Enum::B(_) => 2,
}
}

fn main() {}
23 changes: 20 additions & 3 deletions src/test/ui/borrowck/borrowck-mutate-in-guard.stderr
Original file line number Diff line number Diff line change
@@ -1,20 +1,37 @@
error[E0510]: cannot assign `x` in match guard
--> $DIR/borrowck-mutate-in-guard.rs:10:25
--> $DIR/borrowck-mutate-in-guard.rs:12:25
|
LL | match x {
| - value is immutable in match guard
LL | Enum::A(_) if { x = Enum::B(false); false } => 1,
| ^^^^^^^^^^^^^^^^^^ cannot assign

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

error: aborting due to 2 previous errors
error[E0510]: cannot assign `x` in match guard
--> $DIR/borrowck-mutate-in-guard.rs:25:40
|
LL | match x {
| - value is immutable in match guard
LL | Enum::A(_) if let Some(()) = { x = Enum::B(false); None } => 1,
| ^^^^^^^^^^^^^^^^^^ cannot assign

error[E0510]: cannot mutably borrow `x` in match guard
--> $DIR/borrowck-mutate-in-guard.rs:27:48
|
LL | match x {
| - value is immutable in match guard
...
LL | Enum::A(_) if let Some(()) = { let y = &mut x; *y = Enum::B(false); None } => 1,
| ^^^^^^ cannot mutably borrow

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0510`.
9 changes: 8 additions & 1 deletion src/test/ui/borrowck/issue-31287-drop-in-guard.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#![feature(if_let_guard)]

fn main() {
let a = Some("...".to_owned());
let b = match a {
Some(_) if { drop(a); false } => None,
x => x, //~ ERROR use of moved value: `a`
};
println!("{:?}", b);

let a = Some("...".to_owned());
let b = match a {
Some(_) if let Some(()) = { drop(a); None } => None,
x => x, //~ ERROR use of moved value: `a`
};
}
20 changes: 18 additions & 2 deletions src/test/ui/borrowck/issue-31287-drop-in-guard.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0382]: use of moved value: `a`
--> $DIR/issue-31287-drop-in-guard.rs:5:9
--> $DIR/issue-31287-drop-in-guard.rs:7:9
|
LL | let a = Some("...".to_owned());
| - move occurs because `a` has type `Option<String>`, which does not implement the `Copy` trait
Expand All @@ -14,6 +14,22 @@ help: consider cloning the value if the performance cost is acceptable
LL | Some(_) if { drop(a.clone()); false } => None,
| ++++++++

error: aborting due to previous error
error[E0382]: use of moved value: `a`
--> $DIR/issue-31287-drop-in-guard.rs:13:9
|
LL | let a = Some("...".to_owned());
| - move occurs because `a` has type `Option<String>`, which does not implement the `Copy` trait
LL | let b = match a {
LL | Some(_) if let Some(()) = { drop(a); None } => None,
| - value moved here
LL | x => x,
| ^ value used here after move
|
help: consider cloning the value if the performance cost is acceptable
|
LL | Some(_) if let Some(()) = { drop(a.clone()); None } => None,
| ++++++++

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0382`.
2 changes: 1 addition & 1 deletion src/test/ui/fmt/ifmt-bad-arg.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ LL | format!("foo %s baz", "bar");
| |
| help: format specifiers use curly braces: `{}`
|
= note: printf formatting not supported; see the documentation for `std::fmt`
= note: printf formatting is not supported; see the documentation for `std::fmt`

error: invalid format string: expected `'}'`, found `'t'`
--> $DIR/ifmt-bad-arg.rs:75:1
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/fmt/issue-89173.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ fn main() {
//~| NOTE: argument never used
//~| NOTE: argument never used
//~| NOTE: format specifiers use curly braces, and you have to use a positional or named parameter for the width
//~| NOTE: printf formatting not supported
//~| NOTE: printf formatting is not supported
}
2 changes: 1 addition & 1 deletion src/test/ui/fmt/issue-89173.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ note: format specifiers use curly braces, and you have to use a positional or na
|
LL | print!("%0*x", width, num);
| ^^^^
= note: printf formatting not supported; see the documentation for `std::fmt`
= note: printf formatting is not supported; see the documentation for `std::fmt`

error: aborting due to previous error

Loading

0 comments on commit ab10908

Please sign in to comment.