- 
                Notifications
    
You must be signed in to change notification settings  - Fork 401
 
          Filter out items other than non-generic functions and statics in our version of exported_symbols
          #1833
        
          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
          
     Merged
      
      
    
  
     Merged
                    
  
    Filter out items other than non-generic functions and statics in our version of exported_symbols
  
  #1833
                      Changes from all commits
      Commits
    
    
            Show all changes
          
          
            2 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      
    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 hidden or 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 hidden or 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
    
  
  
    
              Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
      
      Oops, something went wrong.
      
    
  
  
    
      This file contains hidden or 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 hidden or 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 hidden or 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,5 @@ | ||
| [package] | ||
| name = "issue_rust_86261" | ||
| version = "0.1.0" | ||
| authors = ["Miri Team"] | ||
| edition = "2018" | 
  
    
      This file contains hidden or 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,23 @@ | ||
| #![allow(unused_imports, unused_attributes, no_mangle_generic_items)] | ||
| 
     | 
||
| // Regression test for https://github.com/rust-lang/rust/issues/86261: | ||
| // `#[no_mangle]` on a `use` item. | ||
| #[no_mangle] | ||
| use std::{thread,panic, io, boxed, any, string}; | ||
| 
     | 
||
| // `#[no_mangle]` on a struct has a similar problem. | ||
| #[no_mangle] | ||
| pub struct NoMangleStruct; | ||
| 
     | 
||
| // If `#[no_mangle]` has effect on the `struct` above, calling `NoMangleStruct` will fail with | ||
| // "multiple definitions of symbol `NoMangleStruct`" error. | ||
| #[export_name = "NoMangleStruct"] | ||
| fn no_mangle_struct() {} | ||
| 
     | 
||
| // `#[no_mangle]` on a generic function can also cause ICEs. | ||
| #[no_mangle] | ||
| fn no_mangle_generic<T>() {} | ||
| 
     | 
||
| // Same as `no_mangle_struct()` but for the `no_mangle_generic()` generic function. | ||
| #[export_name = "no_mangle_generic"] | ||
| fn no_mangle_generic2() {} | 
  
    
      This file contains hidden or 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
    
  
  
    
              
  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.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.
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 is testing
#[no_mangle]onNode::ImplItem(&hir::ImplItem { kind: hir::ImplItemKind::Fn(..), .. }), which is included inexported_symbols(but previously broken in Miri: da2ed6f -- I fix that together in this PR in order to test this).)I can't test this in
tests/run-pass, because#[no_mangle]only seems to work on associated functions that are public in a library crate...https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=f1244afcdd26e2a28445f6e82ca46b50
If the associated function is used directly, it can works with
rustcwhen compiling as a binrary, but it still doesn't work in Miri:https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=46fc298b46ff44093c45cab9fddb6650
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.
So you are saying even with this patch, https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=46fc298b46ff44093c45cab9fddb6650 fails? Could you open an issue for that?