Rollup merge of #35778 - clementmiao:E0395_new_error_format, r=jonathandturner
updated E0395 to new error format Updated E0395 to new error format. Part of #35233 Fixes #35693 Thanks again for letting me help! r? @jonathandturner
This commit is contained in:
commit
7c843c4663
@ -681,9 +681,14 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> {
|
||||
|
||||
self.add(Qualif::NOT_CONST);
|
||||
if self.mode != Mode::Fn {
|
||||
span_err!(self.tcx.sess, self.span, E0395,
|
||||
"raw pointers cannot be compared in {}s",
|
||||
self.mode);
|
||||
struct_span_err!(
|
||||
self.tcx.sess, self.span, E0395,
|
||||
"raw pointers cannot be compared in {}s",
|
||||
self.mode)
|
||||
.span_label(
|
||||
self.span,
|
||||
&format!("comparing raw pointers in static"))
|
||||
.emit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,6 @@ static FOO: i32 = 42;
|
||||
static BAR: i32 = 42;
|
||||
|
||||
static BAZ: bool = { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR E0395
|
||||
|
||||
//~| NOTE comparing raw pointers in static
|
||||
fn main() {
|
||||
}
|
||||
|
@ -12,5 +12,6 @@ fn id<T>(t: T) -> T { t }
|
||||
fn main() {
|
||||
const A: bool = id::<u8> as *const () < id::<u16> as *const ();
|
||||
//~^ ERROR raw pointers cannot be compared in constants [E0395]
|
||||
//~^^ NOTE comparing raw pointers in static
|
||||
println!("{}", A);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user