Skip to content

Commit 6a17902

Browse files
committed
Auto merge of #108919 - matthiaskrgr:rollup-g271pm2, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #108686 (rustdoc: include link on all.html location header) - #108846 (StableMIR: Proof-of-concept implementation + test ) - #108873 (Simplify `sort_by` calls) - #108883 (Suppress copy impl error when post-normalized type references errors) - #108884 (Tweak illegal `Copy` impl message) - #108887 (Rename `MapInPlace` as `FlatMapInPlace`.) - #108901 (fix: evaluate with wrong obligation stack) - #108903 (Move Clippy tests back to their intended directory) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 900c354 + 7732ccc commit 6a17902

File tree

74 files changed

+465
-165
lines changed

Some content is hidden

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

74 files changed

+465
-165
lines changed

Cargo.lock

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5283,15 +5283,9 @@ dependencies = [
52835283
name = "rustc_smir"
52845284
version = "0.0.0"
52855285
dependencies = [
5286-
"rustc_borrowck",
5287-
"rustc_driver",
5288-
"rustc_hir",
5289-
"rustc_interface",
52905286
"rustc_middle",
5291-
"rustc_mir_dataflow",
5292-
"rustc_mir_transform",
5293-
"rustc_serialize",
5294-
"rustc_trait_selection",
5287+
"rustc_span",
5288+
"tracing",
52955289
]
52965290

52975291
[[package]]

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::ptr::P;
1212
use crate::token::{self, Token};
1313
use crate::tokenstream::*;
1414

15-
use rustc_data_structures::map_in_place::MapInPlace;
15+
use rustc_data_structures::flat_map_in_place::FlatMapInPlace;
1616
use rustc_data_structures::sync::Lrc;
1717
use rustc_span::source_map::Spanned;
1818
use rustc_span::symbol::Ident;

compiler/rustc_data_structures/src/map_in_place.rs renamed to compiler/rustc_data_structures/src/flat_map_in_place.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,7 @@ use smallvec::{Array, SmallVec};
22
use std::ptr;
33
use thin_vec::ThinVec;
44

5-
pub trait MapInPlace<T>: Sized {
6-
fn map_in_place<F>(&mut self, mut f: F)
7-
where
8-
F: FnMut(T) -> T,
9-
{
10-
self.flat_map_in_place(|e| Some(f(e)))
11-
}
12-
5+
pub trait FlatMapInPlace<T>: Sized {
136
fn flat_map_in_place<F, I>(&mut self, f: F)
147
where
158
F: FnMut(T) -> I,
@@ -66,14 +59,14 @@ macro_rules! flat_map_in_place {
6659
};
6760
}
6861

69-
impl<T> MapInPlace<T> for Vec<T> {
62+
impl<T> FlatMapInPlace<T> for Vec<T> {
7063
flat_map_in_place!();
7164
}
7265

73-
impl<T, A: Array<Item = T>> MapInPlace<T> for SmallVec<A> {
66+
impl<T, A: Array<Item = T>> FlatMapInPlace<T> for SmallVec<A> {
7467
flat_map_in_place!();
7568
}
7669

77-
impl<T> MapInPlace<T> for ThinVec<T> {
70+
impl<T> FlatMapInPlace<T> for ThinVec<T> {
7871
flat_map_in_place!();
7972
}

compiler/rustc_data_structures/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ pub fn cold_path<F: FnOnce() -> R, R>(f: F) -> R {
5050
pub mod base_n;
5151
pub mod binary_search_util;
5252
pub mod captures;
53+
pub mod flat_map_in_place;
5354
pub mod flock;
5455
pub mod functor;
5556
pub mod fx;
5657
pub mod graph;
5758
pub mod intern;
5859
pub mod jobserver;
5960
pub mod macros;
60-
pub mod map_in_place;
6161
pub mod obligation_forest;
6262
pub mod owning_ref;
6363
pub mod sip128;

compiler/rustc_expand/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use rustc_ast::tokenstream::{LazyAttrTokenStream, TokenTree};
1212
use rustc_ast::NodeId;
1313
use rustc_ast::{self as ast, AttrStyle, Attribute, HasAttrs, HasTokens, MetaItem};
1414
use rustc_attr as attr;
15+
use rustc_data_structures::flat_map_in_place::FlatMapInPlace;
1516
use rustc_data_structures::fx::FxHashMap;
16-
use rustc_data_structures::map_in_place::MapInPlace;
1717
use rustc_feature::{Feature, Features, State as FeatureState};
1818
use rustc_feature::{
1919
ACCEPTED_FEATURES, ACTIVE_FEATURES, REMOVED_FEATURES, STABLE_REMOVED_FEATURES,

compiler/rustc_expand/src/expand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_ast::{ForeignItemKind, HasAttrs, HasNodeId};
2020
use rustc_ast::{Inline, ItemKind, MacStmtStyle, MetaItemKind, ModKind};
2121
use rustc_ast::{NestedMetaItem, NodeId, PatKind, StmtKind, TyKind};
2222
use rustc_ast_pretty::pprust;
23-
use rustc_data_structures::map_in_place::MapInPlace;
23+
use rustc_data_structures::flat_map_in_place::FlatMapInPlace;
2424
use rustc_data_structures::sync::Lrc;
2525
use rustc_errors::PResult;
2626
use rustc_feature::Features;

compiler/rustc_hir_analysis/locales/en-US.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ hir_analysis_missing_type_params =
8989
.note = because of the default `Self` reference, type parameters must be specified on object types
9090
9191
hir_analysis_copy_impl_on_type_with_dtor =
92-
the trait `Copy` may not be implemented for this type; the type has a destructor
92+
the trait `Copy` cannot be implemented for this type; the type has a destructor
9393
.label = `Copy` not allowed on types with destructors
9494
9595
hir_analysis_multiple_relaxed_default_bounds =
9696
type parameter has more than one relaxed default bound, only one is supported
9797
9898
hir_analysis_copy_impl_on_non_adt =
99-
the trait `Copy` may not be implemented for this type
99+
the trait `Copy` cannot be implemented for this type
100100
.label = type is not a structure or enumeration
101101
102102
hir_analysis_const_impl_for_non_const_trait =

compiler/rustc_hir_analysis/src/coherence/builtin.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//! up data structures required by type-checking/codegen.
33
44
use crate::errors::{CopyImplOnNonAdt, CopyImplOnTypeWithDtor, DropImplOnWrongItem};
5+
use rustc_data_structures::fx::FxHashSet;
56
use rustc_errors::{struct_span_err, MultiSpan};
67
use rustc_hir as hir;
78
use rustc_hir::def_id::{DefId, LocalDefId};
@@ -86,15 +87,22 @@ fn visit_implementation_of_copy(tcx: TyCtxt<'_>, impl_did: LocalDefId) {
8687
tcx.sess,
8788
span,
8889
E0204,
89-
"the trait `Copy` may not be implemented for this type"
90+
"the trait `Copy` cannot be implemented for this type"
9091
);
9192

9293
// We'll try to suggest constraining type parameters to fulfill the requirements of
9394
// their `Copy` implementation.
9495
let mut errors: BTreeMap<_, Vec<_>> = Default::default();
9596
let mut bounds = vec![];
9697

98+
let mut seen_tys = FxHashSet::default();
99+
97100
for (field, ty, reason) in fields {
101+
// Only report an error once per type.
102+
if !seen_tys.insert(ty) {
103+
continue;
104+
}
105+
98106
let field_span = tcx.def_span(field.did);
99107
err.span_label(field_span, "this field does not implement `Copy`");
100108

compiler/rustc_hir_typeck/locales/en-US.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ hir_typeck_field_multiply_specified_in_initializer =
44
.previous_use_label = first use of `{$ident}`
55
66
hir_typeck_copy_impl_on_type_with_dtor =
7-
the trait `Copy` may not be implemented for this type; the type has a destructor
7+
the trait `Copy` cannot be implemented for this type; the type has a destructor
88
.label = `Copy` not allowed on types with destructors
99
1010
hir_typeck_multiple_relaxed_default_bounds =
1111
type parameter has more than one relaxed default bound, only one is supported
1212
1313
hir_typeck_copy_impl_on_non_adt =
14-
the trait `Copy` may not be implemented for this type
14+
the trait `Copy` cannot be implemented for this type
1515
.label = type is not a structure or enumeration
1616
1717
hir_typeck_trait_object_declared_with_no_traits =

compiler/rustc_hir_typeck/src/method/probe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
10311031
.collect();
10321032

10331033
// Sort them by the name so we have a stable result.
1034-
names.sort_by(|a, b| a.as_str().partial_cmp(b.as_str()).unwrap());
1034+
names.sort_by(|a, b| a.as_str().cmp(b.as_str()));
10351035
names
10361036
}
10371037

0 commit comments

Comments
 (0)