forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#44111 - zackmdavis:feature_attr_error_span, r…
…=nikomatsakis feature error span on attribute for fn_must_use, SIMD/align reprs, macro reëxport There were several feature-gated attributes for which the feature-not-available error spans would point to the item annotated with the gated attribute, when it would make more sense for the span to point to the attribute itself: if the attribute is removed, the function/struct/_&c._ likely still makes sense and the program will compile. (Note that we decline to make the analogous change for the `main`, `start`, and `plugin_registrar` features, for in those cases it makes sense for the span to implicate the entire function, of which there is little hope of using without the gated attribute.) ![feature_attr_error_span](https://user-images.githubusercontent.com/1076988/29746531-fd700bfe-8a91-11e7-9c5b-6f5324083887.png)
- Loading branch information
Showing
10 changed files
with
107 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
#![feature(attr_literals)] | ||
|
||
#[repr(align(16))] | ||
struct Gem { | ||
mohs_hardness: u8, | ||
poofed: bool, | ||
weapon: Weapon, | ||
} | ||
|
||
#[repr(simd)] | ||
struct Weapon { | ||
name: String, | ||
damage: u32 | ||
} | ||
|
||
impl Gem { | ||
#[must_use] fn summon_weapon(&self) -> Weapon { self.weapon } | ||
} | ||
|
||
#[must_use] | ||
fn bubble(gem: Gem) -> Result<Gem, ()> { | ||
if gem.poofed { | ||
Ok(gem) | ||
} else { | ||
Err(()) | ||
} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
error: the struct `#[repr(align(u16))]` attribute is experimental (see issue #33626) | ||
--> $DIR/gated-features-attr-spans.rs:13:1 | ||
| | ||
13 | #[repr(align(16))] | ||
| ^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: add #![feature(repr_align)] to the crate attributes to enable | ||
|
||
error: SIMD types are experimental and possibly buggy (see issue #27731) | ||
--> $DIR/gated-features-attr-spans.rs:20:1 | ||
| | ||
20 | #[repr(simd)] | ||
| ^^^^^^^^^^^^^ | ||
| | ||
= help: add #![feature(repr_simd)] to the crate attributes to enable | ||
|
||
warning: `#[must_use]` on methods is experimental (see issue #43302) | ||
--> $DIR/gated-features-attr-spans.rs:27:5 | ||
| | ||
27 | #[must_use] fn summon_weapon(&self) -> Weapon { self.weapon } | ||
| ^^^^^^^^^^^ | ||
| | ||
= help: add #![feature(fn_must_use)] to the crate attributes to enable | ||
|
||
warning: `#[must_use]` on functions is experimental (see issue #43302) | ||
--> $DIR/gated-features-attr-spans.rs:30:1 | ||
| | ||
30 | #[must_use] | ||
| ^^^^^^^^^^^ | ||
| | ||
= help: add #![feature(fn_must_use)] to the crate attributes to enable | ||
|
||
error: aborting due to 2 previous errors | ||
|