Skip to content

Rollup of 8 pull requests #108701

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

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
cbf4d4e
Deny capturing late-bound non-lifetime param in anon const
compiler-errors Feb 28, 2023
45f694d
Remove pass initialization code
nikic Mar 1, 2023
655a810
Print NewPM passes
nikic Mar 1, 2023
4b01a1a
Fix another ICE in point_at_expr_source_of_inferred_type
compiler-errors Mar 2, 2023
23d4757
Fix array-size-threshold config deserialization error
Alexendoo Feb 28, 2023
729275d
Forbid the use of `#[target_feature]` on `main`
LeSeulArtichaut Mar 2, 2023
faebedf
Forbid the use of `#[target_feature]` on `start`
LeSeulArtichaut Mar 2, 2023
ff2c609
Match unmatched backticks in compiler/ that are part of rustdoc
est31 Mar 3, 2023
6df5ae4
Match unmatched backticks in comments in compiler/
est31 Mar 3, 2023
ef65890
Match end user facing unmatched backticks in compiler/
est31 Mar 3, 2023
5a02105
Rustdoc-ify LiteralKind note
est31 Mar 3, 2023
c54f061
Don't put integers into backticks during formatting
est31 Mar 3, 2023
a15abea
canonicalization
lcnr Feb 20, 2023
fdfff54
Rollup merge of #107981 - lcnr:canonicalization-uwu, r=compiler-errors
matthiaskrgr Mar 3, 2023
f8df7c4
Rollup merge of #108553 - compiler-errors:non-lt-late-bound-in-anon-c…
matthiaskrgr Mar 3, 2023
8ccbbbe
Rollup merge of #108599 - nikic:drop-init, r=cuviper
matthiaskrgr Mar 3, 2023
03a6420
Rollup merge of #108651 - LeSeulArtichaut:108645-target-feature-on-ma…
matthiaskrgr Mar 3, 2023
843a062
Rollup merge of #108667 - compiler-errors:issue-108664, r=estebank
matthiaskrgr Mar 3, 2023
2e256a4
Rollup merge of #108674 - flip1995:clippy_backport, r=Manishearth
matthiaskrgr Mar 3, 2023
281dc4e
Rollup merge of #108685 - est31:backticks_matchmaking, r=petrochenkov
matthiaskrgr Mar 3, 2023
38b0b9e
Rollup merge of #108694 - est31:backticks_matchmaking_comments, r=Nil…
matthiaskrgr Mar 3, 2023
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
Prev Previous commit
Next Next commit
Forbid the use of #[target_feature] on start
  • Loading branch information
LeSeulArtichaut committed Mar 3, 2023
commit faebedfef5dbcbbaff39db6ab6a34ba4a8eb3570
3 changes: 3 additions & 0 deletions compiler/rustc_hir_analysis/locales/en-US.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ hir_analysis_target_feature_on_main = `main` function is not allowed to have `#[
hir_analysis_start_not_track_caller = `start` is not allowed to be `#[track_caller]`
.label = `start` is not allowed to be `#[track_caller]`

hir_analysis_start_not_target_feature = `start` is not allowed to have `#[target_feature]`
.label = `start` is not allowed to have `#[target_feature]`

hir_analysis_start_not_async = `start` is not allowed to be `async`
.label = `start` is not allowed to be `async`

Expand Down
9 changes: 9 additions & 0 deletions compiler/rustc_hir_analysis/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,15 @@ pub(crate) struct StartTrackCaller {
pub start: Span,
}

#[derive(Diagnostic)]
#[diag(hir_analysis_start_not_target_feature)]
pub(crate) struct StartTargetFeature {
#[primary_span]
pub span: Span,
#[label]
pub start: Span,
}

#[derive(Diagnostic)]
#[diag(hir_analysis_start_not_async, code = "E0752")]
pub(crate) struct StartAsync {
Expand Down
7 changes: 7 additions & 0 deletions compiler/rustc_hir_analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,13 @@ fn check_start_fn_ty(tcx: TyCtxt<'_>, start_def_id: DefId) {
});
error = true;
}
if attr.has_name(sym::target_feature) {
tcx.sess.emit_err(errors::StartTargetFeature {
span: attr.span,
start: start_span,
});
error = true;
}
}

if error {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// only-x86_64

#![feature(start)]
#![feature(target_feature_11)]

#[start]
#[target_feature(enable = "avx2")]
//~^ ERROR `start` is not allowed to have `#[target_feature]`
fn start(_argc: isize, _argv: *const *const u8) -> isize { 0 }
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error: `start` is not allowed to have `#[target_feature]`
--> $DIR/issue-108645-target-feature-on-start.rs:7:1
|
LL | #[target_feature(enable = "avx2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | fn start(_argc: isize, _argv: *const *const u8) -> isize { 0 }
| -------------------------------------------------------- `start` is not allowed to have `#[target_feature]`

error: aborting due to previous error