Skip to content

Commit c222e7e

Browse files
tesujiflip1995
authored andcommitted
Add regression test for looking for trait defid in nocore
1 parent dac2509 commit c222e7e

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

tests/ui/def_id_nocore.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// ignore-windows
2+
// ignore-macos
3+
4+
#![feature(no_core, lang_items, start)]
5+
#![no_core]
6+
7+
#[link(name = "c")]
8+
extern "C" {}
9+
10+
#[lang = "sized"]
11+
pub trait Sized {}
12+
#[lang = "copy"]
13+
pub trait Copy {}
14+
#[lang = "freeze"]
15+
pub unsafe trait Freeze {}
16+
17+
#[lang = "start"]
18+
#[start]
19+
fn start(_argc: isize, _argv: *const *const u8) -> isize {
20+
0
21+
}
22+
23+
pub struct A;
24+
25+
impl A {
26+
pub fn as_ref(self) -> &'static str {
27+
"A"
28+
}
29+
}

tests/ui/def_id_nocore.stderr

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: methods called `as_*` usually take self by reference or self by mutable reference; consider choosing a less ambiguous name
2+
--> $DIR/def_id_nocore.rs:26:19
3+
|
4+
LL | pub fn as_ref(self) -> &'static str {
5+
| ^^^^
6+
|
7+
= note: `-D clippy::wrong-self-convention` implied by `-D warnings`
8+
9+
error: aborting due to previous error
10+

0 commit comments

Comments
 (0)