Skip to content

Rollup of 8 pull requests #108919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
40185db
Delete old re-exports from rustc_smir
celinval Mar 4, 2023
af664be
rustdoc: include link on all.html location header
notriddle Mar 3, 2023
b66db7e
Create new rustc_smir struct to map future crates
celinval Mar 4, 2023
775bacd
Simplify `sort_by` calls
WaffleLapkin Mar 7, 2023
5eaeb71
Change item collection to be on demand
celinval Mar 7, 2023
a439c02
may not => cannot
compiler-errors Mar 7, 2023
0f4255e
Dedup copy field errors for identical types
compiler-errors Mar 8, 2023
8a99ffc
Suppress copy impl error when post-normalized type references errors
compiler-errors Mar 7, 2023
be60bcb
Rename `MapInPlace` as `FlatMapInPlace`.
nnethercote Mar 8, 2023
204ba32
fix: evaluate with wrong obligation stack
LYF1999 Mar 8, 2023
1d442af
move clippy tests back to their intended directory
pietroalbini Mar 8, 2023
6c91ce2
Rollup merge of #108686 - notriddle:notriddle/jank-all, r=jsha
matthiaskrgr Mar 8, 2023
9b6b7a3
Rollup merge of #108846 - celinval:smir-poc, r=oli-obk
matthiaskrgr Mar 8, 2023
1a9376d
Rollup merge of #108873 - WaffleLapkin:cmp, r=cjgillot
matthiaskrgr Mar 8, 2023
f6b8a9f
Rollup merge of #108883 - compiler-errors:post-norm-copy-err, r=BoxyUwU
matthiaskrgr Mar 8, 2023
031b528
Rollup merge of #108884 - compiler-errors:tweak-illegal-copy-impl-mes…
matthiaskrgr Mar 8, 2023
a95943b
Rollup merge of #108887 - nnethercote:rename-MapInPlace, r=lqd
matthiaskrgr Mar 8, 2023
33c3036
Rollup merge of #108901 - LYF1999:yf/108897, r=lcnr
matthiaskrgr Mar 8, 2023
7732ccc
Rollup merge of #108903 - rust-lang:pa-fix-clippy-tests, r=flip1995
matthiaskrgr Mar 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
may not => cannot
  • Loading branch information
compiler-errors committed Mar 8, 2023
commit a439c0293cc7aa31d89f76abfe03eb5fdeebde1a
4 changes: 2 additions & 2 deletions compiler/rustc_hir_analysis/locales/en-US.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ hir_analysis_missing_type_params =
.note = because of the default `Self` reference, type parameters must be specified on object types

hir_analysis_copy_impl_on_type_with_dtor =
the trait `Copy` may not be implemented for this type; the type has a destructor
the trait `Copy` cannot be implemented for this type; the type has a destructor
.label = `Copy` not allowed on types with destructors

hir_analysis_multiple_relaxed_default_bounds =
type parameter has more than one relaxed default bound, only one is supported

hir_analysis_copy_impl_on_non_adt =
the trait `Copy` may not be implemented for this type
the trait `Copy` cannot be implemented for this type
.label = type is not a structure or enumeration

hir_analysis_const_impl_for_non_const_trait =
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/coherence/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ fn visit_implementation_of_copy(tcx: TyCtxt<'_>, impl_did: LocalDefId) {
tcx.sess,
span,
E0204,
"the trait `Copy` may not be implemented for this type"
"the trait `Copy` cannot be implemented for this type"
);

// We'll try to suggest constraining type parameters to fulfill the requirements of
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_hir_typeck/locales/en-US.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ hir_typeck_field_multiply_specified_in_initializer =
.previous_use_label = first use of `{$ident}`

hir_typeck_copy_impl_on_type_with_dtor =
the trait `Copy` may not be implemented for this type; the type has a destructor
the trait `Copy` cannot be implemented for this type; the type has a destructor
.label = `Copy` not allowed on types with destructors

hir_typeck_multiple_relaxed_default_bounds =
type parameter has more than one relaxed default bound, only one is supported

hir_typeck_copy_impl_on_non_adt =
the trait `Copy` may not be implemented for this type
the trait `Copy` cannot be implemented for this type
.label = type is not a structure or enumeration

hir_typeck_trait_object_declared_with_no_traits =
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ pub trait StructuralEq {
/// attempt to derive a `Copy` implementation, we'll get an error:
///
/// ```text
/// the trait `Copy` may not be implemented for this type; field `points` does not implement `Copy`
/// the trait `Copy` cannot be implemented for this type; field `points` does not implement `Copy`
/// ```
///
/// Shared references (`&T`) are also `Copy`, so a type can be `Copy`, even when it holds
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/coherence/coherence-impls-copy.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ LL | impl Copy for [MyType] {}
|
= note: define and implement a trait or new type instead

error[E0206]: the trait `Copy` may not be implemented for this type
error[E0206]: the trait `Copy` cannot be implemented for this type
--> $DIR/coherence-impls-copy.rs:21:15
|
LL | impl Copy for &'static mut MyType {}
| ^^^^^^^^^^^^^^^^^^^ type is not a structure or enumeration

error[E0206]: the trait `Copy` may not be implemented for this type
error[E0206]: the trait `Copy` cannot be implemented for this type
--> $DIR/coherence-impls-copy.rs:25:15
|
LL | impl Copy for (MyType, MyType) {}
| ^^^^^^^^^^^^^^^^ type is not a structure or enumeration

error[E0206]: the trait `Copy` may not be implemented for this type
error[E0206]: the trait `Copy` cannot be implemented for this type
--> $DIR/coherence-impls-copy.rs:30:15
|
LL | impl Copy for [MyType] {}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/coherence/deep-bad-copy-reason.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<'tcx, T> Clone for List<'tcx, T> {
}

impl<'tcx, T> Copy for List<'tcx, T> {}
//~^ ERROR the trait `Copy` may not be implemented for this type
//~^ ERROR the trait `Copy` cannot be implemented for this type

fn assert_is_copy<T: Copy>() {}

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/coherence/deep-bad-copy-reason.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0204]: the trait `Copy` may not be implemented for this type
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/deep-bad-copy-reason.rs:33:24
|
LL | pub struct List<'tcx, T>(Interned<'tcx, ListS<T>>);
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/error-codes/E0184.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor
error[E0184]: the trait `Copy` cannot be implemented for this type; the type has a destructor
--> $DIR/E0184.rs:1:10
|
LL | #[derive(Copy)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/error-codes/E0206.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
struct Bar;

impl Copy for &'static mut Bar { }
//~^ ERROR the trait `Copy` may not be implemented for this type
//~^ ERROR the trait `Copy` cannot be implemented for this type

fn main() {
}
2 changes: 1 addition & 1 deletion tests/ui/error-codes/E0206.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0206]: the trait `Copy` may not be implemented for this type
error[E0206]: the trait `Copy` cannot be implemented for this type
--> $DIR/E0206.rs:4:15
|
LL | impl Copy for &'static mut Bar { }
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/exclusive-drop-and-copy.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// issue #20126

#[derive(Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented
#[derive(Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented
struct Foo;

impl Drop for Foo {
fn drop(&mut self) {}
}

#[derive(Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented
#[derive(Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented
struct Bar<T>(::std::marker::PhantomData<T>);

impl<T> Drop for Bar<T> {
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/exclusive-drop-and-copy.stderr
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor
error[E0184]: the trait `Copy` cannot be implemented for this type; the type has a destructor
--> $DIR/exclusive-drop-and-copy.rs:3:10
|
LL | #[derive(Copy, Clone)]
| ^^^^ `Copy` not allowed on types with destructors
|
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor
error[E0184]: the trait `Copy` cannot be implemented for this type; the type has a destructor
--> $DIR/exclusive-drop-and-copy.rs:10:10
|
LL | #[derive(Copy, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/issues/issue-27340.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
struct Foo;
#[derive(Copy, Clone)]
//~^ ERROR the trait `Copy` may not be implemented for this type
//~^ ERROR the trait `Copy` cannot be implemented for this type
struct Bar(Foo);

fn main() {}
2 changes: 1 addition & 1 deletion tests/ui/issues/issue-27340.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0204]: the trait `Copy` may not be implemented for this type
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/issue-27340.rs:2:10
|
LL | #[derive(Copy, Clone)]
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/opt-in-copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ struct IWantToCopyThis {
}

impl Copy for IWantToCopyThis {}
//~^ ERROR the trait `Copy` may not be implemented for this type
//~^ ERROR the trait `Copy` cannot be implemented for this type

enum CantCopyThisEither {
A,
Expand All @@ -17,6 +17,6 @@ enum IWantToCopyThisToo {
}

impl Copy for IWantToCopyThisToo {}
//~^ ERROR the trait `Copy` may not be implemented for this type
//~^ ERROR the trait `Copy` cannot be implemented for this type

fn main() {}
4 changes: 2 additions & 2 deletions tests/ui/opt-in-copy.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0204]: the trait `Copy` may not be implemented for this type
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/opt-in-copy.rs:7:15
|
LL | but_i_cant: CantCopyThis,
Expand All @@ -7,7 +7,7 @@ LL | but_i_cant: CantCopyThis,
LL | impl Copy for IWantToCopyThis {}
| ^^^^^^^^^^^^^^^

error[E0204]: the trait `Copy` may not be implemented for this type
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/opt-in-copy.rs:19:15
|
LL | ButICant(CantCopyThisEither),
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/range/range_traits-2.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0204]: the trait `Copy` may not be implemented for this type
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/range_traits-2.rs:3:10
|
LL | #[derive(Copy, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/range/range_traits-3.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0204]: the trait `Copy` may not be implemented for this type
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/range_traits-3.rs:3:10
|
LL | #[derive(Copy, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/range/range_traits-6.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0204]: the trait `Copy` may not be implemented for this type
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/range_traits-6.rs:3:10
|
LL | #[derive(Copy, Clone)]
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/span/E0204.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ struct Foo {
foo: Vec<u32>,
}

impl Copy for Foo { } //~ ERROR may not be implemented for this type
impl Copy for Foo { } //~ ERROR cannot be implemented for this type

#[derive(Copy)] //~ ERROR may not be implemented for this type
#[derive(Copy)] //~ ERROR cannot be implemented for this type
struct Foo2<'a> {
ty: &'a mut bool,
}
Expand All @@ -14,9 +14,9 @@ enum EFoo {
Baz,
}

impl Copy for EFoo { } //~ ERROR may not be implemented for this type
impl Copy for EFoo { } //~ ERROR cannot be implemented for this type

#[derive(Copy)] //~ ERROR may not be implemented for this type
#[derive(Copy)] //~ ERROR cannot be implemented for this type
enum EFoo2<'a> {
Bar(&'a mut bool),
Baz,
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/span/E0204.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0204]: the trait `Copy` may not be implemented for this type
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/E0204.rs:5:15
|
LL | foo: Vec<u32>,
Expand All @@ -7,7 +7,7 @@ LL | foo: Vec<u32>,
LL | impl Copy for Foo { }
| ^^^

error[E0204]: the trait `Copy` may not be implemented for this type
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/E0204.rs:7:10
|
LL | #[derive(Copy)]
Expand All @@ -18,7 +18,7 @@ LL | ty: &'a mut bool,
|
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0204]: the trait `Copy` may not be implemented for this type
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/E0204.rs:17:15
|
LL | Bar { x: Vec<u32> },
Expand All @@ -27,7 +27,7 @@ LL | Bar { x: Vec<u32> },
LL | impl Copy for EFoo { }
| ^^^^

error[E0204]: the trait `Copy` may not be implemented for this type
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/E0204.rs:19:10
|
LL | #[derive(Copy)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub struct Vector2<T: Debug + Copy + Clone>{
pub y: T
}

#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented for this type
#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented for this type
pub struct AABB<K: Copy + Debug>{
pub loc: Vector2<K>,
pub size: Vector2<K>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub struct Vector2<T: Debug + Copy + Clone>{
pub y: T
}

#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented for this type
#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented for this type
pub struct AABB<K: Copy>{
pub loc: Vector2<K>,
pub size: Vector2<K>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0204]: the trait `Copy` may not be implemented for this type
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/missing-bound-in-derive-copy-impl-3.rs:10:17
|
LL | #[derive(Debug, Copy, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/suggestions/missing-bound-in-derive-copy-impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub struct Vector2<T: Debug + Copy + Clone>{
pub y: T
}

#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented for this type
#[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented for this type
pub struct AABB<K>{
pub loc: Vector2<K>,
pub size: Vector2<K>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0204]: the trait `Copy` may not be implemented for this type
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/missing-bound-in-derive-copy-impl.rs:9:17
|
LL | #[derive(Debug, Copy, Clone)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ impl<T: std::fmt::Display> Clone for OnlyCopyIfDisplay<T> {
impl<T: std::fmt::Display> Copy for OnlyCopyIfDisplay<T> {}

impl<S: std::fmt::Display> Copy for Wrapper<OnlyCopyIfDisplay<S>> {}
//~^ ERROR the trait `Copy` may not be implemented for this type
//~^ ERROR the trait `Copy` cannot be implemented for this type

fn main() {}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ impl<T: std::fmt::Display> Clone for OnlyCopyIfDisplay<T> {
impl<T: std::fmt::Display> Copy for OnlyCopyIfDisplay<T> {}

impl<S> Copy for Wrapper<OnlyCopyIfDisplay<S>> {}
//~^ ERROR the trait `Copy` may not be implemented for this type
//~^ ERROR the trait `Copy` cannot be implemented for this type

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0204]: the trait `Copy` may not be implemented for this type
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/missing-bound-in-manual-copy-impl-2.rs:16:18
|
LL | struct Wrapper<T>(T);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
struct Wrapper<T>(T);

impl<S: Copy> Copy for Wrapper<S> {}
//~^ ERROR the trait `Copy` may not be implemented for this type
//~^ ERROR the trait `Copy` cannot be implemented for this type

fn main() {}
2 changes: 1 addition & 1 deletion tests/ui/suggestions/missing-bound-in-manual-copy-impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
struct Wrapper<T>(T);

impl<S> Copy for Wrapper<S> {}
//~^ ERROR the trait `Copy` may not be implemented for this type
//~^ ERROR the trait `Copy` cannot be implemented for this type

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0204]: the trait `Copy` may not be implemented for this type
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/missing-bound-in-manual-copy-impl.rs:6:18
|
LL | struct Wrapper<T>(T);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0204]: the trait `Copy` may not be implemented for this type
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/copy-is-not-modulo-regions.rs:13:21
|
LL | struct Bar<'lt>(Foo<'lt>);
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/traits/copy-is-not-modulo-regions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct Bar<'lt>(Foo<'lt>);

#[cfg(not_static)]
impl<'any> Copy for Bar<'any> {}
//[not_static]~^ the trait `Copy` may not be implemented for this type
//[not_static]~^ the trait `Copy` cannot be implemented for this type

#[cfg(yes_static)]
impl<'any> Copy for Bar<'static> {}
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/traits/issue-50480.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#[derive(Clone, Copy)]
//~^ ERROR the trait `Copy` may not be implemented for this type
//~^ ERROR the trait `Copy` cannot be implemented for this type
struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
//~^ ERROR cannot find type `NotDefined` in this scope
//~| ERROR cannot find type `NotDefined` in this scope
//~| ERROR cannot find type `N` in this scope
//~| ERROR cannot find type `N` in this scope

#[derive(Clone, Copy)]
//~^ ERROR the trait `Copy` may not be implemented for this type
//~^ ERROR the trait `Copy` cannot be implemented for this type
struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
//~^ ERROR cannot find type `NotDefined` in this scope
//~| ERROR cannot find type `N` in this scope
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/traits/issue-50480.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ error[E0412]: cannot find type `NotDefined` in this scope
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
| ^^^^^^^^^^ not found in this scope

error[E0204]: the trait `Copy` may not be implemented for this type
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/issue-50480.rs:1:17
|
LL | #[derive(Clone, Copy)]
Expand All @@ -73,7 +73,7 @@ LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
|
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0204]: the trait `Copy` may not be implemented for this type
error[E0204]: the trait `Copy` cannot be implemented for this type
--> $DIR/issue-50480.rs:9:17
|
LL | #[derive(Clone, Copy)]
Expand Down
Loading