Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
52f7a21
Relax ordering rules for `asm!` operands
Amanieu Dec 16, 2022
40185db
Delete old re-exports from rustc_smir
celinval Mar 4, 2023
2c9b8c5
Implementing "<test_binary> --list --format json" #107307 #49359
parthopdas Feb 8, 2023
b66db7e
Create new rustc_smir struct to map future crates
celinval Mar 4, 2023
8d13454
Canonicalize the ROOT VAR
compiler-errors Mar 7, 2023
3bfcfd0
fix var equality issue with old canonicalizer
compiler-errors Mar 7, 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
08e5a77
Don't report E0740 for type error
compiler-errors Mar 7, 2023
64eea3c
Tweak E0740
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
20a8119
Rollup merge of #105798 - Amanieu:relax-asm, r=joshtriplett
GuillaumeGomez Mar 8, 2023
d810534
Rollup merge of #108148 - parthopdas:master, r=oli-obk
GuillaumeGomez Mar 8, 2023
ae46eba
Rollup merge of #108839 - compiler-errors:canonicalize-the-root-var, …
GuillaumeGomez Mar 8, 2023
e4844a5
Rollup merge of #108846 - celinval:smir-poc, r=oli-obk
GuillaumeGomez Mar 8, 2023
292f553
Rollup merge of #108873 - WaffleLapkin:cmp, r=cjgillot
GuillaumeGomez Mar 8, 2023
780c2c1
Rollup merge of #108882 - compiler-errors:E0740, r=eholk
GuillaumeGomez Mar 8, 2023
5b7b922
Rollup merge of #108883 - compiler-errors:post-norm-copy-err, r=BoxyUwU
GuillaumeGomez Mar 8, 2023
62d18cb
Rollup merge of #108884 - compiler-errors:tweak-illegal-copy-impl-mes…
GuillaumeGomez Mar 8, 2023
ec7485c
Rollup merge of #108887 - nnethercote:rename-MapInPlace, r=lqd
GuillaumeGomez Mar 8, 2023
4b60218
Rollup merge of #108901 - LYF1999:yf/108897, r=lcnr
GuillaumeGomez 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
Suppress copy impl error when post-normalized type references errors
  • Loading branch information
compiler-errors committed Mar 8, 2023
commit 8a99ffc3442329d2fb2f07ce87852c3e12cc4d6a
7 changes: 6 additions & 1 deletion compiler/rustc_trait_selection/src/traits/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ pub fn type_allowed_to_implement_copy<'tcx>(
};
let ty = ocx.normalize(&normalization_cause, param_env, unnormalized_ty);
let normalization_errors = ocx.select_where_possible();
if !normalization_errors.is_empty() {

// NOTE: The post-normalization type may also reference errors,
// such as when we project to a missing type or we have a mismatch
// between expected and found const-generic types. Don't report an
// additional copy error here, since it's not typically useful.
if !normalization_errors.is_empty() || ty.references_error() {
tcx.sess.delay_span_bug(field_span, format!("couldn't normalize struct field `{unnormalized_ty}` when checking Copy implementation"));
continue;
}
Expand Down
16 changes: 16 additions & 0 deletions tests/ui/coherence/illegal-copy-bad-projection.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
trait AsPtr {
type Ptr;
}

impl AsPtr for () {
type Ptr = *const void;
//~^ ERROR cannot find type `void` in this scope
}

#[derive(Copy, Clone)]
struct Foo {
p: <() as AsPtr>::Ptr,
// Do not report a "`Copy` cannot be implemented" here.
}

fn main() {}
9 changes: 9 additions & 0 deletions tests/ui/coherence/illegal-copy-bad-projection.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0412]: cannot find type `void` in this scope
--> $DIR/illegal-copy-bad-projection.rs:6:23
|
LL | type Ptr = *const void;
| ^^^^ not found in this scope

error: aborting due to previous error

For more information about this error, try `rustc --explain E0412`.
9 changes: 9 additions & 0 deletions tests/ui/const-generics/bad-generic-in-copy-impl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#[derive(Copy, Clone)]
pub struct Foo {
x: [u8; SIZE],
//~^ ERROR mismatched types
}

const SIZE: u32 = 1;

fn main() {}
9 changes: 9 additions & 0 deletions tests/ui/const-generics/bad-generic-in-copy-impl.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0308]: mismatched types
--> $DIR/bad-generic-in-copy-impl.rs:3:13
|
LL | x: [u8; SIZE],
| ^^^^ expected `usize`, found `u32`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.