fix ice for associated constant generics
This commit is contained in:
parent
d40f24e956
commit
8c7d9f6092
3 changed files with 24 additions and 1 deletions
|
@ -956,7 +956,7 @@ impl SourceMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn generate_fn_name_span(&self, span: Span) -> Option<Span> {
|
pub fn generate_fn_name_span(&self, span: Span) -> Option<Span> {
|
||||||
let prev_span = self.span_extend_to_prev_str(span, "fn", true, true).unwrap_or(span);
|
let prev_span = self.span_extend_to_prev_str(span, "fn", true, true)?;
|
||||||
if let Ok(snippet) = self.span_to_snippet(prev_span) {
|
if let Ok(snippet) = self.span_to_snippet(prev_span) {
|
||||||
debug!(
|
debug!(
|
||||||
"generate_fn_name_span: span={:?}, prev_span={:?}, snippet={:?}",
|
"generate_fn_name_span: span={:?}, prev_span={:?}, snippet={:?}",
|
||||||
|
|
9
src/test/ui/generics/issue-98432.rs
Normal file
9
src/test/ui/generics/issue-98432.rs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
struct Struct<T>(T);
|
||||||
|
|
||||||
|
impl<T> Struct<T> {
|
||||||
|
const CONST: fn() = || {
|
||||||
|
struct _Obligation where T:; //~ ERROR can't use generic parameters from outer function
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
14
src/test/ui/generics/issue-98432.stderr
Normal file
14
src/test/ui/generics/issue-98432.stderr
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
error[E0401]: can't use generic parameters from outer function
|
||||||
|
--> $DIR/issue-98432.rs:5:34
|
||||||
|
|
|
||||||
|
LL | impl<T> Struct<T> {
|
||||||
|
| - type parameter from outer function
|
||||||
|
LL | const CONST: fn() = || {
|
||||||
|
LL | struct _Obligation where T:;
|
||||||
|
| ^ use of generic parameter from outer function
|
||||||
|
|
|
||||||
|
= help: try using a local generic parameter instead
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0401`.
|
Loading…
Add table
Add a link
Reference in a new issue