// point to the `const` statement as a secondary span
// they don't have any label
for sp in primary_spans {
- lint.span_label(sp, "");
+ if sp != span {
+ lint.span_label(sp, "");
+ }
}
}
lint.emit();
--> $DIR/promoted_errors.rs:14:20
|
LL | println!("{}", 1/(false as u32));
- | ^^^^^^^^^^^^^^^^
- | |
- | attempt to divide by zero
+ | ^^^^^^^^^^^^^^^^ attempt to divide by zero
warning: reaching this expression at runtime will panic or abort
--> $DIR/promoted_errors.rs:9:20
|
LL | println!("{}", 1/(1-1));
- | ^^^^^^^
- | |
- | attempt to divide by zero
+ | ^^^^^^^ attempt to divide by zero
error: any use of this value will cause an error
--> $DIR/dangling-alloc-id-ice.rs:8:1
|
-LL | const FOO: &() = {
- | _^
- | |_|
- | ||
-LL | || let y = ();
-LL | || unsafe { Foo { y: &y }.long_live_the_unit }
-LL | || };
- | || ^
- | ||__|
- | |___type validation failed: encountered dangling pointer in final constant
- |
+LL | / const FOO: &() = {
+LL | | let y = ();
+LL | | unsafe { Foo { y: &y }.long_live_the_unit }
+LL | | };
+ | |__^ type validation failed: encountered dangling pointer in final constant
|
= note: #[deny(const_err)] on by default
error: any use of this value will cause an error
--> $DIR/dangling_raw_ptr.rs:1:1
|
-LL | const FOO: *const u32 = {
- | _^
- | |_|
- | ||
-LL | || let x = 42;
-LL | || &x
-LL | || };
- | || ^
- | ||__|
- | |___type validation failed: encountered dangling pointer in final constant
- |
+LL | / const FOO: *const u32 = {
+LL | | let x = 42;
+LL | | &x
+LL | | };
+ | |__^ type validation failed: encountered dangling pointer in final constant
|
= note: #[deny(const_err)] on by default