Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

ices/93646.rs: fixed with errors #1109

Closed
wants to merge 1 commit into from
Closed

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Feb 7, 2022

Issue: rust-lang/rust#93646

struct X<const N: usize = {
    let s: &str; s.len()
}>;

pub fn main() {}
=== stdout ===
=== stderr ===
error[E0106]: missing lifetime specifier
 --> /home/runner/work/glacier/glacier/ices/93646.rs:2:12
  |
2 |     let s: &str; s.len()
  |            ^ expected named lifetime parameter
  |
help: consider introducing a named lifetime parameter
  |
1 ~ struct X<const 'a, N: usize = {
2 ~     let s: &'a str; s.len()
  |

error: aborting due to previous error

For more information about this error, try `rustc --explain E0106`.
==============

=== stdout ===
=== stderr ===
error[E0106]: missing lifetime specifier
 --> /home/runner/work/glacier/glacier/ices/93646.rs:2:12
  |
2 |     let s: &str; s.len()
  |            ^ expected named lifetime parameter
  |
help: consider introducing a named lifetime parameter
  |
1 ~ struct X<const 'a, N: usize = {
2 ~     let s: &'a str; s.len()
  |

error: aborting due to previous error

For more information about this error, try `rustc --explain E0106`.
==============
@Alexendoo Alexendoo closed this in c431092 Feb 7, 2022
@Alexendoo Alexendoo deleted the autofix/ices/93646.rs branch February 7, 2022 12:54
@compiler-errors
Copy link
Member

@Alexendoo, actually this still repros for rust#93646 if the lifetime is provided:

struct X<const N: usize = {
    let s: &'static str; s.len()
}>;

pub fn main() {}

That'll be fixed in rust#93691, but should we edit this test to better record this distinction?

@Alexendoo
Copy link
Member

Ahh I didn't think to try that, I realise also I didn't need the s + 1. It could be worth adding one of the form

struct X<const N: usize = {
    let n: usize; n
}>;

pub fn main() {}

To be clear it's solely about uninitialised variables, but it's fairly minor and I see the PR is already queued for merge

@compiler-errors
Copy link
Member

Yeah no worries in that case.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants