Skip to content

Commit

Permalink
Rollup merge of #114752 - RickleAndMortimer:issue-113788-fix, r=compi…
Browse files Browse the repository at this point in the history
…ler-errors

fixed *const [type error] does not implement the Copy trait

Removes "error: arguments for inline assembly must be copyable" when moving an unknown type

Fixes: #113788
  • Loading branch information
matthiaskrgr authored Aug 14, 2023
2 parents 106d686 + cac7c12 commit 378c2fd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/check/intrinsicck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
let asm_ty = match *ty.kind() {
// `!` is allowed for input but not for output (issue #87802)
ty::Never if is_input => return None,
ty::Error(_) => return None,
_ if ty.references_error() => return None,
ty::Int(IntTy::I8) | ty::Uint(UintTy::U8) => Some(InlineAsmType::I8),
ty::Int(IntTy::I16) | ty::Uint(UintTy::U16) => Some(InlineAsmType::I16),
ty::Int(IntTy::I32) | ty::Uint(UintTy::U32) => Some(InlineAsmType::I32),
Expand Down
7 changes: 7 additions & 0 deletions tests/ui/asm/issue-113788.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// test that "error: arguments for inline assembly must be copyable" doesn't show up in this code
// needs-asm-support
// only-x86_64
fn main() {
let peb: *const PEB; //~ ERROR cannot find type `PEB` in this scope [E0412]
unsafe { std::arch::asm!("mov {0}, fs:[0x30]", out(reg) peb); }
}
9 changes: 9 additions & 0 deletions tests/ui/asm/issue-113788.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0412]: cannot find type `PEB` in this scope
--> $DIR/issue-113788.rs:5:21
|
LL | let peb: *const PEB;
| ^^^ not found in this scope

error: aborting due to previous error

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

0 comments on commit 378c2fd

Please sign in to comment.