Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add AnonConst as potential parent_item #71477

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/librustc_middle/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,8 @@ impl<'hir> Map<'hir> {
pub fn get_parent_item(&self, hir_id: HirId) -> HirId {
for (hir_id, node) in self.parent_iter(hir_id) {
match node {
Node::Crate(_)
Node::AnonConst(_)
| Node::Crate(_)
| Node::Item(_)
| Node::ForeignItem(_)
| Node::TraitItem(_)
Expand Down
8 changes: 0 additions & 8 deletions src/test/ui/consts/enum-discr-type-err.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ LL | | }
| |_- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can convert an `i32` to `isize` and panic if the converted value wouldn't fit
|
LL | $( $v = $s::V.try_into().unwrap(), )*
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
--> $DIR/enum-discr-type-err.rs:18:21
Expand All @@ -29,10 +25,6 @@ LL | | }
| |_- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can convert an `i32` to `isize` and panic if the converted value wouldn't fit
|
LL | $( $v = $s::V.try_into().unwrap(), )*
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

Expand Down
40 changes: 0 additions & 40 deletions src/test/ui/discrim/discrim-ill-typed.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,88 +3,48 @@ error[E0308]: mismatched types
|
LL | OhNo = 0_u8,
| ^^^^ expected `i8`, found `u8`
|
help: change the type of the numeric literal from `u8` to `i8`
|
LL | OhNo = 0_i8,
| ^^^^

error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:30:16
|
LL | OhNo = 0_i8,
| ^^^^ expected `u8`, found `i8`
|
help: change the type of the numeric literal from `i8` to `u8`
|
LL | OhNo = 0_u8,
| ^^^^

error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:43:16
|
LL | OhNo = 0_u16,
| ^^^^^ expected `i16`, found `u16`
|
help: change the type of the numeric literal from `u16` to `i16`
|
LL | OhNo = 0_i16,
| ^^^^^

error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:56:16
|
LL | OhNo = 0_i16,
| ^^^^^ expected `u16`, found `i16`
|
help: change the type of the numeric literal from `i16` to `u16`
|
LL | OhNo = 0_u16,
| ^^^^^

error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:69:16
|
LL | OhNo = 0_u32,
| ^^^^^ expected `i32`, found `u32`
|
help: change the type of the numeric literal from `u32` to `i32`
|
LL | OhNo = 0_i32,
| ^^^^^

error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:82:16
|
LL | OhNo = 0_i32,
| ^^^^^ expected `u32`, found `i32`
|
help: change the type of the numeric literal from `i32` to `u32`
|
LL | OhNo = 0_u32,
| ^^^^^

error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:95:16
|
LL | OhNo = 0_u64,
| ^^^^^ expected `i64`, found `u64`
|
help: change the type of the numeric literal from `u64` to `i64`
|
LL | OhNo = 0_i64,
| ^^^^^

error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:108:16
|
LL | OhNo = 0_i64,
| ^^^^^ expected `u64`, found `i64`
|
help: change the type of the numeric literal from `i64` to `u64`
|
LL | OhNo = 0_u64,
| ^^^^^

error: aborting due to 8 previous errors

Expand Down
5 changes: 0 additions & 5 deletions src/test/ui/issues/issue-31910.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ error[E0308]: mismatched types
|
LL | X = Trait::Number,
| ^^^^^^^^^^^^^ expected `isize`, found `i32`
|
help: you can convert an `i32` to `isize` and panic if the converted value wouldn't fit
|
LL | X = Trait::Number.try_into().unwrap(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

Expand Down
10 changes: 0 additions & 10 deletions src/test/ui/issues/issue-8761.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,12 @@ error[E0308]: mismatched types
|
LL | A = 1i64,
| ^^^^ expected `isize`, found `i64`
|
help: change the type of the numeric literal from `i64` to `isize`
|
LL | A = 1isize,
| ^^^^^^

error[E0308]: mismatched types
--> $DIR/issue-8761.rs:5:9
|
LL | B = 2u8
| ^^^ expected `isize`, found `u8`
|
help: change the type of the numeric literal from `u8` to `isize`
|
LL | B = 2isize
| ^^^^^^

error: aborting due to 2 previous errors

Expand Down
10 changes: 0 additions & 10 deletions src/test/ui/repeat_count.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,12 @@ error[E0308]: mismatched types
|
LL | let f = [0; -4_isize];
| ^^^^^^^^ expected `usize`, found `isize`
|
help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit
|
LL | let f = [0; (-4_isize).try_into().unwrap()];
Copy link
Contributor Author

@lcnr lcnr Apr 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This help message was incorrect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
--> $DIR/repeat_count.rs:22:23
|
LL | let f = [0_usize; -1_isize];
| ^^^^^^^^ expected `usize`, found `isize`
|
help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit
|
LL | let f = [0_usize; (-1_isize).try_into().unwrap()];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 8 previous errors

Expand Down