diff options
| author | varkor <github@varkor.com> | 2018-08-15 02:02:52 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2018-08-15 02:02:52 +0100 |
| commit | d305f68cb9c0d93a30f65af0cd33acd90e3f2532 (patch) | |
| tree | 5a9bf729dd921d7a4b93143f5b971b094e8c5f8e /src/libsyntax | |
| parent | a5733050de780ae4d11e3a7af615df792fdf908e (diff) | |
| download | rust-d305f68cb9c0d93a30f65af0cd33acd90e3f2532.tar.gz rust-d305f68cb9c0d93a30f65af0cd33acd90e3f2532.zip | |
Warn when `generic_associated_types` feature gate is enabled
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 56e69b9df9e..98fbbe4bdef 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -1920,6 +1920,11 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute], err.emit(); } + // Some features are known to be incomplete and using them is likely to have + // unanticipated results, such as compiler crashes. We warn the user about these + // to alert them. + let incomplete_features = ["generic_associated_types"]; + let mut features = Features::new(); let mut edition_enabled_features = FxHashMap(); @@ -1955,6 +1960,16 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute], continue }; + if incomplete_features.iter().any(|f| *f == name.as_str()) { + span_handler.struct_span_warn( + mi.span, + &format!( + "the feature `{}` is incomplete and may cause the compiler to crash", + name + ) + ).emit(); + } + if let Some(edition) = ALL_EDITIONS.iter().find(|e| name == e.feature_name()) { if *edition <= crate_edition { continue |
