Skip to content

Commit 9b41190

Browse files
committed
Auto merge of #114951 - cuviper:rollup-iitoep5, r=cuviper
Rollup of 5 pull requests Successful merges: - #113715 (Unstable Book: update `lang_items` page and split it) - #114897 (Partially revert #107200) - #114913 (Fix suggestion for attempting to define a string with single quotes) - #114931 (Revert PR #114052 to fix invalid suggestion) - #114944 (update `thiserror` to version >= 1.0.46) r? `@ghost` `@rustbot` modify labels: rollup
2 parents ccc3ac0 + df877c0 commit 9b41190

File tree

19 files changed

+223
-338
lines changed

19 files changed

+223
-338
lines changed

Cargo.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -5126,9 +5126,9 @@ checksum = "aac81b6fd6beb5884b0cf3321b8117e6e5d47ecb6fc89f414cfdcca8b2fe2dd8"
51265126

51275127
[[package]]
51285128
name = "thiserror"
5129-
version = "1.0.40"
5129+
version = "1.0.47"
51305130
source = "registry+https://github.com/rust-lang/crates.io-index"
5131-
checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac"
5131+
checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f"
51325132
dependencies = [
51335133
"thiserror-impl",
51345134
]
@@ -5155,9 +5155,9 @@ dependencies = [
51555155

51565156
[[package]]
51575157
name = "thiserror-impl"
5158-
version = "1.0.40"
5158+
version = "1.0.47"
51595159
source = "registry+https://github.com/rust-lang/crates.io-index"
5160-
checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
5160+
checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b"
51615161
dependencies = [
51625162
"proc-macro2",
51635163
"quote",

compiler/rustc_error_codes/src/error_codes/E0132.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ It is not possible to declare type parameters on a function that has the `start`
1313
attribute. Such a function must have the following type signature (for more
1414
information, view [the unstable book][1]):
1515

16-
[1]: https://doc.rust-lang.org/unstable-book/language-features/lang-items.html#writing-an-executable-without-stdlib
16+
[1]: https://doc.rust-lang.org/unstable-book/language-features/start.html
1717

1818
```
1919
# let _:

compiler/rustc_error_codes/src/error_codes/E0152.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ attributes:
2020
#![no_std]
2121
```
2222

23-
See also the [unstable book][1].
23+
See also [this section of the Rustonomicon][beneath std].
2424

25-
[1]: https://doc.rust-lang.org/unstable-book/language-features/lang-items.html#writing-an-executable-without-stdlib
25+
[beneath std]: https://doc.rust-lang.org/nomicon/beneath-std.html

compiler/rustc_hir_typeck/src/demand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
5353
|| self.suggest_no_capture_closure(err, expected, expr_ty)
5454
|| self.suggest_boxing_when_appropriate(err, expr.span, expr.hir_id, expected, expr_ty)
5555
|| self.suggest_block_to_brackets_peeling_refs(err, expr, expr_ty, expected)
56-
|| self.suggest_copied_cloned_or_as_ref(err, expr, expr_ty, expected, expected_ty_expr)
56+
|| self.suggest_copied_cloned_or_as_ref(err, expr, expr_ty, expected)
5757
|| self.suggest_clone_for_ref(err, expr, expr_ty, expected)
5858
|| self.suggest_into(err, expr, expr_ty, expected)
5959
|| self.suggest_floating_point_literal(err, expr, expected)

compiler/rustc_hir_typeck/src/errors.rs

+15-14
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ impl HelpUseLatestEdition {
253253
}
254254

255255
#[derive(Subdiagnostic)]
256-
pub enum OptionResultRefMismatch<'tcx> {
256+
pub enum OptionResultRefMismatch {
257257
#[suggestion(
258258
hir_typeck_option_result_copied,
259259
code = ".copied()",
@@ -276,19 +276,20 @@ pub enum OptionResultRefMismatch<'tcx> {
276276
span: Span,
277277
def_path: String,
278278
},
279-
#[suggestion(
280-
hir_typeck_option_result_asref,
281-
code = ".as_ref()",
282-
style = "verbose",
283-
applicability = "machine-applicable"
284-
)]
285-
AsRef {
286-
#[primary_span]
287-
span: Span,
288-
def_path: String,
289-
expected_ty: Ty<'tcx>,
290-
expr_ty: Ty<'tcx>,
291-
},
279+
// FIXME: #114050
280+
// #[suggestion(
281+
// hir_typeck_option_result_asref,
282+
// code = ".as_ref()",
283+
// style = "verbose",
284+
// applicability = "machine-applicable"
285+
// )]
286+
// AsRef {
287+
// #[primary_span]
288+
// span: Span,
289+
// def_path: String,
290+
// expected_ty: Ty<'tcx>,
291+
// expr_ty: Ty<'tcx>,
292+
// },
292293
}
293294

294295
#[derive(Diagnostic)]

compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10971097
expr: &hir::Expr<'_>,
10981098
expr_ty: Ty<'tcx>,
10991099
expected_ty: Ty<'tcx>,
1100-
expected_ty_expr: Option<&'tcx hir::Expr<'tcx>>,
11011100
) -> bool {
11021101
let ty::Adt(adt_def, args) = expr_ty.kind() else {
11031102
return false;
@@ -1115,7 +1114,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11151114
{
11161115
let expr_inner_ty = args.type_at(0);
11171116
let expected_inner_ty = expected_args.type_at(0);
1118-
if let &ty::Ref(_, ty, mutability) = expr_inner_ty.kind()
1117+
if let &ty::Ref(_, ty, _mutability) = expr_inner_ty.kind()
11191118
&& self.can_eq(self.param_env, ty, expected_inner_ty)
11201119
{
11211120
let def_path = self.tcx.def_path_str(adt_def.did());
@@ -1124,14 +1123,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11241123
errors::OptionResultRefMismatch::Copied {
11251124
span, def_path
11261125
}
1127-
} else if let Some(expected_ty_expr) = expected_ty_expr
1128-
// FIXME: suggest changes to both expressions to convert both to
1129-
// Option/Result<&T>
1130-
&& mutability.is_not()
1131-
{
1132-
errors::OptionResultRefMismatch::AsRef {
1133-
span: expected_ty_expr.span.shrink_to_hi(), expected_ty, expr_ty, def_path
1134-
}
11351126
} else if let Some(clone_did) = self.tcx.lang_items().clone_trait()
11361127
&& rustc_trait_selection::traits::type_known_to_meet_bound_modulo_regions(
11371128
self,

compiler/rustc_parse/src/lexer/unescape_error_reporting.rs

+8-14
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,14 @@ pub(crate) fn emit_unescape_error(
8080
let sugg = sugg.unwrap_or_else(|| {
8181
let prefix = mode.prefix_noraw();
8282
let mut escaped = String::with_capacity(lit.len());
83-
let mut chrs = lit.chars().peekable();
84-
while let Some(first) = chrs.next() {
85-
match (first, chrs.peek()) {
86-
('\\', Some('"')) => {
87-
escaped.push('\\');
88-
escaped.push('"');
89-
chrs.next();
90-
}
91-
('"', _) => {
92-
escaped.push('\\');
93-
escaped.push('"')
94-
}
95-
(c, _) => escaped.push(c),
96-
};
83+
let mut in_escape = false;
84+
for c in lit.chars() {
85+
match c {
86+
'\\' => in_escape = !in_escape,
87+
'"' if !in_escape => escaped.push('\\'),
88+
_ => in_escape = false,
89+
}
90+
escaped.push(c);
9791
}
9892
let sugg = format!("{prefix}\"{escaped}\"");
9993
MoreThanOneCharSugg::Quotes {

library/std/src/io/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1425,9 +1425,9 @@ pub trait Write {
14251425
///
14261426
/// If this method consumed `n > 0` bytes of `buf` it must return [`Ok(n)`].
14271427
/// If the return value is `Ok(n)` then `n` must satisfy `n <= buf.len()`.
1428-
/// Unless `buf` is empty, this function shouldn’t return `Ok(0)` since the
1429-
/// caller may interpret that as an error. To indicate lack of space,
1430-
/// implementors should return [`ErrorKind::StorageFull`] error instead.
1428+
/// A return value of `Ok(0)` typically means that the underlying object is
1429+
/// no longer able to accept bytes and will likely not be able to in the
1430+
/// future as well, or that the buffer provided is empty.
14311431
///
14321432
/// # Errors
14331433
///

0 commit comments

Comments
 (0)