Skip to content

Commit cac7c12

Browse files
fixed *const [type error] does not implement the Copy trait
1 parent b08dd92 commit cac7c12

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

compiler/rustc_hir_analysis/src/check/intrinsicck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
6868
let asm_ty = match *ty.kind() {
6969
// `!` is allowed for input but not for output (issue #87802)
7070
ty::Never if is_input => return None,
71-
ty::Error(_) => return None,
71+
_ if ty.references_error() => return None,
7272
ty::Int(IntTy::I8) | ty::Uint(UintTy::U8) => Some(InlineAsmType::I8),
7373
ty::Int(IntTy::I16) | ty::Uint(UintTy::U16) => Some(InlineAsmType::I16),
7474
ty::Int(IntTy::I32) | ty::Uint(UintTy::U32) => Some(InlineAsmType::I32),

tests/ui/asm/issue-113788.rs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// test that "error: arguments for inline assembly must be copyable" doesn't show up in this code
2+
// needs-asm-support
3+
// only-x86_64
4+
fn main() {
5+
let peb: *const PEB; //~ ERROR cannot find type `PEB` in this scope [E0412]
6+
unsafe { std::arch::asm!("mov {0}, fs:[0x30]", out(reg) peb); }
7+
}

tests/ui/asm/issue-113788.stderr

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0412]: cannot find type `PEB` in this scope
2+
--> $DIR/issue-113788.rs:5:21
3+
|
4+
LL | let peb: *const PEB;
5+
| ^^^ not found in this scope
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0412`.

0 commit comments

Comments
 (0)