Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 84dd17b

Browse files
committed
Auto merge of rust-lang#110331 - matthiaskrgr:rollup-9vldvow, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#108687 (Reformulate `point_at_expr_source_of_inferred_type` to be more accurate) - rust-lang#109272 (Add Command environment variable inheritance docs) - rust-lang#109947 (Add links from `core::cmp` derives to their traits) - rust-lang#110110 (Use `Display` in top-level example for `PanicInfo`) - rust-lang#110154 (Fix typos in library) - rust-lang#110244 (Remove some unneeded imports / qualified paths) - rust-lang#110328 ([rustdoc] Add explanations for auto-disambiguation when an intra doc link is resolved to a proc-macro and a trait at the same time) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 276fa29 + 0d97522 commit 84dd17b

File tree

78 files changed

+409
-392
lines changed

Some content is hidden

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

78 files changed

+409
-392
lines changed

compiler/rustc_hir_typeck/src/demand.rs

Lines changed: 220 additions & 186 deletions
Large diffs are not rendered by default.

compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
472472
err_code: &str,
473473
fn_def_id: Option<DefId>,
474474
call_span: Span,
475-
call_expr: &hir::Expr<'tcx>,
475+
call_expr: &'tcx hir::Expr<'tcx>,
476476
) {
477477
// Next, let's construct the error
478478
let (error_span, full_call_span, call_name, is_method) = match &call_expr.kind {
@@ -807,24 +807,20 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
807807
full_call_span,
808808
format!("arguments to this {} are incorrect", call_name),
809809
);
810-
if let (Some(callee_ty), hir::ExprKind::MethodCall(_, rcvr, _, _)) =
811-
(callee_ty, &call_expr.kind)
810+
811+
if let hir::ExprKind::MethodCall(_, rcvr, _, _) = call_expr.kind
812+
&& provided_idx.as_usize() == expected_idx.as_usize()
812813
{
813-
// Type that would have accepted this argument if it hadn't been inferred earlier.
814-
// FIXME: We leave an inference variable for now, but it'd be nice to get a more
815-
// specific type to increase the accuracy of the diagnostic.
816-
let expected = self.infcx.next_ty_var(TypeVariableOrigin {
817-
kind: TypeVariableOriginKind::MiscVariable,
818-
span: full_call_span,
819-
});
820-
self.point_at_expr_source_of_inferred_type(
814+
self.note_source_of_type_mismatch_constraint(
821815
&mut err,
822816
rcvr,
823-
expected,
824-
callee_ty,
825-
provided_arg_span,
817+
crate::demand::TypeMismatchSource::Arg {
818+
call_expr,
819+
incompatible_arg: provided_idx.as_usize(),
820+
},
826821
);
827822
}
823+
828824
// Call out where the function is defined
829825
self.label_fn_like(
830826
&mut err,

library/alloc/benches/btree/map.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::collections::BTreeMap;
2-
use std::iter::Iterator;
32
use std::ops::RangeBounds;
43
use std::vec::Vec;
54

library/alloc/benches/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use rand::RngCore;
2-
use std::iter::{repeat, FromIterator};
2+
use std::iter::repeat;
33
use test::{black_box, Bencher};
44

55
#[bench]

library/alloc/src/boxed.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,13 @@ use core::any::Any;
150150
use core::async_iter::AsyncIterator;
151151
use core::borrow;
152152
use core::cmp::Ordering;
153-
use core::convert::{From, TryFrom};
154153
use core::error::Error;
155154
use core::fmt;
156155
use core::future::Future;
157156
use core::hash::{Hash, Hasher};
158-
#[cfg(not(no_global_oom_handling))]
159-
use core::iter::FromIterator;
160-
use core::iter::{FusedIterator, Iterator};
157+
use core::iter::FusedIterator;
161158
use core::marker::Tuple;
162-
use core::marker::{Unpin, Unsize};
159+
use core::marker::Unsize;
163160
use core::mem;
164161
use core::ops::{
165162
CoerceUnsized, Deref, DerefMut, DispatchFromDyn, Generator, GeneratorState, Receiver,

library/alloc/src/collections/binary_heap/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
#![stable(feature = "rust1", since = "1.0.0")]
145145

146146
use core::fmt;
147-
use core::iter::{FromIterator, FusedIterator, InPlaceIterable, SourceIter, TrustedLen};
147+
use core::iter::{FusedIterator, InPlaceIterable, SourceIter, TrustedLen};
148148
use core::mem::{self, swap, ManuallyDrop};
149149
use core::num::NonZeroUsize;
150150
use core::ops::{Deref, DerefMut};
@@ -263,7 +263,6 @@ mod tests;
263263
/// more detailed analysis.
264264
///
265265
/// [`core::cmp::Reverse`]: core::cmp::Reverse
266-
/// [`Ord`]: core::cmp::Ord
267266
/// [`Cell`]: core::cell::Cell
268267
/// [`RefCell`]: core::cell::RefCell
269268
/// [push]: BinaryHeap::push
@@ -1418,7 +1417,6 @@ impl<T> FusedIterator for Iter<'_, T> {}
14181417
/// (provided by the [`IntoIterator`] trait). See its documentation for more.
14191418
///
14201419
/// [`into_iter`]: BinaryHeap::into_iter
1421-
/// [`IntoIterator`]: core::iter::IntoIterator
14221420
#[stable(feature = "rust1", since = "1.0.0")]
14231421
#[derive(Clone)]
14241422
pub struct IntoIter<T> {

library/alloc/src/collections/btree/map.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use core::borrow::Borrow;
33
use core::cmp::Ordering;
44
use core::fmt::{self, Debug};
55
use core::hash::{Hash, Hasher};
6-
use core::iter::{FromIterator, FusedIterator};
6+
use core::iter::FusedIterator;
77
use core::marker::PhantomData;
88
use core::mem::{self, ManuallyDrop};
99
use core::ops::{Bound, Index, RangeBounds};
@@ -420,7 +420,6 @@ impl<'a, K: 'a, V: 'a> Default for IterMut<'a, K, V> {
420420
/// (provided by the [`IntoIterator`] trait). See its documentation for more.
421421
///
422422
/// [`into_iter`]: IntoIterator::into_iter
423-
/// [`IntoIterator`]: core::iter::IntoIterator
424423
#[stable(feature = "rust1", since = "1.0.0")]
425424
#[rustc_insignificant_dtor]
426425
pub struct IntoIter<
@@ -650,7 +649,7 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
650649
#[stable(feature = "rust1", since = "1.0.0")]
651650
pub fn clear(&mut self) {
652651
// avoid moving the allocator
653-
mem::drop(BTreeMap {
652+
drop(BTreeMap {
654653
root: mem::replace(&mut self.root, None),
655654
length: mem::replace(&mut self.length, 0),
656655
alloc: self.alloc.clone(),

library/alloc/src/collections/btree/map/tests.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ use crate::testing::ord_chaos::{Cyclic3, Governed, Governor};
99
use crate::testing::rng::DeterministicRng;
1010
use crate::vec::Vec;
1111
use std::cmp::Ordering;
12-
use std::convert::TryFrom;
13-
use std::iter::{self, FromIterator};
12+
use std::iter;
1413
use std::mem;
1514
use std::ops::Bound::{self, Excluded, Included, Unbounded};
1615
use std::ops::RangeBounds;

library/alloc/src/collections/btree/set.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use core::cmp::Ordering::{self, Equal, Greater, Less};
44
use core::cmp::{max, min};
55
use core::fmt::{self, Debug};
66
use core::hash::{Hash, Hasher};
7-
use core::iter::{FromIterator, FusedIterator, Peekable};
7+
use core::iter::{FusedIterator, Peekable};
88
use core::mem::ManuallyDrop;
99
use core::ops::{BitAnd, BitOr, BitXor, RangeBounds, Sub};
1010

@@ -30,7 +30,6 @@ use crate::alloc::{Allocator, Global};
3030
/// Iterators returned by [`BTreeSet::iter`] produce their items in order, and take worst-case
3131
/// logarithmic and amortized constant time per item returned.
3232
///
33-
/// [`Ord`]: core::cmp::Ord
3433
/// [`Cell`]: core::cell::Cell
3534
/// [`RefCell`]: core::cell::RefCell
3635
///
@@ -147,7 +146,6 @@ impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
147146
/// (provided by the [`IntoIterator`] trait). See its documentation for more.
148147
///
149148
/// [`into_iter`]: BTreeSet#method.into_iter
150-
/// [`IntoIterator`]: core::iter::IntoIterator
151149
#[stable(feature = "rust1", since = "1.0.0")]
152150
#[derive(Debug)]
153151
pub struct IntoIter<

library/alloc/src/collections/btree/set/tests.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use crate::testing::rng::DeterministicRng;
44
use crate::vec::Vec;
55
use std::cmp::Ordering;
66
use std::hash::{Hash, Hasher};
7-
use std::iter::FromIterator;
87
use std::ops::Bound::{Excluded, Included};
98
use std::panic::{catch_unwind, AssertUnwindSafe};
109

0 commit comments

Comments
 (0)