-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Fix intrinsic const parameter counting with effects
#127452
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
52 changes: 52 additions & 0 deletions
52
tests/ui/intrinsics/safe-intrinsic-mismatch.effects.stderr
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,52 @@ | ||
error: using `#![feature(effects)]` without enabling next trait solver globally | ||
| | ||
= note: the next trait solver must be enabled globally for the effects feature to work correctly | ||
= help: use `-Znext-solver` to enable | ||
|
||
error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `size_of` | ||
--> $DIR/safe-intrinsic-mismatch.rs:11:5 | ||
| | ||
LL | fn size_of<T>() -> usize; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `size_of` | ||
--> $DIR/safe-intrinsic-mismatch.rs:11:5 | ||
| | ||
LL | fn size_of<T>() -> usize; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | ||
|
||
error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `assume` | ||
--> $DIR/safe-intrinsic-mismatch.rs:16:1 | ||
| | ||
LL | const fn assume(_b: bool) {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0308]: intrinsic has wrong type | ||
--> $DIR/safe-intrinsic-mismatch.rs:16:16 | ||
| | ||
LL | const fn assume(_b: bool) {} | ||
| ^ expected unsafe fn, found safe fn | ||
| | ||
= note: expected signature `unsafe fn(_)` | ||
found signature `fn(_)` | ||
|
||
error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `const_deallocate` | ||
--> $DIR/safe-intrinsic-mismatch.rs:20:1 | ||
| | ||
LL | const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0308]: intrinsic has wrong type | ||
--> $DIR/safe-intrinsic-mismatch.rs:20:26 | ||
| | ||
LL | const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {} | ||
| ^ expected unsafe fn, found safe fn | ||
| | ||
= note: expected signature `unsafe fn(_, _, _)` | ||
found signature `fn(_, _, _)` | ||
|
||
error: aborting due to 7 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
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
24 changes: 10 additions & 14 deletions
24
tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr
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 |
---|---|---|
@@ -1,17 +1,13 @@ | ||
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/minicore.rs:8:30 | ||
| | ||
LL | #![feature(const_trait_impl, effects, const_mut_refs)] | ||
| ^^^^^^^ | ||
| | ||
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information | ||
= note: `#[warn(incomplete_features)]` on by default | ||
error: the compiler unexpectedly panicked. this is a bug. | ||
|
||
error: requires `EffectsCompat` lang_item | ||
--> $DIR/minicore.rs:455:9 | ||
| | ||
LL | impl<T: Clone> Clone for RefCell<T> { | ||
| ^^^^^ | ||
query stack during panic: | ||
#0 [check_well_formed] checking that `<impl at $DIR/minicore.rs:459:1: 459:36>` is well-formed | ||
#1 [check_mod_type_wf] checking that types are well-formed in top-level module | ||
end of query stack | ||
|
||
error: aborting due to 1 previous error; 1 warning emitted | ||
error: the compiler unexpectedly panicked. this is a bug. | ||
|
||
query stack during panic: | ||
#0 [check_well_formed] checking that `drop` is well-formed | ||
#1 [check_mod_type_wf] checking that types are well-formed in top-level module | ||
end of query stack |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could theoretically be restructured to use
TyCtxt::has_host_param
at the cost of callinggenerics_of
twice in total, so er, dunno.